Skip to content

fix(loop): keep headless NEEDS_PRO escalation one-shot#2236

Merged
esengine merged 1 commit into
esengine:mainfrom
BeiZi6:fix/loop-headless-needs-pro-one-shot
May 29, 2026
Merged

fix(loop): keep headless NEEDS_PRO escalation one-shot#2236
esengine merged 1 commit into
esengine:mainfrom
BeiZi6:fix/loop-headless-needs-pro-one-shot

Conversation

@BeiZi6

@BeiZi6 BeiZi6 commented May 29, 2026

Copy link
Copy Markdown

Problem

In headless reasonix run, <<<NEEDS_PRO>>> should retry only the current turn on deepseek-v4-pro. Mutating this.model without restoration leaves the session pinned to pro for later turns, which breaks the one-shot contract called out in #2195.

Fix

  • Detect <<<NEEDS_PRO...>>> before persisting the flash response and retry the turn on deepseek-v4-pro.
  • Track the actual callModel so stats, cache diagnostics, and session log metadata are attributed correctly.
  • Restore the base model before terminal exits and forced-summary paths so following turns return to flash.

Testing

  • npm run verify
  • push pre-hook npm run verify

Related to #2195.

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the correct one-shot fix for the headless <<<NEEDS_PRO>>> escalation — exactly what was missing in #2195. You capture baseModelForTurn = this.model, use a (possibly escalated) callModel for the call, and restoreModelIfNeeded() resets this.model back to the base in finally, so a single escalation retries this turn on pro and the next turn is back on flash — matching the contract in src/prompt-fragments.ts ('retries this turn on deepseek-v4-pro, one shot') rather than permanently pinning pro. The anchored ^\s*<<<NEEDS_PRO(?::…)?>>> regex is also tighter than a loose substring match, and you added a test. CI approved (fork). Approving — good fix. (I'll point #2195 here as superseded.)

@esengine esengine merged commit 08eaac5 into esengine:main May 29, 2026
4 checks passed
@BeiZi6 BeiZi6 deleted the fix/loop-headless-needs-pro-one-shot branch May 29, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants