fix(loop): keep headless NEEDS_PRO escalation one-shot#2236
Merged
esengine merged 1 commit intoMay 29, 2026
Conversation
esengine
approved these changes
May 29, 2026
esengine
left a comment
Owner
There was a problem hiding this comment.
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.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In headless
reasonix run,<<<NEEDS_PRO>>>should retry only the current turn ondeepseek-v4-pro. Mutatingthis.modelwithout restoration leaves the session pinned to pro for later turns, which breaks the one-shot contract called out in #2195.Fix
<<<NEEDS_PRO...>>>before persisting the flash response and retry the turn ondeepseek-v4-pro.callModelso stats, cache diagnostics, and session log metadata are attributed correctly.Testing
npm run verifynpm run verifyRelated to #2195.