Repository navigation
Conversation
|
@kit-code-agent review |
There was a problem hiding this comment.
Six findings: a rollover steer can return the wrong child turn’s output; a late withdrawal can disconnect unrelated Gateway sessions; Stop can leave a structured worker’s next prompt waiting on detached work; Desktop can lose audio playback and newer draft attachments; and generated Swift records the wrong schema revision.
Took 37 min
There was a problem hiding this comment.
An ordinary child prompt can return a rollover steer's result. Gateway can silently lose a withdrawal under writer backpressure or disconnect unrelated sessions when a withdrawal races close. Desktop can open changed source audio instead of the echoed bytes, and saved drafts can crowd out the transcript.
Took 22 min
There was a problem hiding this comment.
A later Stop can overtake an accepted withdrawal under Gateway backpressure. Nested ACP capture can silently drop output before the matching echo or disconnect sibling sessions when its provisional output budget fills. Desktop creates an unmanaged playback copy each time a user opens echoed local audio.
Took 17 min
There was a problem hiding this comment.
A pending withdrawal can consume Stop's last writer slot and disconnect unrelated Gateway sessions. Nested prompts can hang when a matching echo is followed by Idle without an observed Running state, or fail because of updates their result would discard. The Desktop playback cache can delete files it did not create and has no aggregate storage limit.
Took 10 min
| if repeated_idle | ||
| && !self.current.answer_observed | ||
| && self.current.turn.foreground == Foreground::Waiting |
There was a problem hiding this comment.
[P3] Keep stale Idle from truncating a streaming nested answer
For a child that omits the active snapshot, the first nonempty answer chunk sets answer_observed without changing the foreground from Waiting. A subsequent repeated Idle then skips this guard and settles the correlated prompt immediately. If that snapshot repeats the previous turn’s refusal, prompt_outcome reports a refusal and capture drops the rest of the answer, even if the real Idle(end_turn) is next. ACP v2 allows repeated snapshots to carry the previous stop reason and says not to count them as fresh completions. Treat an Idle after answer progress as provisional when no foreground transition was observed: allow subsequent output to invalidate it, and use bounded confirmation so a genuine final Idle from a peer that omits Running can still settle. Simply removing the answer check would regress that supported case.
Suggested test (simplified):
peer.seed_idle(Refusal);
peer.script_next([
Receipt(id), Echo(id), AnswerChunk("first "), Idle(Refusal),
AnswerChunk("second"), Idle(EndTurn),
]);
let result = child.prompt(session, "next", cancel()).await.unwrap();
assert_eq!(result.text, "first second");For agents:
Validate the following issue, address if needed:
<comment>Keep Idle provisional after answer progress when Running was omitted, and verify that a stale refusal between answer chunks does not discard the full answer.</comment>
<file_context>
@@ -0,0 +339,14 @@
+ // An echo only establishes insertion. A repeated Idle carries no turn
+ // identifier, and even its stop reason may be from an earlier turn.
+ if repeated_idle
+ && !self.current.answer_observed
+ && self.current.turn.foreground == Foreground::Waiting
+ {
+ if (self.matched || !self.current.echoes.is_empty())
+ && self.current.unverified_idle.is_none()
+ {
+ self.current.unverified_idle = Some(Instant::now());
+ return self.matched || newly_unverified;
+ }
+ return newly_unverified;
+ }
</file_context>
Summary
Replace Kit's legacy ACP injection RPCs with the draft v2 prompt-delivery modes proposed in agentclientprotocol/agent-client-protocol#1261. The runtime, gateway, TUI, and Desktop use
session/prompt.deliveryfor steering and queueing,messageIdto reconcile insertion, and$/cancel_requestto withdraw pending input.Impact
ACP callers must negotiate
capabilities.session.prompt.deliverybefore sending an explicit mode.session/cancelstops foreground work but preserves pending explicit steers and queued prompts. Ordinary prompts remain supported, and Kit's separate subagent steering mechanism is unchanged.Technical details
Gateway compatibility
The gateway forwards withdrawal using the resident child's request ID and retries under bounded write backpressure. The updated SDK preserves bounded HTTP/SSE and graceful HTTP
DELETEdrain. Kit uses one published SDK/schema dependency graph.