🤖 fix: Mid-turn stage Continue drops a thinking change made during the turn
Maintainers usually reply within 1 day
A pull request for this has already been merged.
- #7589 by @ThomasK33 — merged
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend-api-design
Research direction
Start with AgentSession.setActiveTurnThinkingLevel in src/node/services/agentSession.ts and compare how setActiveTurnServiceTier updates captured options. Then trace TokenBudgetStrategy.onContextBudgetStepSettled in src/node/services/contextManagement/strategies/tokenBudget.ts and the Continue enqueue path described in #7231. Add a test that changes the thinking level during a turn, settles a step that stops for a stage, and verifies the Continue uses the new level.
Written by the indexing model from the issue text.
Description
Found from code, not reproduced. Found while reviewing #7231 (Codex thread PRRT_kwDOPxxmWM6vY-Zm on the refusal-fallback handover). Related: #5286.
Problem
A user changes the thinking level while a turn is streaming. Then a Token Budget stage stops that turn mid-turn and queues a "Continue". The Continue most likely runs at the turn's original thinking level, not at the level the user chose.
Evidence (code on main)
AgentSession.setActiveTurnThinkingLevel(src/node/services/agentSession.ts, around line 11298) only setsholder.pendingandholder.manualon the active turn's thinking holder. It never updatesactiveStreamContext.options.setActiveTurnServiceTier, just below it, does updateactiveStreamContext.options(and the auto-retry request) for the same reason: a later request built from the captured options must see the change.- The stage Continue entry copies the stream context's captured options (
TokenBudgetStrategy.onContextBudgetStepSettledinsrc/node/services/contextManagement/strategies/tokenBudget.ts;enqueueContinuationin #7231). Those options keep the turn's explicit originalthinkingLevel, which wins over the newly persisted setting.
Proposed fix
Make setActiveTurnThinkingLevel update the captured send options, as setActiveTurnServiceTier does, or build the Continue's options from the holder's applied or pending level. A test sends a turn, changes the level mid-turn, settles a step that stops for a stage, and checks the Continue's thinkingLevel.
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $515.79
- Dominant language
- TypeScript
- Stars
- 2.1k
- Forks
- 140
- Avg merge
- 3h 23m
- Merged PRs (30d)
- 953
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/xum
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
VictoriaMetrics/victorialogs-datasource#747 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
bug from-studio
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
esengine/DeepSeek-Reasonix#14608 ·
Maintainers usually reply within 1 day
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
getarcaneapp/arcane#4590 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Clouditera/VulnHunter#57 ·