fix(grok): skip set_model when effort is unchanged or a prompt is in flight - #7980
fix(grok): skip set_model when effort is unchanged or a prompt is in flight#7980maria-rcks wants to merge 1 commit into
Conversation
…flight The composer always restates reasoningEffort once Grok capabilities are discovered. Treating that as a reason to call session/set_model made every sendTurn, including steers, issue the RPC while a prior prompt was still in flight. Only apply when the model or effort actually changed, and skip the call entirely on a steer. Made by Cursor Grok 4.6 via the Cursor Cloud harness while working on T3 Code. Co-authored-by: maria <maria-rcks@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| interruptedTurnIds: new Set(), | ||
| promptsInFlight: 0, | ||
| currentModelId: boundModelId, | ||
| currentReasoningEffort: requestedStartReasoningEffort, |
There was a problem hiding this comment.
🟡 Medium Layers/GrokAdapter.ts:788
A requested reasoning effort is cached as applied even when the initial selection has no boundModelId, so a later selection with that model and the same effort omits _meta.reasoningEffort and never applies it. Initialize currentReasoningEffort only when the start model selection was actually applied.
- currentReasoningEffort: requestedStartReasoningEffort,
+ currentReasoningEffort: boundModelId ? requestedStartReasoningEffort : undefined,🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/server/src/provider/Layers/GrokAdapter.ts around line 788:
A requested reasoning effort is cached as applied even when the initial selection has no `boundModelId`, so a later selection with that model and the same effort omits `_meta.reasoningEffort` and never applies it. Initialize `currentReasoningEffort` only when the start model selection was actually applied.
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
What Changed
applyGrokAcpModelSelectionno longer treats a presentreasoningEffortselection as enough reason to callsession/set_model. It compares against the effort last applied on the session and only sends the RPC when the model id or effort actually changed.sendTurnalso skips the apply entirely on a steer (promptsInFlight > 0). Prep runs under the thread lock whilepromptruns outside it, so a steer must not issueset_modelwhile a prior prompt is still in flight.Why
The composer always restates
reasoningEffortonce Grok capabilities are discovered. Before the reasoning-effort change, same-model turns skippedset_modelentirely, so steers never hit that path. After it, every turn — including steers — calledset_model.UI Changes
None. This is a server-only apply/skip change.
Checklist
Made by Cursor Grok 4.6 via the Cursor Cloud harness while working on T3 Code.
Note
Skip
session/set_modelinGrokAdapterwhen effort is unchanged or a prompt is in flightctx.currentReasoningEffortinGrokSessionContext, set duringstartSessionand updated after each model selection.sendTurnnow skipssession/set_modelentirely on steer turns (when a prior prompt is still in flight) and only calls it when the model id orreasoningEffortactually changes.applyGrokAcpModelSelectionaccepts acurrentReasoningEffortparameter and treats a present-but-unchanged effort as a no-op.reasoningEffortselection now clearsctx.currentReasoningEffort(see GrokAdapter.ts); a subsequent turn that restates the cleared effort will issueset_modelagain.📊 Macroscope summarized 7db5f22. 2 files reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted
🗂️ Filtered Issues