Skip to content

fix(chat): hand off the queue on every _run_chat exit - #16279

Merged
bolichen97 merged 1 commit into
mainfrom
fix/chat-done-await-early-abort-drain
Oct 4, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/chat-done-await-early-abort-drain

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Every way a dashboard chat turn can end hands the floor back: the next queued message runs, the terminal chat_done frame goes out, and the composer unblocks.

_run_chat's try/finally only covers a turn from session admission on. Some exits happen above it: a content-filter, model-access or image-history replay cancelled at its consume seam, a blocked or local slash command (/prompts, /goal, /workflow, an unsupported /compact), and an exception in that setup. Those exits returned without running the queue drain. A message queued behind them never ran, no terminal chat_done was sent, and slot.task still pointed at a finished task, so the composer stayed blocked. The content-filter abort also passed the async chat_done_payload to broadcast_ws without awaiting it, so its frame failed to serialize (#13824, #16230).

Why it matters

Any user who queues a message behind a local command, or behind a recovery replay that gets cancelled, ends up with a chat that looks busy forever and a queued message that never runs. The only way out is a reload or a Stop.

Not a goal

  • Any change to what the three replay families retry, or to when a Stop, a rebind or a newer message cancels them. This PR only consolidates the rule they share. The one exception is the owed-completion reclassification described below.
  • A dispatcher-level hand-off for a coroutine that is closed before its first step (the run_background_turn timeout, a cancel before start).
  • The hard-kill drain ordering and the /goal stop-sentinel fix, which go in a separate PR.

What changed (motivation → approach → change)

Symptom: early exits stranded the queue. Root cause: the queue hand-off only ran at the end of the main finally, so it lived where only some exits reach. Fix: every exit runs one ordered tail.

Part What it does
_end_turn_tail the one ordered list of per-exit duties, ending in the queue hand-off
_hands_off_queue_on_exit runs that tail for any exit the finally did not finish
_send_chat_done the runner's only chat_done emitter; always awaits the payload
_replay_revocation one revoke rule and notice for the three replay families
  • The tail covers the deferred reset (with the turn's own start priority), steer fences, channel narrowing, wait state, sign-in record, AutoNudge re-arm, then the hand-off. It runs once per turn. Both call sites await it through run_to_completion, so a cancel landing inside the tail is deferred until the hand-off ran, then re-raised.
  • The guard passes the turn an explicit _TurnExit record. The finally records the turn's outcome before its first await, so a second cancel cannot fall back to the early-exit policy. An exit above the try consumes no deferred reset or discard and retires no wait state. It keeps the slot's recorded sign-in hold and asks the memory barrier's own rule. An exception there shows an error row (tagged, so the OpenAI-compatible endpoint answers server_error with a code) and holds the queue, unless the failing code was a local command's own handler. A closing coroutine (GeneratorExit) runs no tail.
  • _finish_queue_cycle reads the chat_done payload while the finishing turn still holds slot.task, then releases it with no await in between. A send that arrives during the read gets the floor. A held queue is not reported as continuing. Titling and the history refresh run only for a cycle a provider served.
  • The replay consume gates and drain drops in chat_turn/recovery.py only decide; none of them broadcasts. The lost-session replay's consume abort leaves its chat_done to the tail too. The model-access replay is identified by its queue id, so the _model_access_recovery_pending latch is gone.
  • A verbatim model-access or image-history replay of an unconsumed sub-agent completion requeues as SUBAGENT_COMPLETION_KIND, so a soft Stop, a rebind or a newer message no longer cancels it. A hard kill still discards it.
  • The fan-out payload is typed as WsPayload (Mapping[str, Any]) on all eight signatures in websocket_hub.py, state.py and eventlog/service.py, so mypy rejects an unawaited payload coroutine at the call site.

Specs updated: learn-cron-dashboard.md (new section "Every turn exit runs the turn's tail", WsPayload note), model-fallback.md, error-handling.md, turn-complete-chime.md, session-summary.md. memory_startup.py exposes memory_prepared() for the tail's barrier verdict. chat_utils.chat_done_payload takes queue_held, so a held queue does not read as continuing. error-code-baseline.json is re-snapshotted: openai_compat.py has one fewer uncoded error.

Backwards compatibility

Compatible: no API, config or persisted shape changes. Local slash commands no longer append their own done row, because the cycle end now writes it, so the client still sees exactly one.

Reader: src/kiro_crew/dashboard/chat_turn/recovery.py:_drop_superseded_model_access_replay -- chat -- the removed _model_access_recovery_pending latch is replaced by the already-recorded _model_access_recovery_queue_id; test_the_drain_names_the_model_access_replay_by_its_queue_id
Reader: src/kiro_crew/dashboard/chat_turn/recovery.py:_refresh_genuine_turn_allowances -- chat -- reads the _model_access_replay kwarg the drain passes instead of the latch; test_a_stale_model_access_record_does_not_cancel_the_next_turn
Reader: src/kiro_crew/dashboard/state.py:_ChatSlot.slots -- chat -- the slot drops the attribute; it was process-local and never persisted
Reader: test/test_model_access_fallback_interactive.py -- chat -- its latch assertions are rewritten against the queue id; test_recovery_record_cleared_when_the_admission_sweep_removes_the_entry
Reader: per-command done rows in /prompts, /goal, /workflow, /compact -- chat -- the cycle end now writes the one done row; test_a_local_command_runs_the_message_queued_behind_it

The .github/black-baseline.txt entry for test_goal_command.py is pruned because that file is now formatted.

Tests

  • test_dashboard_chat.py::TestRunChatEarlyExitHandOff: a local command runs the message queued behind it; a lone local command ends the cycle without titling; a sign-in or memory-preparation hold survives an early exit; a refused command leaves a deferred reset armed; a setup error holds the queue and shows an error plus a finished frame; a failing local command does not hold the queue; a cancel that cuts the finally short keeps the turn's policy; a closed coroutine runs no tail; a nested /prompts get hands off once; the remote-slot refusal does not drain locally; a send during the payload read runs (both drained and held queues) and stays queued while sub-agents run; an early exit leaves a sub-agent's wait state alone; a setup error is a server_error on the OpenAI endpoint (blocking and streaming).
  • Replay tests (test_dashboard_chat.py, test_model_access_fallback_interactive.py): a superseded replay abort runs the queued follow-up; the drain names the model-access replay by its queue id; a stale record does not cancel the next turn; an owed completion is replayed as a completion despite a Stop; synthesis turns and runner continuations stay cancellable; a hard kill discards an owed completion; the verbatim mark travels through the queue.
  • test_refusal_replay_consume_abort_chat_done.py: the consume gate decides without a broadcast; _run_chat ends a stopped or rebound replay with one awaited frame; a replay superseded while preparing hands the floor to the newer message.
  • test_dashboard_chat.py::TestRunChatEarlyExitHandOff::test_a_cancel_inside_the_tail_still_hands_off_the_queue: a cancel during the tail's deferred-reset consume still runs the queued message.
  • test_start_priority.py, test_active_turn_session_key.py, test_chat_runner_coverage.py: pins follow the tail (the eager respawn's priority comes from the recorded outcome).
  • test_chat_runner_composition_contract.py: the consume gates are await-free phases; the entry signature names the guard's turn_exit and the two new drain flags.
  • test_wake_judge_feedback.py, test_prompts.py, test_steer_requeue.py, test_goal_command.py, test_workflow_slash_command.py, test_subagent_delivery_ttl_anchor.py, test_chat_completion_sound.py: updated for the single tail and the single done row.

Each core fix was mutation-checked: at least one test fails when the fix is reverted.

Manual verification

N/A: unit coverage drives _run_chat end to end through each exit with a fake provider. The change has no UI surface beyond the existing chat_done frame.

Related Issues

Fixes #13824
Also reported as #16230 (closed as a duplicate of #13824).

Pattern harvest

Rule candidate: semgrep
Pattern: an async def result passed to a synchronous call without await (here broadcast_ws(..., chat_done_payload(...))). The WsPayload typing closes this class for the fan-out by typing the payload as a Mapping, so mypy rejects a coroutine.

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

@bolichen97
bolichen97 requested a review from a team as a code owner October 2, 2026 21:59
@bolichen97
bolichen97 requested a review from iamwhatever October 2, 2026 21:59
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of f34b7b5a2f4fc606c817a2f414c4e1d3cb02924d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Before merge, confirm one behaviour change: after this PR, a soft Stop no longer cancels a replayed sub-agent completion that the model never consumed.

[DESIGN-REVIEWED] f34b7b5

Description read

[DESCRIPTION-READ] d5a4ae0b0b0121807771591a143e6587b1bebef5ac9ec7531d7db1e1ebc94db4

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 added the readiness: checking Automated validation is still running label Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f34b7b5

False positive or not applicable? A repository writer can comment:
/ai-review override gpt f34b7b5a2f4fc606c817a2f414c4e1d3cb02924d: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of f34b7b5a2f4fc606c817a2f414c4e1d3cb02924d — 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The owed-completion reclassification rides along with a queue hand-off fix: it changes what a soft Stop cancels and lets a replay run ahead of newer user messages.

Not justified as shipped

  • Item 6 — rides along, inherited: ## Not a goal makes an exception for it ("The one exception is the owed-completion reclassification"), but the Goal is about queue hand-off. Nothing ties it to the hand-off defect. The tests that pin it are added by this PR, so they record a new decision rather than show a reported bug. The early-exit hand-off (items 1–3) removes the reported defect without it.
    Subtraction: delete _replay_owes_delivery, _requeue_owed_completion, _REPLAYS_COMPLETION_KEY, the _replays_completion kwarg and _turn_is_completion, and move them to their own PR.
    Clears when: a linked issue or a failing-on-base reproduction shows an owed completion lost to a soft Stop, or the mechanism is removed.
  • Item 7 — inherited (symmetry): the model-access drain-side drop now posts a cancellation notice where it was silent before, justified only as "one revoke rule and notice for the three replay families".
    Subtraction: drop the slot.append("notice", …) added in _drop_superseded_model_access_replay.
    Clears when: a report names users confused by the silent drop, or the line is removed.

What this change ships

Inventory (10 items) — 8 justified

Intent: make every way a chat turn can end run the next queued message, send chat_done and unblock the composer. FIX.

  1. Local slash commands and cancelled replays now run the message queued behind them and unblock the composer — justified
  2. Content-filter abort's chat_done frame is awaited and serializes — justified
  3. A setup exception shows an error row, holds the queue, and the OpenAI-compatible endpoint returns server_error — justified
  4. Titling and the summary are skipped for cycles where no turn reached a provider — justified
  5. A send that arrives while chat_done is being read gets the floor — justified
  6. A soft Stop no longer cancels an owed sub-agent completion replay, and the replay runs ahead of a newer user message — rides along
  7. Model-access drain drop now shows a "retry cancelled" notice — inherited
  8. Fan-out payloads typed WsPayload, so mypy rejects an unawaited payload — justified
  9. _model_access_recovery_pending latch removed; the replay is identified by its queue id — justified
  10. Three replay families share one revocation rule (_replay_revocation) — justified

[FIRST-PRINCIPLES-REVIEWED] f34b7b5

Description read

[DESCRIPTION-READ] 45799b727e8629bc60c7df45b189d33400262e86e8048d0b2338d63c2e046b18

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 Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] f34b7b5

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable f34b7b5a2f4fc606c817a2f414c4e1d3cb02924d: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 2, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) October 3, 2026 20:44
@bolichen97
bolichen97 force-pushed the fix/chat-done-await-early-abort-drain branch from 73feb14 to 9fcc3a4 Compare October 4, 2026 07:21
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 4, 2026
@bolichen97
bolichen97 force-pushed the fix/chat-done-await-early-abort-drain branch from 9fcc3a4 to 46f373b Compare October 4, 2026 09:54
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 4, 2026
@bolichen97
bolichen97 force-pushed the fix/chat-done-await-early-abort-drain branch from 46f373b to 2ad8af9 Compare October 4, 2026 13:38
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 4, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 4, 2026
buluoray
buluoray previously approved these changes Oct 4, 2026

@buluoray buluoray 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.

Review of 424f33ba90 — queue hand-off on every _run_chat exit

Verdict: approve. Each exit path I traced hands the queue off exactly once. Every guard I removed made a named test fail, with one exception, listed as follow-up 1. #16020's start-priority plumbing is still in place.

Exactly-once hand-off, by exit path

  • Normal end, or an exception or cancel inside the main try. The finally records turn_exit.outcome second, after a synchronous lock release and before its first await (chat_runner.py:18617). It ends with await run_to_completion(_end_turn_tail(...)) (:18915). _end_turn_tail sets handed_off = True as its first statement (:7699). The guard then skips its own tail because handed_off is set (:7845).
  • A finally cut short by a second cancel. outcome is already recorded, so the guard runs the tail with the turn's own policy rather than the early-exit policy.
  • Early returns above the try (a replay cancelled at its consume seam, a local or blocked slash command). The guard's finally runs the tail with outcome=None. With no outcome, the tail consumes no deferred reset, leaves the wait state alone, and gets the memory verdict from _memory_preparation_settled (:7600).
  • An exception above the try. The guard appends an error row tagged turn_failed. It holds the queue (setup_failed) unless the failure came from a local command's own handler (:7836-7841).
  • Nested /prompts get. The outer frame sets handed_off = True before it awaits the nested _run_chat (:9459). The nested call has its own guard and runs the only tail.
  • Remote-slot refusal. This exit opts out on purpose (:8203), because a remote slot's queue drains on its peer.
  • GeneratorExit. No tail runs. The PR lists this as a non-goal.
  • Leftover chat_done emitters. Only two remain outside _finish_queue_cycle: the remote refusal and the mid-turn /compact continuing=True frame (:15642). Neither ends a cycle, so the client still gets one terminal frame per cycle.
  • Cancel during the tail. Both call sites wrap the tail in run_to_completion (shield loop, chat_utils.py:248). A cancel is deferred until the hand-off has run, then re-raised. The coroutine is scheduled with ensure_future, so handed_off is set before the guard reads it, even when a cancel lands before the tail's first step.
  • Race with a send during the payload read. _finish_queue_cycle reads the payload while the finishing turn still holds slot.task, and loops until the queue stops moving (:7468-7483). A send that arrives during the read queues behind the turn and then gets the floor. The release has no await between slot.task = None and the broadcast.

#16020 interaction

_turn_start_priority and all of its _turn_priority call sites are still present. The deferred-reset respawn moved into the tail as schedule_eager_spawn(..., start_priority=outcome.start_priority) (:7717). Dropping that kwarg fails test_start_priority.py::test_a_claimer_passes_its_priority[...-_end_turn_tail-schedule_eager_spawn-outcome.start_priority].

Mutation probes (each reverted; worktree left clean)

Guard removed Test that fails
handed_off = True at tail entry (double hand-off) many, e.g. test_a_local_command_runs_the_message_queued_behind_it[/goal status], TestRunChatRefusalFallback::*
guard finally runs no tail (lost hand-off) test_a_local_command_runs_the_message_queued_behind_it[/workflow|/quit|/prompts get ...], test_superseded_replay_abort_runs_the_queued_followup[...], test_aborted_replay_starts_a_pending_synthesis
outcome recorded just before the tail instead of at the top of finally test_a_cancel_cutting_the_finally_short_keeps_the_turns_own_policy
finally's run_to_completion → plain await test_a_cancel_inside_the_tail_still_hands_off_the_queue
/prompts get outer opt-out test_a_nested_prompts_get_turn_hands_off_exactly_once
remote refusal opt-out test_the_remote_slot_refusal_does_not_drain_locally
setup_failed forced False test_a_setup_error_holds_the_queue, test_a_setup_error_shows_an_error_and_a_finished_frame
payload re-read loop test_a_send_during_the_payload_read_queues_and_runs, test_a_send_during_the_read_of_a_held_queue_runs[setup|sign-in]
GeneratorExit → tail test_a_closed_coroutine_runs_no_tail
guard's run_to_completion → plain await no test fails (follow-up 1)

All 15 changed test files pass at this head (2223 passed, 1 skipped). CI at 424f33ba90: 90 pass, 8 skipped, 0 failing.

Fail-open / fail-closed

  • Setup-error hold: fail-closed. The slot is released, chat_done goes out, and the queue is kept until the user's next send (the same remedy as the sign-in hold).
  • Early exit while memory preparation is unsettled: fail-closed. The queue is held and _arm_parked_queue_drain starts it once preparation finishes.
  • Uncancellable tail: fail-open on cancel latency only. The delay is bounded, because the teardown inside uses skip_if_busy=True and the ACP shutdown runs under _TERMINATE_TIMEOUT. The cancel is re-raised afterwards. Base already ran the same consume in the same finally. I accept the author's rebuttal on the design-review thread.
  • A tail that raises before _hand_off_queue: fail-open, back to the stranded state. The guard only logs it. The one step that can realistically raise (_consume_pending_reset) is wrapped in try, so I consider this acceptable.

Non-blocking follow-ups

  1. The guard's run_to_completion (:7850) has no test. Turning it into a plain await keeps the suite green. Add a test for a cancel that lands during a tail the guard runs: for example, a local command with a queued entry, cancelled inside chat_done_payload. Without the shield, that exit would leave slot.task pointing at a finished task.
  2. The nested /prompts get turn runs the only tail at depth 1, so _turn_channel_narrowed is not cleared there (:7727). Base behaves the same way (its outer frame returned before any finally), and the next depth-0 entry clears it (:8211). This is informational only.

I did not check the frontend or mypy.

_run_chat's try/finally covers a turn only from session admission on.
The exits above it returned past the queue drain: a content-filter,
model-access or image-history replay cancelled at its consume seam, a
blocked or local slash command (/prompts, /goal, /workflow, an
unsupported /compact), or an exception in that setup. A message queued
behind them never ran, no terminal chat_done went out, and slot.task
kept pointing at a finished task, so the composer stayed blocked.

_end_turn_tail is now the one ordered list of per-exit duties, ending
in the queue hand-off, and it runs once per turn: at the end of the
finally, or from the _hands_off_queue_on_exit guard for any exit the
finally did not finish. Both sites await it through run_to_completion,
so a cancel landing inside the tail is deferred until the hand-off ran.
The guard passes the turn a _TurnExit record, skips a closing
coroutine, and takes the tail's policy from what the turn recorded:
the finally records its outcome (sign-in result, barrier verdict,
start priority, AutoNudge facts) before its first await; an exit that
never reached the try consumes no deferred reset, retires no wait
state, keeps the slot's recorded sign-in hold and asks the memory
barrier's own rule; an exception there shows an error row, tagged so
the OpenAI-compatible endpoint answers server_error with a code, and
holds the queue unless a local command's own handler raised it. Local
commands no longer append their own done row.

_finish_queue_cycle reads the chat_done payload while the finishing
turn still holds the slot and hands a send that queued during the read
the floor; a held queue does not count as continuing work in that
frame, and titling runs only for a cycle a provider served.
_send_chat_done is the runner's one chat_done emitter.

The three replay families revoke by one rule (_replay_revocation in
chat_turn/recovery.py) at the drain and at the consume seam, and the
consume gates only decide: the tail sends the frame, also for the
lost-session replay's consume abort. The model-access replay is
identified only by its queue id, so the _model_access_recovery_pending
latch is gone. An unconsumed sub-agent completion is classified once
at its requeue and queued as the completion it is, so only a hard kill
discards it.

The websocket fan-out payload is typed as WsPayload (a Mapping), so
mypy rejects an un-awaited payload coroutine at the call site.

Fixes #13824
@bolichen97
bolichen97 force-pushed the fix/chat-done-await-early-abort-drain branch from 424f33b to f34b7b5 Compare October 4, 2026 21:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 4, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=917d81858567 Item 6 — owed-completion reclassification — rebutted

Not a new policy: base already keeps an unconsumed sub-agent completion across a sign-in retry (chat_turn/recovery.py: _auth_retry_kind = SUBAGENT_COMPLETION_KIND). This PR applies that same rule to the model-access and image-history replays.
Without it, a soft Stop on such a replay deletes the sub-agent's result before the parent ever saw it, while the identical completion hit by a sign-in failure survives. That is lost data, not taste.
Narrow on purpose: _replay_owes_delivery is true only when the turn's message IS the completion and _on_consumed has not fired. Synthesis turns, runner continuations and retry prompts stay cancellable; a hard kill still discards it.
The PR's ## Not a goal names this as the one scoped exception, and it was disposed on the prior head (span 231daa64b759). Splitting it out would ship the queue hand-off with one replay family still losing completions.
self-added: no

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=5bd94e165286 Item 7 — notice on the model-access drain-side drop — rebutted

On base the model-access drop is the only replay family that is silent. _drop_superseded_image_recovery and _drop_superseded_refusal_replay already post a msg msg-info notice when they revoke a replay (see origin/main chat_turn/recovery.py).
The dropped entry is the user's own original message, re-queued after the model swap. Removing it with no row leaves the user's message gone with no trace, while the two sibling paths tell them.
The added line reuses the shared _replay_revocation(...).notice(...) text, so it adds no new wording or mechanism. Dropping it would re-create the one silent path.
self-added: no

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 4, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Reviewed, not approving from my side: ~2.5k added / ~800 removed lines across 31 files changing how the chat queue is handed off on every _run_chat exit. That is the core turn loop, where a lost or doubled queued message is easy to miss, and at this size it needs a maintainer's own review. Auto-merge is on, so please make sure a maintainer approves explicitly.

@buluoray buluoray 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.

Re-approving at head f34b7b5a2f after the rebase. git range-diff against the head I approved (424f33ba90) shows the commit unchanged except error-code-baseline.json, regenerated against the new main; every source and test file in the PR diff is identical, so my earlier review stands. CI at this head: 95 checks, none red.

@bolichen97
bolichen97 merged commit 98f2b96 into main Oct 4, 2026
143 of 144 checks passed
@bolichen97
bolichen97 deleted the fix/chat-done-await-early-abort-drain branch October 4, 2026 23:19
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 4, 2026
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.

fix(dashboard): two refusal-replay aborts broadcast an un-awaited chat_done_payload coroutine

3 participants