Repository navigation
fix(chat): never hold the session's own messages behind sub-agents - #21369
Conversation
|
Local pre-push review on 2577d69 (content-identical rebase of ae4f6287f0): GPT lane and Opus lane both no findings; the Opus lane's rejected candidate (internal-secret callers skipping the hold) was tightened anyway, and a focused verifier confirmed it. One Low left on purpose: an internal-secret POST with steer=true that its turn ends before consuming is requeued with the composer mark (steer_into_running_turn's user_origin covers internal callers). No shipped caller sends steer that way, and narrowing user_origin would change unrelated provenance rules, so it stays out of this PR. |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the rule being reversed is named as the defect, at the maintainer's request, and the other holds (editor, discard, crew pause) still apply in the drain. Notes
[DESIGN-REVIEWED] cee497a Description read[DESCRIPTION-READ] d5b36a5a76365698730b69f734c8b060f33bf384ecc28cc609127f81dfbde12f 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The one open question is whether a reversed default needed a recorded decision. The description argues it restores the setting's documented meaning, so this is a note, not a blocker. Notes
What this change shipsInventory (9 items) — 8 justifiedIntent: let a person keep talking to their own session while its background sub-agents run. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] cee497a Description read[DESCRIPTION-READ] d309a5691139d62b18ad23b33e6c484d13a06685cc68f4e26339bc41669ccfdb That sha256 names the PR description this verdict read. 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: |
2577d69 to
f358e90
Compare
|
|
|
/ai-review override first-principles f358e90: agent: maintainer decision (kseam requested this change): the session's own composer sends are never held behind background sub-agents; Queue means after the current turn, not after the wave; peer, channel, app, MCP and cron sends keep the hold. |
|
|
Human judgment recorded@kyleseaman marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
|
f358e90 to
2ec578a
Compare
|
/ai-review override first-principles 2ec578a: agent: maintainer decision (kseam requested this change): the session's own composer sends are never held behind background sub-agents; Queue means after the current turn, not after the wave; peer, channel, app, MCP and cron sends keep the hold. |
Human judgment recorded@kyleseaman marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
|
2ec578a to
4dbc66f
Compare
|
/ai-review override first-principles 4dbc66f: agent: maintainer decision (kseam requested this change): the session's own composer sends are never held behind background sub-agents; Queue means after the current turn, not after the wave; peer, channel, app, MCP and cron sends keep the hold. |
2b9c17e to
86c4230
Compare
7fa87a7 to
7130f1b
Compare
A message typed into a session's own composer while background sub-agents ran was parked until every child finished, unless the busy-send mode was Steer. The person could not talk to their own session. The idle-slot hold in api_chat now applies only to an app's send. A composer send queued behind a running turn carries meta.composer_send (formerly steer_intent, set only for a steer that missed its turn), so the sub-agent hold releases it when that turn ends. A card the turn-end read hands the floor runs under the hold when it carries the mark. Peer, channel and app messages still wait for the wave; sub-agent completions keep draining in arrival order alongside the person's messages.
… them GPT and Opus (upheld, two rounds): the composer mark passes the sub-agent hold only, but main's edit-hold drain used that same selector, so a send queued while a card's editor was open ran ahead of the edited card; and a composer send that an editor queued on an idle slot with live children got no mark, so it stayed parked behind the children after the editor closed. While an editor or a deferred discard holds the queue, the drain takes system injections only and a named card passes only through Run now. Every composer send that reaches the queue carries the mark, including a steer the person takes back to the queue (steer_retract.take_back). Tests cover each case. The composer-send mirror wait uses the testing default timeout (Flake Pattern Ratchet K19).
7130f1b to
cee497a
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approving at cee497a. All checks pass and there are no change requests. The author already holds auto-merge, so I am not setting it.
What I checked:
_from_composerneeds the positiveis_dashboard_usermark fromtoken_auth, and excludes agent-origin and cron sends. An internal-secret caller, an app, a peer'ssession_sendand a channel message still wait for the sub-agent wave.COMPOSER_SEND_METAreplacesSTEER_INTENT_METAeverywhere it was read or written. The drain pops it, andsanitize_restored_queuestill strips it on restore.- The mark changes ordering only. The deferred-discard hold and the open-editor hold both narrow the dequeue to system entries (
system_only=teardown_held or edit_held). Arequired_queue_idcard runs under the sub-agent hold only when it carries the mark. - A steer taken back to the queue keeps the mark (
steer_retract.take_back). - The spec text in
session.mdandlearn-cron-dashboard.mdmatches the code. - No new regex, and no new refusal.
…21369) * fix(chat): never hold the session's own messages behind sub-agents A message typed into a session's own composer while background sub-agents ran was parked until every child finished, unless the busy-send mode was Steer. The person could not talk to their own session. The idle-slot hold in api_chat now applies only to an app's send. A composer send queued behind a running turn carries meta.composer_send (formerly steer_intent, set only for a steer that missed its turn), so the sub-agent hold releases it when that turn ends. A card the turn-end read hands the floor runs under the hold when it carries the mark. Peer, channel and app messages still wait for the wave; sub-agent completions keep draining in arrival order alongside the person's messages. * fix(chat): keep a composer send behind other holds and marked through them GPT and Opus (upheld, two rounds): the composer mark passes the sub-agent hold only, but main's edit-hold drain used that same selector, so a send queued while a card's editor was open ran ahead of the edited card; and a composer send that an editor queued on an idle slot with live children got no mark, so it stayed parked behind the children after the editor closed. While an editor or a deferred discard holds the queue, the drain takes system injections only and a named card passes only through Run now. Every composer send that reaches the queue carries the mark, including a steer the person takes back to the queue (steer_retract.take_back). Tests cover each case. The composer-send mirror wait uses the testing default timeout (Flake Pattern Ratchet K19). --------- Co-authored-by: Kyle Seaman <kseam@dev-dsk-kseam-1b-55230d27.us-east-1.amazon.com> (cherry picked from commit fab339a) Backport note: #30549 (the queue edit hold) is not on release; lane 4 carries it. queue_drain.py drops the two edit_held terms (the hold- release check and the system_only narrowing) and their comment lines, and test/test_queue_edit_hold.py (added by #30549) stays absent with its two new tests. chat_send.py keeps _from_composer and leaves out feat #29928's crew_pause/_crew_paused check. When this is assembled after #30549, restore the two edit_held terms and the two test_queue_edit_hold.py tests from the main commit.
…bly) #21369's lane backport dropped the drain's two edit_held terms because #30549 (the queue edit hold) was in another lane, and its note asked for them back once both are assembled. Without them a composer-marked send passed the open editor's hold and ran ahead of the card being edited (test_a_composer_send_queues_behind_a_held_entry failed). Restore main's two terms in _start_next_queued_turn: a named card the editor holds stays queued, and the held dequeue is system-only while an editor is open. The two test_queue_edit_hold.py tests #21369 added on main come with them.
…rt assembly) #21369's new test_a_drop_during_discarded_delivery_settle_cannot_requeue stubs the sub-agent manager with main's two slot-list readers. Release's slot serializer also reads published_queued_labels (the queued wait label), so whenever the hard Stop's slots push found its coalescing window open the test raised AttributeError instead of asserting. Add that reader to the stub, returning no labels as the depths reader returns no depths. Test only.
Problem / Motivation
Goal: A person can keep talking to their own session while its background sub-agents run, instead of their messages waiting until every sub-agent finishes.
A message typed into a session's composer while sub-agents were still running was parked in the queue until the last child finished, unless the composer's busy-send mode was Steer. With the default Queue choice, or with a Queue card sent while the main turn was running, the session looked impossible to talk to: an hourglass card sat under the transcript for the whole wave, and the only way out was spotting the card's Run-now button.
Why it matters
Sub-agent waves routinely run for many minutes. During that time the main agent is idle or only digesting results, yet the person who owns the session cannot ask it anything. The Queue setting's own description says "Queue waits for the turn to finish", and background sub-agents are not that turn, so the behaviour contradicted the setting it was driven by.
Not a goal
session_send, a messaging-channel message, an app's send, and a loopback internal-secret send (an MCP tool or a cron script'ssend_to_session) all still wait for the wave.What changed (motivation → approach → change)
Your own messages no longer wait for background sub-agents. Typed while only sub-agents are running, a message starts a turn at once, whatever the busy-send mode. Queued while the main agent is mid-turn, it runs when that turn ends.
autopicks it)The hold parked every user message and let only system injections through; a steer that missed its turn was the one exception, marked
meta.steer_intent. That mark is nowmeta.composer_send(COMPOSER_SEND_METAinchat_utils_injected_rows.py) andapi_chat(chat_api/chat_send.py) stamps it on every composer send that reaches the queue, including one queued behind a message parked while its child was live, soreleases_past_subagent_holdlets it drain at the turn's end. Two holds main added since keep their force: while an open queue editor holds the queue (queue_edit_hold), the drain (_start_next_queued_turn) takes system injections only and a named card passes only through Run now, so a marked composer send waits behind the edited card; a deferred conversation discard (teardown_hold_active) already drains system injections only. A send counts as the composer's only whentoken_authgave it the positiveis_dashboard_usermark (a validated dashboard token with no app claim), so an MCP tool, a cron script or any future caller nobody marked still waits; on an idle slot the hold now applies only to those other sends._start_next_queued_turn(chat_runner.py) also runs a card the turn-end read hands the floor (required_queue_id) when the hold releases it, where it used to refuse every card under the hold.A parent turn the person starts can now run while children still edit files, which Steer already allowed on the base: the person chose to talk to the session, and holding them is the defect. Continue still refuses while children run, because it replays the interrupted turn's own unfinished work as runner-authored input rather than carrying the person's new words. Sub-agent results still reach the main conversation the same way: one that lands during your turn waits for it, then runs as its own turn, and your messages and results drain one turn each in arrival order. The
sessionandlearn-cron-dashboardsystem specs describe the new rule, andchat_api/continue_turn.py's comment names which sendsapi_chatstill holds.Backwards compatibility
Breaking: the queue-entry meta key
steer_intentis renamedcomposer_send. A steer queued on an older gateway that survives the restart as a restored entry waits for its wave once instead of running at its turn's end, and its drained row keeps the stale key, which no reader consults. Writer sweep on origin/main @ 9fba246:chat_delivery.queue_for_next_turnandchat_turn/steer_queue._requeue_unconsumed_steerswere the only writers; both now writecomposer_send; the slot ladder comment (state_parts/slot_ladder.py) names the new key.Reader: src/kiro_crew/dashboard/chat_utils_injected_rows.py:releases_past_subagent_hold -- chat -- reads
COMPOSER_SEND_META; test_queue_during_subagents.py::TestDequeueSteerIntentReader: src/kiro_crew/dashboard/chat_runner.py:_start_next_queued_turn -- chat -- pops
COMPOSER_SEND_METAbefore writing the row; test_queue_during_subagents.py::TestSteerFallbackSurvivesTheHold::test_unconsumed_steer_drains_while_children_runReader: src/kiro_crew/dashboard/slot_queue_repository.py:sanitize_restored_queue -- chat -- strips
COMPOSER_SEND_METAfrom a restored entry (main's #22224 strip, renamed); test_queue_drain_revalidation.py::test_a_restored_entry_loses_its_composer_send_markReader: src/kiro_crew/dashboard/chat_utils.py facade -- chat -- re-exports
COMPOSER_SEND_META;STEER_INTENT_METAleavestest/campaign_facade_inventories/kiro_crew.dashboard.chat_utils.jsonon purpose; test_campaign_facades_base_public_names.pyTests
test_queue_during_subagents.py: a Queue send made mid-turn carries the mark and runs at the turn's end while a peer message stays parked; a turn-end card runs under the hold only when it is the person's own; a sub-agent result and a follow-up drain in arrival order both ways round while a sibling still runs; an idle composer send starts a turn while a child is live.test_chat_mode_security.py: an app's send is still held, and the gate queries the slot's parent key.test_queue_during_subagents.py::TestApiChatSubagentQueueGate::test_send_behind_parked_message_carries_composer_mark: a composer send queued behind a parked message carries the mark (so a hold the drained turn reinstates still releases it); a non-composer one does not.test_queue_during_subagents.py::TestApiChatSubagentQueueGate::test_non_composer_send_is_held_by_running_subagents: an internal-secret send, and a send carrying no mark at all, is held on an idle slot and queued without the mark on a busy one.test_queue_drain_preserve_attachments.py/test_queue_drain_preserve_send_id.py: the hold branch'ssendIdand attachment lists are proven through the branch a composer send still reaches (a stalled child with a parked message ahead).-n0and 10 times at-n 4 --dist loadgroup --max-worker-restart=2with two sibling files, all green; a shuffled run of the three queue files (seed 20875, 98 tests) passed.Manual verification
N/A — unit coverage sufficient: the change is the queue's hold and drain decisions, which the tests drive through
/api/chatand_start_next_queued_turndirectly; no UI changed.Related Issues
No tracking issue: opened directly at the maintainer's request.
Pattern harvest
Not generalizable: the hold encoded a product rule (Queue waits for the wave) that was itself the defect, not a reusable code shape.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)