R3.2.8.6-R1.1 Research-Logic Reasoning-Only Recovery

#28
Files changed (1) hide show
  1. core/pipeline_agent.py +36 -4
core/pipeline_agent.py CHANGED
@@ -1272,10 +1272,42 @@ Literature Synthesis:
1272
  {evidence_block}
1273
  {mode_directive}
1274
  Return a concise PROVISIONAL RESEARCH LOGIC CONTRACT in plain English prose. It must guide later sections without fixing an expected result or conclusion. Do not use citations in the contract."""
1275
- return self.stream_deepseek(
1276
- sys_prompt, user_prompt, max_tokens=2200,
1277
- model_role="reasoning", thinking=True, allow_fallback=False,
1278
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1279
 
1280
  @staticmethod
1281
  def _front_matter_keywords(value, minimum=4, maximum=6):
 
1272
  {evidence_block}
1273
  {mode_directive}
1274
  Return a concise PROVISIONAL RESEARCH LOGIC CONTRACT in plain English prose. It must guide later sections without fixing an expected result or conclusion. Do not use citations in the contract."""
1275
+ def _stream_with_reasoning_exhaustion_recovery():
1276
+ try:
1277
+ yield from self.stream_deepseek(
1278
+ sys_prompt,
1279
+ user_prompt,
1280
+ max_tokens=2200,
1281
+ model_role="reasoning",
1282
+ thinking=True,
1283
+ allow_fallback=False,
1284
+ reasoning_only_recovery=True,
1285
+ )
1286
+ return
1287
+ except DeepSeekReasoningOnlyExhaustionError as exc:
1288
+ logging.warning(
1289
+ "Research logic reasoning-only exhaustion; retrying once with thinking disabled: %s",
1290
+ exc,
1291
+ )
1292
+ self._touch_execution_progress("research_logic_direct_recovery")
1293
+
1294
+ recovery_system = (
1295
+ sys_prompt
1296
+ + "\n\nRECOVERY MODE: Produce the final provisional research logic contract directly. "
1297
+ "Do not perform extended hidden reasoning. Preserve the original topic, literature synthesis, "
1298
+ "research evidence, uncertainty, evidence-strength boundaries, and mode-specific planning constraints. "
1299
+ "Do not invent findings, coefficients, causal claims, or facts."
1300
+ )
1301
+ yield from self.stream_deepseek(
1302
+ recovery_system,
1303
+ user_prompt,
1304
+ max_tokens=2200,
1305
+ model_role="reasoning",
1306
+ thinking=False,
1307
+ allow_fallback=False,
1308
+ )
1309
+
1310
+ return _stream_with_reasoning_exhaustion_recovery()
1311
 
1312
  @staticmethod
1313
  def _front_matter_keywords(value, minimum=4, maximum=6):