Repository navigation
Conversation
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the idle-send gate's Suggestions
[DESIGN-REVIEWED] 72aba27 |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- src/kiro_crew/dashboard/chat_orchestrator.py:417 -- [GPT-REVIEWED] 72aba27 |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the author's self-reported mutation controls: the new hold tests must be red on base — they are the two new hold causes' only checkable provenance. What this change shipsInventory (8 items) — 8 justifiedIntent: FIX — stop queued prompts being burned when a drain path never consults why the queue was held; every drain now reads one published flag. (Verified on base:
Items 2–7 are the same root cause's sibling instances and release machinery, all declared in the description — the general fix, not riders. Counts checked: [FIRST-PRINCIPLES-REVIEWED] 72aba27 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. The sole candidate (chat_runner.py [OPUS-REVIEWED] 72aba27 |
83a3449 to
ddc92e6
Compare
ddc92e6 to
8e67345
Compare
8e67345 to
869d1d6
Compare
d65eb82 to
cf7dbb2
Compare
cf7dbb2 to
9fc4357
Compare
9fc4357 to
12fc6ce
Compare
|
🤖 Kiro Crew [operator: dwu96#8c08bee0]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author. Assessment: No review lane blocks this PR — Design and First Principles are advisory CONCERNS, and GPT 5.6 and Opus 4.8 both report no blocking findings. The binding blocker is the merge conflict against current main, which needs a rebase. The only failing test, If you'd prefer I don't touch this PR, add the |
The orchestrator and the runner each decided separately whether a slot's queue still held work, so the two could disagree about when a drain was finished.
bolichen97
left a comment
There was a problem hiding this comment.
Requesting changes: the new idle-send gate can leave a chat queuing every send forever after a project change
If a chat's project changes while no session is registered under its key, every later send is answered 200 {"queued": true} and never runs.
How it happens (at f146acd):
api_chat_slot_projectsetsslot._pending_reset_history_key = session_keyon every project change, whether or not a session exists (src/kiro_crew/dashboard/chat_handlers.py:10008).SessionLifecycle.resetends withreturn session is not None(src/kiro_crew/session_lifecycle.py:978). For a key with no session it returns False on every call._consume_pending_resetthen leaves the flag set and starts the 5 s retry (chat_runner.py:5448-5460)._eager_spawndoes nothing while the flag is set (chat_runner.py:5930-5939).- The new gate (
chat_handlers.py:1022-1070) finds the teardown still pending and queues the send.recompute_queue_hold(slot)returns True, so nothing drains:_would_queue = _teardown_pending or slot._queue or _busy ... if not _busy and not recompute_queue_hold(slot): await _start_next_queued_turn(state, slot) return web.json_response({"ok": True, "queued": True, "queue_id": qid})
_release_and_drainonly runs once_teardown_owed()is False, which never happens here.hold_usersalso includesslot._queue_held(chat_runner.py:7454-7459).
At the merge base and on main, the same send starts _run_chat. Its get_or_create creates the session in the new project, and the end-of-turn consume clears the flag. The comment "Leaving it armed is always safe: the next consume lands it" (chat_runner.py:5416-5417) depends on that turn running. The new gate stops it from running.
Who hits it:
- Anyone who starts a new chat after picking a project on the welcome screen.
ChatPage.tsx:2694-2698creates the slot, callschatSlotProject, then sends. The first message never runs and no error is shown. - Anyone who changes the project of a chat whose session was idle-reaped (default timeout 3600 s), or after a gateway restart, or with
session.eager_spawn: false.
The only way out is deleting the chat or restarting the gateway. From reading the code merged with main, the queued card's "Run now" (PR #12833) also hits hold_users and returns 409 queue_item_unavailable.
Independent checkers reproduced this with the real SessionManager.reset on an empty registry:
- On this PR's head, and on it merged onto main, two sends were both queued and neither ran.
- On the merge base and on main, both were dispatched.
This PR's tests only cover a decline that later succeeds (side_effect=[False, True]) or a busy session.
Fix direction: when the only thing owed is the reset and state.sessions.has_session(key) is False, let the gate fall through to dispatch. Leave the flag set so the turn's end-of-turn consume clears it, as it does on main. PR #11831 and PR #11983 add a has_session(pending_key) clear, but this PR says it depends on no other piece. Please add a test where reset keeps returning False for a key with no session.
From a full open-PR audit against origin/main c66f95b (2026-09-25); findings were checked by independent reviewers reading the code. Reply here if this is wrong.
|
Triage: rebase needed, and coordinate with #11831 / #11983. Checked against
Main still does not cover the core fix. Overlap: #11831 and #11983 (both open) edit the same From an automated open-PR audit; reply if this is wrong. |
|
Thank you for this work. Main has moved a lot since this was opened: src/kiro_crew/dashboard/chat_orchestrator.py was removed in #15362, and the queue-cycle logic now lives in dashboard/chat_turn/queue_cycle.py with its own hold rules. The parent PR #7161 was also closed as superseded, and there has been no activity here since 2026-09-22. I'm closing this one. If the unified gate is still needed, a new PR built on the current queue_cycle.py would be the way forward. |
Carved out of #7161, which is 8.4x over the 1500 added-line cap and is being split so it can
actually be reviewed. This unit is self-contained and does not depend on any other piece.
Typed
fix, notrefactor. Unifying the two readers is where this started, but the unit alsochanges runtime behaviour, so every such change is enumerated under "What changed" below rather
than left to the code comments to explain.
Problem / Motivation
chat_orchestratorandchat_runnereach decided separately whether a slot's queue still heldwork, so the two could disagree about when a drain was finished.
That hand-derivation is also the shape of a worse defect: a queue held back for one reason is
drained anyway by a path that was never taught to consult the hold, which burns the queued
prompts into the very failure they were held back from.
Why it matters
The two readers are what a drain waits on. When they disagree, the wait either ends while the
queue still holds work or keeps waiting after it is empty, and which one happens depends on the
order the two are consulted rather than on the queue.
The leak is the sharper half. A signed-out CLI holds the queue at the tail drain, and the
automatic synthesis turn then dequeues the same prompts behind it, reaches the same auth failure,
and loses them. At the merge base
will_synthesizedoes not consult the hold at all; this PR addsand not slot._queue_heldto it.What changed
Every drain site now reads one published flag,
slot._queue_held, instead of decidingindependently.
recompute_queue_holdinchat_utils.pyderives that flag from all live causes atthe release sites, so a cause that is still live leaves the hold SET. A release that only ever
clears is what turns a still-pending teardown into a queue nothing drains.
Behaviour changes this unit ships, each deliberate:
This changes a pre-existing default. The auth cause is deliberately not carved out of the new
gate: a carve-out would knowingly keep the leak for the one cause that predates this change.
turn now holds the queue. Previously only a signed-out CLI did.
api_chat. An idle send to a slot that still owes a deferredteardown now lands that teardown under
slot._lockand queues behind the hold, instead ofdispatching ahead of it and answering a conversation that is awaiting discard.
liveness was generalised from the reset key to either pending cause. Previously a declined
discard armed no retry at all, so an accepted entry parked until the user happened to send
again.
replaced under its key during the teardown await answers 409
session_rebound; a relayed sendthat would otherwise be queued answers 409
remote_turn_busy, because the 200 queue receiptprecedes the
relay_modemirror and would silently lose the peer's frames. Neither code is newpublic surface: at the merge base
session_reboundappears 17x andremote_turn_busy1x inchat_handlers.py, and this PR adds one further emit site for each._queue_held_authrecords the sign-out cause, which is the one cause norelease site can re-derive from slot state once the turn has ended.
Deliberately unchanged: subagent and cron injections still deliver past a held prompt, and
remote-bound sends do not enter the new gate at all.
The cross-cutting coverage census in
test/test_chat_runner_coverage.pyasserts on this unit'ssymbol and on several others from the parent change in a single block, so it is deliberately left
with the parent rather than split down the middle. This unit carries its own targeted tests instead.
Tests
Cut off the current
maintip, not off the parent branch. Every file except one was modifiedupstream since the parent's merge base, so the change was applied hunk-wise with
git apply -3rather than by checking files out at the older revision, which would have silently reverted
upstream work.
test_a_signed_out_cli_also_holds_the_queue_against_synthesis,which drives the real
AcpAuthRequiredpath, againsttest_synthesis_still_dispatches_when_nothing_is_heldas the positive control that an unheldcycle still synthesises
RED, and the source file is restored byte-identically afterwards
baseline exactly, with no failing file in common with this diff
1123 added lines and 38 removed, across 12 files.