Skip to content

fix(grok): skip set_model when effort is unchanged or a prompt is in flight - #7980

Draft
maria-rcks wants to merge 1 commit into
fix/grok-reasoning-effortfrom
cursor/skip-grok-set-model-on-steer-f90e
Draft

fix(grok): skip set_model when effort is unchanged or a prompt is in flight#7980
maria-rcks wants to merge 1 commit into
fix/grok-reasoning-effortfrom
cursor/skip-grok-set-model-on-steer-f90e

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

What Changed

applyGrokAcpModelSelection no longer treats a present reasoningEffort selection as enough reason to call session/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.

sendTurn also skips the apply entirely on a steer (promptsInFlight > 0). Prep runs under the thread lock while prompt runs outside it, so a steer must not issue set_model while a prior prompt is still in flight.

Why

The composer always restates reasoningEffort once Grok capabilities are discovered. Before the reasoning-effort change, same-model turns skipped set_model entirely, so steers never hit that path. After it, every turn — including steers — called set_model.

UI Changes

None. This is a server-only apply/skip change.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Made by Cursor Grok 4.6 via the Cursor Cloud harness while working on T3 Code.

Open in Web Open in Cursor 

Note

Skip session/set_model in GrokAdapter when effort is unchanged or a prompt is in flight

  • Tracks the last applied reasoning effort via ctx.currentReasoningEffort in GrokSessionContext, set during startSession and updated after each model selection.
  • sendTurn now skips session/set_model entirely on steer turns (when a prior prompt is still in flight) and only calls it when the model id or reasoningEffort actually changes.
  • applyGrokAcpModelSelection accepts a currentReasoningEffort parameter and treats a present-but-unchanged effort as a no-op.
  • Risk: changing the model id without an explicit reasoningEffort selection now clears ctx.currentReasoningEffort (see GrokAdapter.ts); a subsequent turn that restates the cleared effort will issue set_model again.
📊 Macroscope summarized 7db5f22. 2 files reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted

🗂️ Filtered Issues

…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>
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bf688214-fe06-4923-8b67-36785fe4d8ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 23, 2026
interruptedTurnIds: new Set(),
promptsInFlight: 0,
currentModelId: boundModelId,
currentReasoningEffort: requestedStartReasoningEffort,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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.

@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.4 KiB 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 7.8 KiB
Codex Live turn WebSocket decoded 55.0 KiB 66.4 KiB
Codex Live turn messages 16 21
Claude Total thread wire 13.5 KiB 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.6 KiB 7.8 KiB
Claude Live turn WebSocket decoded 55.8 KiB 66.4 KiB
Claude Live turn messages 16 21

Baseline: unavailable · PR result: 7db5f22 · Source CI: failure

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 109.4 KiB
  • Claude decoded thread snapshot: 110.1 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants