Repository navigation
fix(acp): end a shared sub-agent turn whose tenancy claim cannot be recorded - #25605
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the change narrows one blanket What this change shipsInventory (4 items) — 4 justifiedIntent: a sharing sub-agent whose tenancy claim fails should die visibly at turn start, not run a turn where every internal-API call is refused. FIX.
[FIRST-PRINCIPLES-REVIEWED] 236a6d3 Description read[DESCRIPTION-READ] 14ae615b642e3c45cc639c198ae59293e39cda4c081d786c32381adc4f7cad7b That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change turns a silent, turn-long run of 403s into an immediate, logged failure that callers already handle, and a revert undoes it cleanly. Notes
[DESIGN-REVIEWED] 236a6d3 Description read[DESCRIPTION-READ] c9c91053bb54274a1e6099c4643792eaa8340a2d6559768e3953ba46773c9e67 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 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: |
|
HOLD at 236a6d3 for human review (policy: runtime tenancy / process lifecycle). The change makes a shared sub-agent turn end with I found no defect. The claim is taken before each turn's What clears it: a maintainer review of the tenancy behaviour change. — crew-pr-reviewer (r134) |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved on behalf of the watch holder (bolichen). Design and First Principles pass on this head (or skipped / author override), UX skipped or pass, no conflict, no open change request.
Problem / Motivation
Goal: a shared sub-agent turn whose tenancy claim cannot be recorded ends at once with a logged reason, instead of running a turn whose every internal-API call is refused.
AcpSessionProvider._claim_shared_turnswallows any exception fromclaim_runtime_tenancyat DEBUG and returnsNone. Since #15529 the tenancy entry is the ONLY record admitting a sharing sub-agent'sX-Session-Keyon a shared pid. The principal's lease keeps that pid's bound set non-empty, so a turn without its claim reads as positive evidence the session is not on the process, and every stub call for the rest of the turn is refused403 peer_session_unbound, explained by one debug line.Why it matters
The cost of the silent path moved from "undefended against a sweep" to "this sub-agent cannot call the internal API for a whole turn", while the log level stayed at DEBUG.
Not a goal
RuntimeTenancy.claimor the peer check.RuntimeTeardownCommittedarm, which already raisesAcpProcessDied.Intended? / Repro
Intended? No longer. The guard's docstring (
src/kiro_crew/acp/session_provider.py:231-238on main) justifies it by "the worst case of not claiming is the behaviour that shipped before this table existed", which #15529 made untrue. The issue names this as option 1 of two acceptable fixes.Repro: latent, as the issue says:
RuntimeTenancy.claimdoes guarded work and its one raise is re-raised above. Forcingclaim_runtime_tenancyto raise on main makes_claim_shared_turnreturnNoneand log only at DEBUG; the turn then proceeds unclaimed.What changed (motivation → approach → change)
Symptom: a silently unclaimed turn. Cause: a blanket
except Exceptionat DEBUG. Change: end the turn the way a committed teardown already does._claim_shared_turn: reading_owns_runtime/_runtime/_session_keystays inert onAttributeError(a provider built without__init__, as the translation unit tests do, has no runtime to claim). An exception fromclaim_runtime_tenancyitself now logs a WARNING with the traceback and raisesAcpProcessDied("shared-runtime tenancy claim failed: ..."), the same death callers already answer by getting another runtime. The docstring states the new rule.docs/system-specs/modules/runtime-ownership.md(Tenancies): one paragraph on the refusal.Backwards compatibility
Compatible for every turn whose claim lands, which is every reachable path today. A turn whose claim fails now dies at its start instead of 403-ing its stub calls.
Removes nothing.
Tests
test/test_runtime_ownership.py:test_a_claim_that_cannot_be_recorded_ends_the_turn:claim_runtime_tenancyraising makes_claim_shared_turnraiseAcpProcessDied, logs "could not be recorded" at WARNING, and leaves no claim behind.test_a_provider_without_a_runtime_stays_inert: a provider built withobject.__new__still answersNone.On main the first fails (it returns
None).Proof: not provable -- other: this host runs no local tests; CI runs the new tests
Manual verification
N/A: latent path, covered by the tests. Static gates: black, flake8,
scripts/docs_lint.py,scripts/check_comment_history.py.Related Issues
Fixes #15557
Sibling sweep
Swept: git grep -n "_claim_shared_turn" -- src
Sibling:
stream(session_provider.py:650) -- not affected (already letsAcpProcessDiedfrom the claim propagate)Sibling:
stream_command(:769) -- not affected (same)Sibling:
stream's stubreclaim()guard -- not affected (a failed push keeps the session fail-closed for a turn, as its comment states)Pattern harvest
Not generalizable: one guard.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.