Repository navigation
fix(chat): keep sidebar loop chip when the cold read lands mid-seed - #24800
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the fix is one What this change shipsInventory (3 items) — 2 justifiedIntent: make each sidebar session row show the same loop chip as the chat header, so a stopped loop's chip does not come back after a reconnect. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] d9e09e1 Description read[DESCRIPTION-READ] d112c14dc77eb5b53c6634e8e6966123bfd3e6fdd8935218bc5f26b3a7d0132d 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 to check. The change adds no new or altered control, label or state; it only stops an outdated loop status from bringing back a stopped loop's chip in the sidebar. [UX-REVIEWED] d9e09e1 Description read[DESCRIPTION-READ] 2ebf0ad676abdd600e0cc516249bd9a2c1567cdc7cc28e93f728a0370dbb91b9 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix cancels the stale read at the point where the frame writes, and the cancelled read rolls back to the frame's record, not to the older data. [DESIGN-REVIEWED] d9e09e1 Description read[DESCRIPTION-READ] cae501f0a803ea33cdd1144e5b6d9073367b8172ae2b9822c637c5765376c7f1 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 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: |
df4301c to
b7e85e0
Compare
b7e85e0 to
d9e09e1
Compare
|
self-added: yes
|
|
Review-ready at d9e09e1 (main c7189a8; base moved since in no file this PR touches). PR Readiness passed: 111 checks, 0 failing, label 🤖 AI-assisted comment 🤖 |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: cancels an in-flight cold read before caching a live automation frame so the sidebar loop chip is not lost; with tests.
Problem / Motivation
Goal: A session row in the sidebar shows the same loop chip the chat header shows.
Sometimes a sidebar row shows no loop chip. Opening the session shows the loop in the chat header (for example
95/400). The row stays wrong until the loop's nextautonudge_stateframe or a reconnect, which can be a long time for a quiet gated loop.Why it matters
The sidebar is how a user sees which sessions have a running loop. A missing chip hides a live loop, so the user may think nothing is running.
Not a goal
What changed (motivation → approach → change)
Main's #24795 already carries a running cold read into Redux when it lands mid-seed. That carry has one hole, and this PR closes it:
Only
website/src/hooks/websocket/automationSeed.tschanges: onecancelQueriescall before the live frame's cache write. The frame's record still lands, and a later cold read starts fresh.Backwards compatibility
Compatible: a frame already overwrote the per-slot cache; cancelling the older read only stops it from overwriting the frame later.
Removes nothing: the cancelled read's answer was older than the frame that replaced it.
Tests
website/src/test/useWebSocketGoalLoopSeed.test.ts:carries a running per-slot cold read into the sidebar map (#24787): red on the parent (Redux has no record), green with the fix.does not carry a stopped per-slot cold read into the sidebar map: an inactive cached record stays out of Redux.does not let a cold read that lands after a stop frame restore the chip: a cold read started before anexpiredframe resolves during the reconnect seed; no chip comes back. Red with thecancelQueriesline removed, green with it.The first two tests pin main's carry from #24795. The file passes 25/25, and removing the cancel fails only the stop-frame test.
UseWebSocketCoverage.activity.test.tsx(main's #24795 test) passes 29/29.Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
N/A — unit coverage sufficient: the race is the seed's ordering, which the test drives directly.
Screenshots / video
Why no screenshot: no component changes; the existing loop chip now gets the record it was missing.
Related Issues
Closes #24878
Follows #24795 (which closed #24787).
Sibling sweep
Swept: git grep -nE "setQueryData(['session-automation'" -- website/src
Sibling: website/src/hooks/websocket/automationSeed.ts:213 -- not affected -- the
removedbranch invalidates right after, which cancels the pending read and refetchesSibling: website/src/pages/chat/page/sessionAutomation.ts:44 -- not affected -- both popover writes (lines 44 and 48) are followed by the server's own live frame, which now cancels any older read
Pattern harvest
Not generalizable: the defect is one ordering gap (an older read landing after a newer frame) in the one seed that reads two stores.
Checklist