Version: agy 1.4.12 (agy acp, one process serving several sessions at once). Client: an ACP client that answers every session/request_permission within a few milliseconds.
What happens
- Mid-turn, a step is lost. In two sessions, while the
session/promptwas still open, the model produced arun_commandstep. The client never got atool_callupdate or asession/request_permissionfor it. The step staysCORTEX_STEP_STATUS_WAITINGin the conversation database. NoStream goroutine exitedline is logged, so the prompt never returns, and the client shows the turn running indefinitely. - After a turn, the agent runs on its own. A session’s turn ended normally (
Stream goroutine exited ..., sending completion signal, prompt answered withend_turn). A command from that turn had gone async afterWaitMsBeforeAsync. When it finished about 1.5 minutes later, agy added a system message ([Message] ... task-N finished with result: ...,MESSAGE_PRIORITY_HIGH) and ran the agent again with nosession/promptopen. That run read files and then reached arun_commandthat needs confirmation. The client got none of these steps, so the step waits forever and the client shows the session as idle.
Log evidence (acp-server log, 1.4.12)
- Normal step:
Monitor sir_flash_lite FINISHED: triggered=false, then within 10 msTool confirmation for conversation <A> step 1481 (... approved=true). The client had received that step’stool_callabout 0.2 s after the model response. - Lost step:
streamGenerateContentat 14:42:37.64,Monitor agy_tool_safety FINISHED: triggered=true, reason="unknown_command", thenMonitor sir_flash_lite FINISHED: triggered=falseat 14:42:39.06. After that, nothing for conversation<A>: noTool confirmationand noStream goroutine exited. Step 1483 isWAITING. Another session on the same process kept getting confirmations at 14:42:29 and 14:42:46, so the client and the pipe were working. - Same pattern for conversation
<B>(step 1002, monitors finished at 13:57:20.57). - After the turn, conversation
<C>:Stream goroutine exitedat 18:54:16, then[Sonar] Resolved active tagsat 18:55:53 with noACP Request received: session/prompt. Monitors pass at 18:56:09 and step 176 staysWAITING. - For comparison,
session/cancelworks: when a permission was pending, the client’s cancelled answer was logged asapproved=false, thenCancelling conversation ..., and the stream exited.
Expected
- Every step that needs confirmation is sent to the client as
tool_callplussession/request_permissionwhile the prompt is open. - Work that continues after a background task finishes either happens inside a client prompt or is reported to the client, rather than running unseen and stalling on a confirmation nobody can give.
Repro outline
- Start
agy acpand open two or three sessions on the one process, with the client auto-approving permission requests. - In each session, have the agent poll a slow command in a loop (for example
sleep 6; <status check>, which needs confirmation underunknown_commandorunquoted_shell_operators) for 20 to 40 minutes, while it also starts long commands that go async. - Watch for a step that stays
WAITINGwith noTool confirmationline and nosession/request_permissionat the client. - For the second issue: end a turn while an async command is still running, wait for it to finish, and check for agent steps logged with no open prompt.