[Bug]: A /context sent during a Claude turn is steered into it, which stops the running tool and ends the turn #32606
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- Open a Claude thread (I used Claude Haiku 5.5).
- Send:
Use the Bash tool to run `python3 -c 'import time; time.sleep(40); print(1)'` in the foreground, then reply with the word done. - While the row shows "Running python3", type
/context(or/context all) and press Enter. The default send while a turn runs is a steer, and the message gets the "Steer" label.
Expected behavior#
/context only reports the context window. The running tool call continues, and the agent finishes its task (it replies "done" after about 40 seconds).
Actual behavior#
The turn ends at once. The 40-second tool call does not complete, the agent never replies "done", and the only output is the /context report. In my run the turn shows "Worked for 14s".
The original task is lost silently: nothing tells the user that the steer stopped the work.
Cause, as far as I can tell from the code:
CommandPolicy.isNativeMaintenanceCommandtreats only/compactand/logoutas commands that must not join a running turn. Every other slash command,/contexttoo, can be steered.ClaudeAdapterV2.steerTurnoffers the text as anSDKUserMessagewithpriority: "now", and Claude's capabilities declareactiveSteeringInterruptsTools: true. Claude Code runs/contextas a local command, so the steer interrupts the tool and the turn ends with the command's output.
/context is a read-only command that users send mid-turn on purpose (to check how full the window is during long work), so it is easy to hit.
Impact#
Major degradation or frequent failure
Version or commit#
Reproduced on a local checkout based on main @ 25bf84ab, with /context all (its send path is the same as on main). The released desktop app (0.1.7) also steers /context: the message gets the "Steer" label there too.
Environment#
macOS 26.4.1, web dev server, Claude Code 2.1.319, Claude Agent SDK 0.3.316, Claude Haiku 5.5
Logs or stack traces#
(no error is logged; the turn ends normally after the steered /context)
Screenshots, recordings, or supporting files#
The 40-second tool call was steered at about 14 s. The turn ended there with only the /context output, and the agent never replied "done":
Workaround#
Wait for the turn to end before sending /context. (Queueing it with the alternate send modifier should also avoid the steer, but I did not test that.)
A possible fix: read the window with the Claude Agent SDK's getContextUsage() control request, which answers while a turn runs (under a second in my tests) and never touches the turn. Discussion #31792 proposes a context breakdown built on that call, and I left a working prototype there.
tanstack-source added labelsbug
juliusmarminge closed this
Sign in to join this conversation.
This is the same problem as #40316, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.