Repository navigation
fix(dashboard): keep unread state on the gateway so every device agrees - #37215
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff adds or changes no control, label or string. It only changes when the existing unread dot gets set: gateway storage, hooks and lib logic, with no TSX or i18n changes. So the missing blind read leaves no evidence gap. [UX-REVIEWED] e9e106d Description read[DESCRIPTION-READ] c55850f82f89666a1381ec4ca0e6f61d8afe51b3c526d476e109fb696d4349cb That sha256 names everything this verdict read: the PR description, plus the 3 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. Issue #36613 is the evidence for reversing the old ws.py pin ("the server keeps no read-state: unread is a frontend concept … and stays one"), and the description states that problem. Notes
What this change shipsInventory (9 items) — 8 justifiedIntent: unread badges agree on every device and after reconnects, including messages that arrived while no window was open. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] e9e106d Description read[DESCRIPTION-READ] 183bf5b20a244f5fdedd17534639621049610da8a119fa9a17f643228864f18c That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: storing the newest read time per session on the gateway, and moving it forward only, is the right fix for unread badges that drift between devices and after reconnects. Notes
[DESIGN-REVIEWED] e9e106d Description read[DESCRIPTION-READ] dbfecbb97cb8cb383988d26ca24d12bbf68cf35328cd4c5ab5b73360f6ffcbc1 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 |
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 findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/dashboard/slot_row_memo.py:186 -- A deferred note hides an unread terminal failure
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 — LOW harm. Every condition has to hold at once:
The only loss is the badge. There is no automatic recovery for it, but the failure isn't lost: the error row stays in the transcript, and a connected client still exempts it live. It affects only a session the user chose to mute. The real fix is costly: a second timestamp field and a failure flag carried through the summary, the projection and the frontend candidate and floor logic, all to serve one rare path. False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 25% chance that this change introduces a defect, above the 12% limit for approving on its own. The gateway now saves each session's last read time in the fenced pinned-order directory. Only the owner can write it, it only moves forward and writes run one at a time. The time and an upgrade floor go out on every slot row and are stripped for app and member callers via PIN_ORDER_FIELDS. The browser works out missed badges after each slot list and keeps reads the gateway hasn't confirmed in an outbox, resending them on reconnect. I checked the trust gate, field stripping, how saving and loading behave on failure and on repeat, resend on socket open, and the live-arrival paths, and found no regression. Tests are thorough and CI is green. The one confirmed gap (a muted session's failure followed by a held note while no dashboard is open) is a rare path; I left it as a non-blocking note. Tier: 2, held for a person: changes requested. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
5bb32d0 to
544fb0f
Compare
|
|
|
|
|
|
544fb0f to
c50d52b
Compare
|
|
|
|
|
|
397069f to
f22a8f1
Compare
|
self-added: yes
|
f22a8f1 to
d27222b
Compare
|
|
|
|
|
|
d27222b to
e999845
Compare
|
|
@bolichen97 could you take another look when you have a moment? The blocking point from your review is addressed in ce98ff6 in the shape you suggested: every valid owner |
|
|
|
The gateway stores each session's newest read; rows carry it as last_read_ts. Browsers derive badges from it and keep unconfirmed reads until acknowledged.
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed on e9e106d: my blocking point is fixed. _handle_slot_read rebroadcasts every valid owner slot_read at once, as on main, and the stored: true echo follows only after after_persisted, so other windows get the same immediate relay and the sender drops a kept read only on that echo. The outbox work since (one shared navigator.locks section for queue, ack and resend; the switch-slot watermark from the fetched rows) also reads right, with a test that fails on the old code for each.
I'm dismissing my earlier change request. What is left is the maintainer design sign-off the Captain asked for (this changes how unread badges behave across devices); I've put it in front of a maintainer and will approve once that is recorded.
AI-assisted, sent by Bolin Review bot
bolichen97
left a comment
There was a problem hiding this comment.
Maintainer design sign-off on head e9e106d773: approved. Keeping each session's read point on the gateway, owner-only and forward-only, is the design we want, so unread state agrees across devices. Readiness passed and CI is green.
AI-assisted, sent by Bolin Review bot
Problem / Motivation
Goal: Unread badges are right on every device and after every reconnect, including for messages that arrived while no dashboard window was open.
Unread badges lived only in each browser's localStorage and were set only by live socket frames. A message that arrived while no window was open never badged its session, because reconnect catch-up suppresses marking. A second device kept stale badges for sessions read elsewhere and missed new ones. A read sent while the socket was down, or lost when a stalled gateway's socket was killed, was gone for good.
Why it matters
Unread is the main way a person finds the sessions that need them. Today it is right only for a browser that stayed open the whole time, so a phone and a desktop disagree, and a laggy gateway can bring back badges for sessions already read.
Not a goal
What changed (motivation → approach → change)
The gateway now remembers when each session was last read, so every device can work out the same unread list.
slot_readindashboard/ws.pykeeps the newest read time per session indashboard/slot_read_state.py(one small file in the fencedpinned-orderdirectory). Writes run one at a time. The read is relayed to every window at once, as before; once that time is on disk a secondslot_readwithstored: truefollows, and only that echo lets a browser drop its kept read, so a browser never drops a read the gateway could lose.state_parts/slots_frame.pyputslast_read_ts(the session's stored read, or null) andread_epoch(when the store was first written) on each row, typed intypes/index.chat.ts;dashboard/pinned_session_order.pystrips both from app and member callers like the order fields.dashboard/slot_row_memo.pyanddashboard/slot_projection.pyaddunread_ts, the newest row the live rule would badge (a crewmate thread's newest reply; otherwise its newest saved row that is not the person's own prompt or a recycle notice: a reply, a tool or notice row, a note, an error), andunread_failedwhen that row is a terminal failure.websocket/serverReads.tsclears badges a real read covers, and badges sessions whoseunread_tsis newer than both the read andread_epoch; under "only when done or waiting" an idle chat badges on its turn's last agent row or terminal failure instead, so a later note stays quiet, as live.read_epochnever clears a badge. A terminal failure badges a muted session, as live; until the app mutes have loaded, no session an app could mute is badged, andwebsocket/slotList.tsruns the pass once more on the current rows when they load. A row shown on screen, live or after reconnect catch-up (websocket/attention.ts,websocket/reconnectCatchUp.ts), is sent as read in a focused window or noted as shown inlib/slotReadRelay.tsotherwise. A read of a crew conductor also covers the pending approval rows of its crew members, so the conductor's badge stays cleared on a device that never saw the prompt arrive.lib/readOutbox.ts) until the gateway confirms it, and each new connection sends it again once. Until then it counts as read.A read only moves forward on the gateway, so resending is safe. A reply older than
read_epochnever badges, so an upgrade badges nothing old and keeps the badges a browser already had. Specs for the socket frame, the store directory and the websocket owners are updated.Backwards compatibility
Compatible:
slot_readkeeps its frame shape and its immediate relay; the stored echo only adds astoredfield, and an older browser ignores it and the newlast_read_ts,read_epoch,unread_tsandunread_failedrow fields.Removes nothing: the per-window unread record stays as the fast cache; the gateway only adds a stored read time.
Tests
test/test_slot_row_memo.py:unread_tsfollows the live badge rule: a note, a tool, system or notice row, and any error move it (a terminal failure also setsunread_failed), the person's own prompt and a recycle notice do not, and a crewmate's tool-only tail leaves its reply time alone.test/test_slot_read_state.py: reads only move forward by instant, the file round-trips beside the orders, a read before the load is merged, writes coalesce and run one at a time, a failed first write publishes no epoch and is retried, rows carry only a written read and carry the epoch apart, and a read reaches the rows and survives a gateway restart.test/test_eager_spawn_slot_frames.py: everyslot_readis relayed at once with the sender's time, thestoredecho waits for the write, a failed write still relays but sends no echo until the resend, a read during a write gets its own write, an older read echoes the newer stored time, and an unparseable time relays as sent and is never stored.test/test_pinned_session_order.pyandtest/test_manual_session_order.py: the post-listen load publishes exactly twice (orders, then read times) and a repeated load publishes nothing.website/src/hooks/websocket/serverReads.test.ts: badges a missed reply, clears what another device read, re-badges a reply newer than the read that cleared an old badge, keeps manual marks, skips on-screen and muted slots, badges a missed crewmate reply and a muted session's terminal failure, holds an app-owned session's badge until the app mutes load and then badges it with no new slot list, badges a running turn only when it waits on the user, keeps a note after the turn and a running crewmate thread quiet under that setting, badges a crew conductor whose worker waits on an approval and keeps it clear once the conductor is read in a window that never saw the prompt, the store epoch never clears a restored badge and badges no reply before it.website/src/hooks/websocket/reconnectCatchUp.shownRow.test.ts: a reply shown by reconnect catch-up in a focused window is sent as read and does not badge after switching away; an unfocused window keeps it as shown here.website/src/test/readOutbox.test.ts: the outbox keeps the newest read, survives a reload, forgets only on a covering ack, caps its size, and resends each kept read once.website/src/test/slotReadRelay.test.tsx: through the real socket hook, the first slot list badges a missed reply, a read made while the socket was down is sent once by the next socket and cleared only by thestoredecho, never by the plain relay, and a resent read never covers a later unseen permission row.Each fix was broken on purpose and its tests went red, including the relay held back until the write, the outbox dropped by a plain relay, the overlapping writes, the unwritten epoch, the epoch clearing a badge, the resend covering a permission row and the catch-up read. New tests also ran green in a shuffled order.
Proof: not provable -- other: the fix adds a new module, so reverting it fails test collection instead of an assertion
Manual verification
N/A — unit and socket-hook tests cover the store, the row field, the derivation and the outbox; no new UI surface.
Screenshots / video
Why no screenshot: the unread dot renders exactly as before; only when it is set changes, which the socket-hook tests show.
Related Issues
Closes #36613
Sibling sweep
Swept: git grep -n "markSlotUnread" -- website/src
Siblings: none -- every automatic marker runs on live frames only; the new slot-list pass covers all of them at once
Pattern harvest
Not generalizable: this is a missing piece of state, not a repeated code shape.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)