Repository navigation
fix(members): confirm a member session inside the client start that made it - #21452
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS With the gate now inside Not justified as shipped
What this change shipsInventory (4 items) — 3 justifiedIntent: make sure a member session that respawns just before a prompt is checked against its saved spec before anything is sent. FIX.
[FIRST-PRINCIPLES-REVIEWED] 5b12b20 Description read[DESCRIPTION-READ] bf48c834209398cb040e83ca9e1ae27d24620372c63b77df0a195293063dc41b That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check one thing before merge: a deterministic spec refusal now costs a second spawn and is recorded as startup outcome Suggestions
[DESIGN-REVIEWED] 5b12b20 Description read[DESCRIPTION-READ] f7750993ed8c829710623635eb3093752fa0e00a6a95ad1cbf835c50e50619db That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsAdvisory only: one finding, nothing blocks the merge. FINDING — src/kiro_crew/acp/client_start.py:1105 — A member whose saved spec can't be confirmed fails the same way on every attempt. Its refusal from [OPUS-REVIEWED] 5b12b20 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
…ade it Follows up #16847. stream_events runs ensure_ready again after the provider's send gate, and a child that died in between is respawned there, so the prompt went into a session nobody had confirmed. The confirmation now runs in _initialize_session, on the else arm of its existing kiro test, so every adapter session a start creates is confirmed before any caller can send, and the kiro path gains no call (harness-parity H13). A refusal goes through ensure_ready's error handler, which ends the child; a cancel is torn down in place, so the next ensure_ready never takes the warm return into an unconfirmed session. Co-authored-by: Claude <noreply@anthropic.com>
cfdfc7e to
5b12b20
Compare
|
Disposition for the First Principles CONCERNS on 5b12b20 (advisory, no push). Item 3 (provider calls kept): kept on purpose. Here is a session the provider call refuses and the start-time call does not.
So the two checks cover different windows:
Deleting the provider calls would reopen the second row. Closing that row inside the start would mean tearing down on a cancel at every await after On the |
Problem / Motivation
Goal: A member session that is respawned right before a prompt is confirmed against its saved spec before that prompt is sent.
Follows up #16847. That PR confirms a member's saved spec in the provider (
AcpProvider.stream,stream_command,compact) afterensure_ready. ButAcpClient.stream_events(client_turn.py) and the command paths inclient_turn_control.pycallensure_readyagain before sending. If the child died between the provider's gate and that call,ensure_readyrespawns it and creates a new session. The prompt then goes into that new session, which no one confirmed. A GPT review lane raised this on #16847 and it was upheld.Why it matters
A member whose consumed spec does not match its saved intent (withheld array, unreadable intent, different spec) can get one prompt through after a respawn. That is the exact case the #16847 gate exists to refuse.
Not a goal
AcpRuntime/AcpSessionHandle), which already confirms at session creation inapply_session_permission_routing.What changed (motivation → approach → change)
Symptom: a send after a respawn reaches an unconfirmed member session. Root cause: the confirmation ran in the provider, one layer above the call that can create a new session. Change:
_initialize_sessioninsrc/kiro_crew/acp/client_start.pynow callsconfirm_member_projectionon theelsearm of its existingif self._is_kiro:test (step 4, after the session exists and the array is consumed). Every adapter session a start creates is confirmed beforeensure_readyreturns, so every caller is covered, including ones added later. The kiro path takes the sameifit always did and gains no call, conditional or failure point (harness-parity H13).Every send-after-respawn path was checked. All AcpClient sends go through
ensure_readyfirst:send_message,send_message_streamandstream_eventsinclient_turn.py, andcommand_result,send_commandandstream_commandinclient_turn_control.py._session_idis set only inside_initialize_session, which onlyensure_ready's cold path calls. So no path reaches a new session without passing the new check.Fail closed: a refusal is an
AcpError, soensure_ready's existing handler ends the child and resets state; it retries once on a fresh process (which re-reads the saved spec and is refused again, or confirmed if the spec was mid-write) and then raises. A cancel skips that handler, so the new arm tears the session down itself before re-raising, the same shape_classify_failed_startuses. Either way the nextensure_readynever takes the warm return into an unconfirmed session.confirm_member_projectionis idempotent per session id, so the provider's existing call afterensure_readycosts nothing extra. Its docstring is updated to the new call site.Backwards compatibility
Compatible: this only refuses member sessions whose spec already fails the #16847 check, now one step earlier. Non-member sessions, kiro-cli sessions and confirmed member sessions behave as before.
Removes nothing: the diff adds a check and a teardown on cancel; no key, path, function or record is removed.
Tests
test/test_member_projection_send_paths.pydrives the realensure_readyand_initialize_sessionwith a fake transport (spawn, request/response, the confirmation and the teardown stubbed):test_a_respawn_inside_the_client_confirms_before_it_returns: a DeepSeek member start confirms beforeensure_readyreturns.test_a_refused_respawn_is_torn_down_not_left_warm: a refusal ends the child on both attempts, clears_session_id, and the nextensure_readyconfirms again rather than taking the warm return.test_a_cancel_during_confirmation_is_torn_down_not_left_warm: a cancel mid-confirm tears down and clears_session_id.test_a_kiro_start_gains_no_confirmation_call: a kiro member start never calls the confirmation (H13).test/test_session_capabilities.py::test_claude_saved_projection_requires_consumed_matching_specnow expects the refusal from_initialize_sessionitself.Mutation check (each mutant run against the file): removing the confirm call fails 3 tests; making it unconditional fails the kiro test; dropping the cancel teardown fails the cancel test.
Manual verification
N/A — unit coverage sufficient: the change is one call on an existing branch of
_initialize_session, and the tests drive the real start path with only the transport stubbed.Related Issues
Refs #16847, #12451
Pattern harvest
Rule candidate: review-prompt
Pattern: a gate placed above a call that can re-create the state it gated (respawn, reconnect, re-init) does not cover sends made after that call; put the gate where the state is created.
Sensitive change review
stream_eventssent unconfirmed; now every new adapter session is confirmed or torn down before any send.ensure_readycaller and every_session_idwrite; mutation-checked the new tests.ensure_ready,_initialize_sessionor member confirmation passes locally, except 17 intest_acp_spawn_offload.pythat fail identically on main locally.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.