Skip to content

fix: settle a dashboard tab's returned results at its turn's release - #32387

Merged
iamwhatever merged 1 commit into
mainfrom
fix/23495-tab-settle-at-release
Nov 7, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/23495-tab-settle-at-release

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: a dashboard tab whose own turn called spawn_sub_agents never loses a returned child result when that turn ends without landing (the user presses Stop, the backend fails, the turn is cancelled).

A dashboard tab acknowledged a returned child as soon as the reply carrying it reached kiro-cli's pipe, before the tab's own turn finished. If the user then pressed Stop, the completion that would have delivered the result was already acknowledged and tombstoned: no completion turn followed, and the result was in no finished answer. #27508 closed this window for cron and channel parents and left the dashboard tab's own window open.

Builds on #28576 by @cruisercohen.

Why it matters

Every dashboard user who stops a turn that used spawn_sub_agents after its children returned can lose those results with no trace. Dashboard tabs are the most common parent.

Not a goal

What changed (motivation → approach → change)

Symptom → cause. parent_turns.settles_at_release answered False for dashboard: keys. So the mark flagged a dashboard tab's child with no attempt, api_spawn_mark_collected settled the tab's queued completion at mark time, and _route_subagent_to_tab skipped the completion on the bare mark.

Change. The dashboard-born exception is gone; every parent takes the #27508 rule. That rule already runs on the dashboard runner (it drives cron and channel tabs too), and the runner already notes landing on end_turn (turn_stats.py), so the runner itself is unchanged.

Where Now
parent_turns.py settles_at_release removed
run_control.py the mark is always held pending under the attempt that spawned and read the child; nothing is settled on the slot at mark time. Response shape (ok / no_slot) unchanged
subagent_injection.py the tab route asks _inline_verdict for every parent: a pending mark parks the completion until the turn releases; landed confirms it (no second turn), any other end delivers it
docs and comments subagent.md, mcp.md, slack-gateway.md, the draft RFC rfc-brokered-delivery-confirmation.md, and the comments in run_record.py, subagent_read_collected.py and turn_stats.py no longer describe the removed exception

Backwards compatibility

Compatible: no API or wire change; mark-collected takes and answers the same fields. On a dashboard tab a returned result whose turn did not end on end_turn now 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, and 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 and 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_spawn_sub_agents_settle_at_release.py::test_a_queued_tab_completion_is_settled_only_by_its_turns_landed_release[dashboard-tab-landed], test/test_subagent_queued_visibility.py::test_collecting_a_member_whose_announce_already_queued_settles_it (head 371b9c1)

  • test_a_dashboard_born_tab_whose_turn_is_stopped_still_gets_its_result (new) and the dashboard-tab cases of test_a_tab_parents_landed_turn_plays_no_duplicate_and_settles_at_its_release and test_a_queued_tab_completion_is_settled_only_by_its_turns_landed_release: a real SessionManager, the real mark and the real tab route; a stopped turn delivers the result once, a landed one plays no duplicate, and a completion already queued on the tab is removed only by a landed release.
  • Tests that pinned mark-time acknowledgement assert the release rule instead: test_gateway_subagent_injection.py marks the child returned in a landed turn; test_subagent_queued_visibility.py and TestApiSpawnMarkCollected::test_records_ids_bounded_and_skips_non_strings assert the mark holds a pending mark and settles nothing, and test_collected_ids_are_bounded_and_known marks under a live turn, then settles what the mark flagged.
  • Determinism: the 21 new and changed test ids pass 20 times at -n0, 10 times at -n 4 --dist loadgroup --max-worker-restart=2 beside test_spawn_sub_agents_duplicate_never_loss.py and test_subagent_injection_live_turn.py, and once in a shuffled order (seed 987).
  • Locally: the 29 test files that touch inline marks, parent_turns, the tab route, the landing note or the messaging and gateway facades pass (1805 tests, -n 4).

Manual verification

N/A — unit coverage sufficient: the new test drives the real session manager, mark endpoint and tab route through a stopped and a landed turn.

Related Issues

Closes #23495

Sibling sweep

Swept: git grep -nE "settles_at_release|dashboard-born" -- src/ test/ docs/
Sibling: src/kiro_crew/dashboard/messaging_api/run_control.py -- changed here
Sibling: src/kiro_crew/slack/gateway_runtime/subagent_injection.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_turn/recipient.py -- not affected -- its dashboard-born mentions are about mirror recipients, not inline marks

Pattern harvest

Not generalizable: one predicate exempted a single parent kind from a rule every other parent already followed; removing the exemption is the fix, and no other predicate of that shape gates the inline-collect path.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 7, 2026 14:34
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision cf1455e68aed9f5e771f4445e705dfafad4fbc43 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of cf1455e68aed9f5e771f4445e705dfafad4fbc43 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. This removes a one-parent exemption, so dashboard tabs now follow the same release rule cron and channel parents already use, and nothing outside the patch still reads settles_at_release.

Notes

  • Step 3 of docs/request-for-change/rfc-brokered-delivery-confirmation.md:67 still describes the dashboard-born exception as current. Only the note added above it marks it as gone, so a reader who jumps straight to step 3 gets the old rule.

[DESIGN-REVIEWED] cf1455e

Description read

[DESCRIPTION-READ] 18293e2e16bd4d0b687d75d5cdb1c25cdbd5f85746978d57351c9fa88da57621

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of cf1455e68aed9f5e771f4445e705dfafad4fbc43 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

This change deletes a special case. The dashboard-born exemption was the cause of the bug, and removing it is the whole fix.

What this change ships

Inventory (7 items) — 6 justified

Intent: a dashboard user who stops a turn that ran spawn_sub_agents should still get the results its children already returned. FIX.

  1. A dashboard tab turn that is stopped, fails or is cancelled after its children returned now gets their results in a completion turn instead of losing them — justified
  2. On a dashboard tab, a returned result is acknowledged when the turn lands, not when the reply reaches the pipe — justified
  3. A completion already queued on a dashboard tab is removed only when the turn lands, no longer at mark time — justified
  4. The settles_at_release predicate and its re-exports from the gateway and messaging modules are removed — justified
  5. A mark made without a turn ledger now flags nothing, so the completion is delivered (before, a dashboard-born mark flagged without a token) — undeclared, harm-free
  6. The specs (subagent.md, mcp.md, slack-gateway.md) and the code comments no longer describe the exemption — justified
  7. The draft RFC rfc-brokered-delivery-confirmation.md drops the dashboard-born step — justified

[FIRST-PRINCIPLES-REVIEWED] cf1455e

Description read

[DESCRIPTION-READ] c39685d4278f9700a224d49940cfbd3dac66de493cac0384c89648039e45b059

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed cf1455e68aed9f5e771f4445e705dfafad4fbc43 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] cf1455e

Verdict parsed from the review's SHA-scoped output markers for commit cf1455e68aed9f5e771f4445e705dfafad4fbc43.

False positive or not applicable? A repository writer can comment:
/ai-review override fable cf1455e68aed9f5e771f4445e705dfafad4fbc43 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of cf1455e68aed9f5e771f4445e705dfafad4fbc43 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] cf1455e

False positive or not applicable? A repository writer can comment:
/ai-review override gpt cf1455e68aed9f5e771f4445e705dfafad4fbc43 false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 14:44
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 7, 2026
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>
@bolichen97
bolichen97 force-pushed the fix/23495-tab-settle-at-release branch from 371b9c1 to cf1455e Compare November 7, 2026 18:21
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/subagent.md (same file) plus 91 neighbouring or importing files since this head went green (d27a5fd -> 928d145); CI re-running. The patch is unchanged by the rebase; the cancelled E2E (stub ACP backend, offline) run at the old head hit its 25-minute job bound with every finished test passing (tracked in #30737).

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for the on-call. Review lanes pass on cf1455e, no conflict, no open change request.

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at cf1455e68aed9f5e771f4445e705dfafad4fbc43.

Removing settles_at_release puts dashboard tabs on the same release rule cron and channel parents already use. The mark now only holds a pending mark under the spawning attempt (run_control.py#L457, #L561). The tab route parks or delivers through _inline_verdict (subagent_injection.py#L687), and a landed release settles the queued slot entry. Every failure mode falls back to delivering the result, so a stopped turn can no longer lose it. No remaining reader of the removed predicate exists, and all checks are green.

AI findings judged non-blocking

  • Design: RFC step 3 still reads as current. That list describes #17684 at a pinned commit, and the PR adds a note directly under it saying the exception is gone (code). Doc wording in a draft RFC.

— crew-pr-reviewer (r149)

@iamwhatever
iamwhatever merged commit 2a4fb38 into main Nov 7, 2026
97 of 98 checks passed
@iamwhatever
iamwhatever deleted the fix/23495-tab-settle-at-release branch November 7, 2026 19:41
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
buluoray added a commit that referenced this pull request Nov 8, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A tab parent acknowledges a returned spawn_sub_agents result while its own turn can still be stopped

3 participants