[Bug]: A message sent while an agent-launched Plan turn still runs joins that turn, so the thread reads Build but asks to approve every edit #48190
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#
- From an agent thread, call
t3_thread_launchwithinteractionMode: "plan",runtimeMode: "full-access"and the Claude provider. - Open the new thread in the desktop app. Send a message from the composer while the Plan turn is still active, for example "go" right after the plan text appears.
- Read the thread with
t3_thread_readand watch it work.
A repro that needs no paid model is the scenario scripts/scenarios/build-send-waits-for-plan-turn.e2e.ts on this branch (replay agent, Chromium). It starts a Plan turn over RPC and types into the composer while that turn streams.
Expected behavior#
#33131 removed the Plan control from the clients: every send uses build mode, and "the next message from the user moves the thread to build mode". That should also hold when the message arrives before the Plan turn has ended. The work that answers the message should run in build mode, and a Full access thread should then edit files without asking.
Actual behavior#
- The composer saves build mode (
thread.interaction-mode.set) and then dispatches the message with asteerdelivery intent. The server resolves it tosteer_active, so the message joins the Plan turn. - The thread then reads
interactionMode: "default"andruntimeMode: "full-access", with one run. Nothing shows that its turn is still a Plan turn. - The turn keeps the modes it started with. On Claude it stays in
planpermission mode: shell commands ran, and every file edit raised its own approval (approval_request, one per Edit, 10 in 40 seconds). - Five other threads launched in the same minute with
interactionMode: "default"raised no approval. - The timing is easy to hit. My message was recorded 130 ms after the last assistant message of the plan, and the turn was still active.
From reading source on main (7b7ca65f9a):
resolveDeliveryIntentinapps/server/src/orchestration-v2/CommandPolicy.tsreturnssteer_activefor thesteerintent, whatever modes the active turn started in.ProviderTurnStartServicerecordsstartedModeswhen the provider turn starts. A later mode change reaches only the next turn.- In
ClaudeAdapterV2.ts,permissionModeForClaudeRuntimePolicyreturns"plan"for a Plan turn before the Full access branches, andExitPlanModeis denied until a later turn.
Checked by running, on main: in the scenario above the composer's message shows as "Steer" and joins the running Plan turn. With the replay agent the first attempt shows as "Superseded attempt · Cut off by a steer".
Not checked: a live Claude turn on a dev build of main. The Claude behavior above is what I saw on the nightly build named below, plus the source.
Impact#
Major degradation or frequent failure
Version or commit#
0.1.14-nightly.20261203.5651 (desktop, where it happened). Source read and scenario run on main @ 7b7ca65f9a.
Environment#
Windows 11 x64, T3 Code desktop nightly, Claude provider. Seen in a private project.
Workaround#
Approve each edit by hand, or wait until the Plan turn has fully ended before the first message. An agent can launch the thread in default mode and ask for the plan in its prompt.
Related#
- #29250 (closed) and #33131: the same trap, per-edit approvals on a Full access thread that started in plan mode. The closing note says "Reopen if a plan thread still gets stuck on a build that includes that commit." This is that case, when the next message arrives during the Plan turn.
- #43485 and #43502: an agent's
t3_thread_sendleaves the thread in plan mode. Here the thread has already moved to build mode, and its running turn has not. - #31322: queued messages run in the modes they were sent with. It does not change a steer into a running turn.
I have a small server fix with a failing test on the branch above and will open a PR that links this issue.
tanstack-source added labelsbug
Ahmadelmacho(GitHub profile, opens in a new tab) linked this to #48192
Sign in to join this conversation.