Repository navigation
feat: mark queued prompts that won't survive a restart - #31441
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the label reuses the writer's own verdict on both card sources, and every slot-detail read judges the queue again, so the turn-end refresh keeps or clears the label. [DESIGN-REVIEWED] 91cb08d Description read[DESCRIPTION-READ] ce4233353644e33a7c5e4607a4278a8165589dea16e6222bd70c84058824476e 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 label reuses the verdict the server already computes ( What this change shipsInventory (7 items) — 7 justifiedIntent: let someone who queued a prompt see that a gateway restart would drop it, so they can keep the text or send it again. This is an ADDITION (Closes #11695).
[FIRST-PRINCIPLES-REVIEWED] 91cb08d Description read[DESCRIPTION-READ] e4744e4d4ded34c32576e48d10e321667e81cea6006ed800fdddea5c103c14c9 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The screenshots show the new label, and the blind reader understood it as "this waiting message will be lost if the app or assistant restarts", which is what it means. Notes
[UX-REVIEWED] 91cb08d Description read[DESCRIPTION-READ] d7de34e3d947e62056a4e54a5d75177be5aec4c19a85eba2313c81f0b5a9b52a That sha256 names everything this verdict read: the PR description, plus the 6 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 |
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: |
d240587 to
5ab37a8
Compare
|
d286f8a to
753fca3
Compare
753fca3 to
93287c9
Compare
A prompt queued past the durable queue bounds is accepted but only logged as not persisted, so the queue card shows it like any other. Put the verdict on the queue_push frames and the slot-detail queue as meta.durable: false and draw a quiet "won't survive a restart" label on that card, so the sender can see it before a restart drops it.
|
[operator: bolichen97] Rebased: main moved in the line-budget and platform collect-ignore tests (fixed on main by #32252 and #32209) since this head went red (b65af1a -> f58c3cf); CI re-running. The patch is unchanged (git range-diff shows the same commit); changed backend and frontend tests, flake8, isort, mypy and tsc pass locally, and local GPT and Opus reviews of 91cb08d passed. AI-assisted, posted on behalf of bolichen97 |
93287c9 to
91cb08d
Compare
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
APPROVE at 91cb08d.
What it does for users: a prompt queued while a turn runs is saved so a restart cannot lose it, but the saved copy holds at most 32 prompts and 256 KB. A prompt past either bound used to be silently unsaved; only a server log line said so. Its queue card now shows a quiet "won't survive a restart" label, so the sender can keep the text or send it again later. Nothing else on the card changes, and a send is never refused.
Evidence:
- The verdict comes from the writer itself. Both paths read the writer's own output (durable_queue_entries): warn_if_not_durable (slot_queue_repository.py:263-268) and the new refused_durable_ids (slot_queue_repository.py:287-291). refused_durable_ids subtracts the kept set from the durable candidates only, so a system entry (a cron notice, a recovery continuation) is never labelled on a slot-detail read.
- Busy-slot frame (chat_delivery.py:1428-1434): the broadcast now goes out after the verdict, and a refused entry carries meta.durable false. The sub-agent hold frame does the same (chat_send.py:1449, 1474-1476).
- The fair-admission work id is now stamped inside queue_for_next_turn before the verdict (chat_delivery.py:1385-1388). The writer weighs that id, so judging before the stamp would label the wrong prompts. The two callers that stamped afterwards (chat_send.py busy branch, responsive_chat.py) now pass queued_work instead. stamp_queued_work itself is unchanged (shared_crew admission_entry.py:222-235).
- Slot detail and resume use queue_view (chat_delivery.py:1710-1727). Slot detail judges the live entries in the same tick as its trimmed copy (slot_detail.py:1214-1216), because the copy drops source channels that the writer counts.
- Frontend: wire.ts and queue.ts keep durable false from either source. A pinned crewmate row takes the refreshed verdict both ways (queue.ts:91-100). QueueStack.tsx draws the label only when meta.durable === false. The string is present in all 13 locale files.
- The session spec section "Queued prompt durability" was updated in the same commit. It replaces the earlier "log only, not shipped" stance and lists the cases the turn-end refresh corrects.
Mutation: the busy-slot durable = False assignment replaced with pass. Result: test_an_over_cap_enqueue_warns_and_is_still_accepted and test_the_admitted_work_id_is_weighed_before_the_frame go red; restored and the tree checked clean.
Tests: test_queued_prompt_durability, test_queue_during_subagents and test_crew_mode_workers gave 246 passed. queue.durable.test.ts plus QueueStack.test.tsx gave 55 passed.
CI at this head: 83 success, 11 skipped, 0 failing. PR Readiness and both CodeBuild statuses are success. The GPT, Opus, Design, UX and First Principles lanes report PASS or no findings. It merges cleanly with main.
Source-only: the rendering in light, dark and narrow panes, judged from the screenshots in the description.
Follow-ups (non-blocking):
- A label drawn from a push frame can go stale until the next turn-end refresh. If an earlier card is cancelled or edited shorter, a later card may keep "won't survive a restart" although it now fits. The description and spec both scope this out; worth a note if users report it.
- warn_if_not_durable answers false for any entry that is not a durable candidate, such as an entry with empty text. If an attachment-only send with empty text can reach queue_for_next_turn (I did not check), that card would carry the label on its push frame and lose it on the next slot-detail read. The label is literally true there, but the two sources disagree.
…32334) A send that waits in the queue lost the knowledge envelope mark the composer records on meta.knowledge.envelope, so the queue card guessed the envelope from the wire text: it showed the whole text when a knowledge item held the close marker on its own line, and hid a typed copy of an envelope as if it were real. The gateway now keeps that mark, bounded and nothing else, on the queue entry as meta.knowledgeEnvelope (busy, hold, responsive and requeued steer paths), and sends it on queue_push and the slot-detail queue. The card finds the envelope with knowledgeEnvelopeEnd, and the text-parsing splitKnowledgeEnvelope is gone. Closes #24011 (cherry picked from commit 790b725) Backport note: the durable marker and the queued_work parameter that sit beside these lines on main come from feat #31441, which is not on release, so each of the six conflicts keeps release's side and adds only the knowledge envelope part: queue_for_next_turn takes only the knowledge parameter and stamps it on the push before release's own broadcast; the idle-hold push, responsive_chat.accept, queue.ts and wire.ts add only the knowledgeEnvelope field (no durable). The learn-cron-dashboard spec adds only the knowledge envelope paragraph, not the queue editor hold paragraph from #30549.
…32334) A send that waits in the queue lost the knowledge envelope mark the composer records on meta.knowledge.envelope, so the queue card guessed the envelope from the wire text: it showed the whole text when a knowledge item held the close marker on its own line, and hid a typed copy of an envelope as if it were real. The gateway now keeps that mark, bounded and nothing else, on the queue entry as meta.knowledgeEnvelope (busy, hold, responsive and requeued steer paths), and sends it on queue_push and the slot-detail queue. The card finds the envelope with knowledgeEnvelopeEnd, and the text-parsing splitKnowledgeEnvelope is gone. Closes #24011 (cherry picked from commit 790b725) Backport note: the durable marker and the queued_work parameter that sit beside these lines on main come from feat #31441, which is not on release, so each of the six conflicts keeps release's side and adds only the knowledge envelope part: queue_for_next_turn takes only the knowledge parameter and stamps it on the push before release's own broadcast; the idle-hold push, responsive_chat.accept, queue.ts and wire.ts add only the knowledgeEnvelope field (no durable). The learn-cron-dashboard spec adds only the knowledge envelope paragraph, not the queue editor hold paragraph from #30549.
Problem / Motivation
Goal: A queued prompt that will not survive a gateway restart says so on its queue card.
A prompt sent while a turn is running is queued and saved so a restart cannot lose it. The saved copy holds at most 32 prompts and 256 KB. A prompt past either bound is still accepted, but it is not saved. Today only a server log line says so: the queue card looks exactly like every other card.
Why it matters
A restart before that prompt runs (an auto-update, a watchdog exit) drops it, and the sender had no way to see that coming. With a visible label they can keep the text, cancel the card, or send it again later.
Not a goal
/api/chatJSON receipts. Nothing reads them for it; the card reads the websocket frame.What changed (motivation → approach → change)
The server already knows the answer:
warn_if_not_durablereads it off the durable writer's own output and logs it. That verdict now reaches the card, in both places a card is drawn from.queue_pushframe: busy-slot send (dashboard/chat_delivery.py), sub-agent hold (dashboard/chat_api/chat_send.py)meta.durable: falsewhen the saved copy cannot hold the entry. The fair-admission work id is now stamped insidequeue_for_next_turn(callers inchat_api/chat_send.pyandresponsive_chat.pypass it), before the verdict, because the write weighs itqueue_viewindashboard/chat_delivery.py, used bychat_api/slot_detail.pyandchat_api/resume.pythroughdashboard/chat_handlers.pyrefused_durable_idsindashboard/slot_queue_repository.py), so a refreshed card keeps the label only while it is still true. Slot detail judges the live entries, not its trimmed copy, because the writer also weighs fields the copy drops (source channels)store/chat/queue.ts,store/chat/wire.ts)durable: falseon the queued row from either sourceQueueStack.tsxwebsite/src/i18n/locales/and the pseudolocaleA frame-only marker was the first option, and it is not enough: every turn end refreshes the slot and rebuilds the queue cards from the slot-detail read, which would erase the label at the next turn. Judging again on that read also clears the label once enough of the queue ahead has drained.
The spec section Queued prompt durability in
docs/system-specs/modules/session.mddescribes where the verdict lives now.Builds on #11768 by @fathirramadhan-web, which drew the card half of this.
Backwards compatibility
Compatible: one optional
meta.durablekey is added to thequeue_pushframe and to slot-detail queue entries, and only when it isfalse. An older client ignores it and draws the card as before.Removes nothing: no key, row, route or function is removed or renamed.
Tests
test_an_over_cap_enqueue_warns_and_is_still_accepted: the busy-slot frame for the 33rd prompt carriesmeta.durable: false.test_a_held_prompt_past_the_durable_cap_is_marked_on_its_frame: the same for a prompt held behind running sub-agents. It sends as an unmarked caller, because the session's own composer sends are no longer held behind sub-agents.test_the_slot_detail_queue_marks_only_the_refused_prompt: the slot-detail queue marks only the refused prompt (not a system entry), and drops the mark once the queue ahead drains.test_the_slot_detail_read_judges_the_live_entries: throughGET /api/chat/slots/<slot>, seven prompts with source channels near the byte budget mark the seventh, which the writer refuses. Red with the slot-detail read judging its own copy.test_the_admitted_work_id_is_weighed_before_the_frame: a busy-slot send under fair admission is judged after its work id is on the entry (queue_for_next_turn(..., queued_work=)stamps it before the verdict), so a prompt that only fits without the id is marked. Red with the stamp after the frame.test_an_ordinary_enqueue_emits_no_warning_and_reaches_disk: an ordinary send carries no mark.test_crew_mode_workers.pynow importsdashboard.chat_handlersat module load. It copieschat_delivery/chat_runnernames at import, so a first import inside a test that patches those names kept the fake for later tests on the same worker. That made three tests intest_queue_during_subagents.pyfail about 1 run in 4 under-n 4. 20 runs of both files at-n 4now pass (5 of 20 failed before).queue.durable.test.ts: the row keepsdurable: falsefrom a pushed frame and from a slot-detail rebuild, and a crewmate's pinned row (kept in place byhydrateQueuedBubbles) takes the refreshed verdict both ways. Red before the pinned-row sync.QueueStack.test.tsx: the label renders on the refused card only.Determinism: the changed
test_queued_prompt_durability.pytests ran 20 times at-n0and 10 times at-n 4 --dist loadgroup --max-worker-restart=2besidetest_queue_hold_gate.pyandtest_chat_steer.py; both changed backend files ran in a shuffled order (seed 4242, 158 tests); the two vitest files ran 5 times with--sequence.shuffle(seeds 1001-1005). All green.Manual verification
Ran the built SPA with every
/api/**call answered from fixtures: a running session whose queue holds two entries, the second withmeta.durable: false. The harness asserted exactly one label, on the second card, in light and dark themes and in a 760 px pane.Screenshots / video
Light theme, expanded stack: only the second card wears the label.
Dark theme:
Narrow pane (760 px): the label and the preview both truncate
Related Issues
Closes #11695
Sibling sweep
Siblings: none -- a feature that adds a label; there is no defect with a second site.
Pattern harvest
Not generalizable: a new on-screen label for an existing server verdict, not a defect 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.