Log turn_in_flight gate rejections and add an in-turn prompt-drop tripwire - #415
Conversation
Three send_prompt*/fork_session sites reject a concurrent prompt with AcpError::TurnInProgress but emit nothing, so on a desktop run the rejection leaves no trace (the "logs didn't reveal anything" from xintaofei#409). - debug! at the three gate sites (send_prompt_inner, send_prompt_linked_with_message_id, fork_session): an expected, user-driven queue-while-busy condition, carrying connection_id. - warn! tripwire before the mid-turn command handler's `_ => {}`: a Prompt reaching it means an ungated sender broke the gate invariant. Refs xintaofei#409 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n drops The two turn_in_flight gate lines were byte-identical and share a module target with no file/line in the default format, so a reader could not tell which of the two checks bounced the prompt. Each now names its gate. maybe_emit_ext_notification is the silent fallback xintaofei#409's second point was pointing at. All three of its drop paths now log at debug: an unhandled agent request, an unexpected response dispatch, and an ext notification whose method no mapper claims. The last is gated on is_known_ext_method so a _claude/sdkMessage that merely is not an API retry stays quiet -- that method arrives once per SDK message, and an unguarded line there would sit on a hot path. Refs xintaofei#409
|
Thanks — merging this. I pushed one follow-up commit (0f1135c) rather than asking you for another round, since both items came out of my own review notes. 1. The two gate lines were byte-identical. Both read 2. Picked up the That last one needed a guard. One correction for the record: the PR description mentions leaving out "the 4th Left alone deliberately, in case anyone wonders later:
Green across the board on the final state: 2239 desktop + 2215 server + 12 Nice catch on the original issue — the gate genuinely had no trace, and the ext-notification fallback was a real blind spot. |
Addresses #409.
Three sites reject a concurrent prompt with
AcpError::TurnInProgressbut emit nothing, so on a desktop run the rejection leaves no backend trace — matching the "logs didn't reveal anything" reported in #409.Changes
debug!at the three gate sites (send_prompt_inner,send_prompt_linked_with_message_id,fork_session), each carryingconnection_id.debug!because queue-while-busy is an expected, user-driven condition on a normal path (would be noisy atwarn).warn!tripwire before the mid-turn command handler's_ => {}: the gate rejects a second prompt before it is ever enqueued, so aPromptreaching that handler means an ungated sender broke the gate invariant.Deliberately out of scope (happy to add if wanted)
TurnInProgresssite in the session-activation/rebind path (manager.rs) — a different operation than the three prompt/fork gates.maybe_emit_ext_notificationfallback (the real target of codex官方可以,但是codeg不行 #2 in the thread) — an unmapped ext notification returns with no log or probe counter.Followed the review's suggestions:
debug!for the gate vswarn!for the tripwire,connection_idon every line, and the[ACP]prefix.