Repository navigation
fix(subagents): settle a dashboard tab's returned results at its turn's release - #28576
cruisercohen wants to merge 1 commit into
Conversation
…'s release A dashboard tab whose turn called spawn_sub_agents acknowledged each returned child on the mark, so a turn the user stopped before it landed lost the result. Every parent now holds the mark pending under the spawning attempt and settles it at that attempt's release, as cron and channel parents already do (#17684): a landed turn confirms it, any other end delivers it. Fixes #23495
3bb4601 to
24eb72b
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. This is a net subtraction: it deletes the one exception that let a dashboard tab's returned results get acknowledged before its turn could still be stopped. What this change shipsInventory (5 items) — 5 justifiedIntent: a dashboard user who stops a turn after its sub-agents returned still gets those results. This is a FIX (#23495).
[FIRST-PRINCIPLES-REVIEWED] 24eb72b Description read[DESCRIPTION-READ] 4d17c92dc422c586a58933152ea99b0f42575ca043fb8e0357e8b1f86b3fd7c4 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: removing the dashboard-born exception sends dashboard tabs down the existing release-settled path, and the dashboard runner already reports when a turn lands ( Notes
[DESIGN-REVIEWED] 24eb72b Description read[DESCRIPTION-READ] 25d0377a0fd91ba879b936c88da53423a0ca0d720b94ea67d89c6cfbb3dac973 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 |
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: |
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: |
iamwhatever
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES at 24eb72b, for one untracked follow-up only.
The fix itself looks sound. Removing settles_at_release puts dashboard tabs on the same release-settled path cron and channel tabs already use; the dashboard runner already notes landing on end_turn (turn_stats.py#L1057), and a landed release now does the slot settle that the mark used to do (subagent_injection.py#L254). No reader of the removed predicate is left in src/ or test/.
What needs to change
The Not a goal section leaves rfc-brokered-delivery-confirmation.md 'for its author to update', but nothing tracks it. That draft RFC still describes the dashboard-born exception as current behaviour (L67, L92), so whoever implements #18743 would design against a rule this PR deletes. Please either correct those two passages here, or open an issue for it and link it in the PR description.
AI findings judged non-blocking
- Design (Opus 5.5), a dashboard turn without a ledger token at mark time now plays a duplicate completion turn: that is the stated duplicate-over-loss trade-off, and no flag is set without a token. run_control.py#L542
The red 'Publish readiness signal' job on this head failed on a GitHub API rate limit, not on code; PR Readiness was published green afterwards.
— crew-pr-reviewer (r143)
|
[operator: bolichen97] Continuing this in #32387; thanks for the start. |
A dashboard tab whose turn called spawn_sub_agents acknowledged each returned child on the mark, so a turn the user stopped before it landed lost the result. Every parent now holds the mark pending under the spawning attempt and settles it at that attempt's release, as cron and channel parents already do (#27508): a landed turn confirms it, any other end delivers it. The specs and the brokered-delivery RFC no longer describe the removed dashboard-born exception. Builds on #28576 by @cruisercohen. Closes #23495 Co-authored-by: Matt Cohen <mattcohe@amazon.com>
…32387) A dashboard tab whose turn called spawn_sub_agents acknowledged each returned child on the mark, so a turn the user stopped before it landed lost the result. Every parent now holds the mark pending under the spawning attempt and settles it at that attempt's release, as cron and channel parents already do (#27508): a landed turn confirms it, any other end delivers it. The specs and the brokered-delivery RFC no longer describe the removed dashboard-born exception. Builds on #28576 by @cruisercohen. Closes #23495 Co-authored-by: Matt Cohen <mattcohe@amazon.com>
…32387) A dashboard tab whose turn called spawn_sub_agents acknowledged each returned child on the mark, so a turn the user stopped before it landed lost the result. Every parent now holds the mark pending under the spawning attempt and settles it at that attempt's release, as cron and channel parents already do (#27508): a landed turn confirms it, any other end delivers it. The specs and the brokered-delivery RFC no longer describe the removed dashboard-born exception. Builds on #28576 by @cruisercohen. Closes #23495 (cherry picked from commit 2a4fb38) Original author: Bolin Chen (#32387). docs/system-specs/modules/subagent.md hand-resolved: removed the dashboard-born-tab sentence this PR makes untrue and kept the rest of release's paragraph; main's #25261 sentence belongs to a main change not on release.
Problem / Motivation
Goal: a dashboard tab whose own turn called
spawn_sub_agentsnever loses a returned child result when that turn ends without landing (the user presses Stop, the backend fails, the turn is cancelled).On main the tab route acknowledged a dashboard-born parent's child on the mark itself (
_delivered_inline), and the mark is sent once the reply frame reaches kiro-cli's pipe, which is before the turn finishes. If the turn was then stopped, the completion that would have delivered the result was already acknowledged and tombstoned. #27508 (from #17684) fixed this window for cron and channel parents with a pending mark settled at the turn's release, and listed the dashboard tab's own window as not a goal.Why it matters
Every dashboard user who stops a turn that used
spawn_sub_agentsafter its children returned can lose those results with no trace: no completion turn follows and the result is in no finished answer. Dashboard tabs are the most common parent.Not a goal
rfc-brokered-delivery-confirmation.mddescribes the dashboard-born exception as current behaviour; it is left for its author to update.What changed (motivation → approach → change)
Symptom → cause.
parent_turns.settles_at_releasereturned False fordashboard:keys, so_flag_collected_inlineflagged the child with no attempt,api_spawn_mark_collectedsettled queued completions on the slot at mark time, and_route_subagent_to_tabskipped on the bare mark.Change. The dashboard-born exception is removed; every parent takes the #27508 path. That rule already runs on dashboard-runner tabs (cron and channel tabs), and the runner already notes landing on
end_turn(turn_stats.py), so no runner change is needed.parent_turns.py:settles_at_releaseremoved.run_control.py:_flag_collected_inlinealways holds the mark pending under the attempt holding the parent's permit (only when that attempt spawned and read the child);api_spawn_mark_collectedno longer settles the slot at mark time. The landed release does that through_settle_inline->_settle_collected_on_slot. Response shape (ok/no_slot) unchanged.subagent_injection.py: the tab route asks_inline_verdictfor every parent, so a pending mark parks the completion until the turn releases: landed confirms it (no second turn), anything else delivers it.subagent.md,mcp.md,slack-gateway.md) updated.Backwards compatibility
Compatible: no API or wire change;
mark-collectedtakes and answers the same fields. On dashboard tabs a returned result whose turn did not end onend_turnnow gets its completion turn (one duplicate at worst, never a loss), where before it was dropped. A landed turn still plays no duplicate.Reader: src/kiro_crew/parent_turns.py:settles_at_release -- chat -- removed; every caller (run_control, subagent_injection, the gateway and messaging re-exports) is changed here, and git grep finds no other reader in src/ or test/
Reader: src/kiro_crew/dashboard/messaging_api/run_control.py:api_spawn_mark_collected -- chat -- a dashboard tab's queued completion is no longer settled at mark time; the landed release settles it (test_collecting_a_member_whose_announce_already_queued_settles_it)
Reader: src/kiro_crew/slack/gateway_runtime/subagent_injection.py:_route_subagent_to_tab -- chat -- skips only a confirmed mark, parks a pending one (test_a_tab_parents_landed_turn_plays_no_duplicate_and_settles_at_its_release[dashboard-tab])
Tests
Proof: PROVEN test/test_spawn_sub_agents_settle_at_release.py::test_a_dashboard_born_tab_whose_turn_is_stopped_still_gets_its_result, test/test_spawn_sub_agents_settle_at_release.py::test_a_tab_parents_landed_turn_plays_no_duplicate_and_settles_at_its_release[dashboard-tab], test/test_subagent_queued_visibility.py::test_collecting_a_member_whose_announce_already_queued_settles_it, test/test_subagent_queued_visibility.py::test_collected_ids_are_bounded_and_known (head 24eb72b)
test_a_dashboard_born_tab_whose_turn_is_stopped_still_gets_its_result(new) and thedashboard-tabcase oftest_a_tab_parents_landed_turn_plays_no_duplicate_and_settles_at_its_release: realSessionManager, real mark flagging and tab route; a stopped turn delivers the result once, a landed one plays no duplicate.test_gateway_subagent_injection.pymarks the child returned in a landed turn (_inline_state = "confirmed"); threetest_subagent_queued_visibility.pytests andTestApiSpawnMarkCollected::test_records_ids_bounded_and_skips_non_stringsassert the mark settles nothing and the landed-release settle does.parent_turnsor the subagent routes, plus tests reading the spec docs: 2,150+ passed. black, isort, flake8, mypy on changed files: clean.Manual verification
N/A — the stop-after-reply window is driven end to end through the real
SessionManager, mark endpoint and tab route in the new test.Related Issues
Fixes #23495
Sibling sweep
Swept: git grep -n "_delivered_inline(|_collected_inline" -- src/
Sibling: src/kiro_crew/slack/gateway_runtime/subagent_injection.py:102 -- not affected -- only caller left is _inline_verdict, which every route asks
Sibling: src/kiro_crew/dashboard/messaging_api/run_control.py:513 -- changed here
Pattern harvest
Not generalizable: a single predicate exempted one parent shape from the release rule; removing it closes the class.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.
🤖 AI-assisted PR 🤖