Skip to content

fix(chat): keep sidebar loop chip when the cold read lands mid-seed - #24800

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
crew/issue-triage/fix-24787-seed-loop-chip
Oct 27, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
crew/issue-triage/fix-24787-seed-loop-chip

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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 next autonudge_state frame 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

  • Merging the sidebar and chat header onto one store.
  • Changing how live frames or the REST snapshot reconcile otherwise.

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:

Step What
Symptom A stopped loop's chip comes back in the sidebar
Cause A cold read that started before a stop frame lands late, during the reconnect seed, and gets carried
Fix A live frame cancels any cold read for its slot that is still loading

Only website/src/hooks/websocket/automationSeed.ts changes: one cancelQueries call 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 an expired frame resolves during the reconnect seed; no chip comes back. Red with the cancelQueries line 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 removed branch invalidates right after, which cancels the pending read and refetches
Sibling: 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

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d9e09e1d456f757370127c14ed95820ba5def286 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks: the fix is one cancelQueries call on the live-frame write. That fixes the mechanism that let an older read overwrite a newer frame.

What this change ships

Inventory (3 items) — 2 justified

Intent: 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.

  1. A live autonudge_state frame now cancels any cold read for its slot that is still loading, so the late answer can't overwrite the frame or be carried into the sidebar by the seed — justified
  2. A regression test where a cold read lands after a stop frame and the chip stays gone — justified
  3. Two tests that pin fix(dashboard): keep loop chip when slot cold read lands mid-seed #24795's existing carry of running and stopped cold reads — rides along (tests only, no shipped surface)

[FIRST-PRINCIPLES-REVIEWED] d9e09e1

Description read

[DESCRIPTION-READ] d112c14dc77eb5b53c6634e8e6966123bfd3e6fdd8935218bc5f26b3a7d0132d

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 27, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of d9e09e1d456f757370127c14ed95820ba5def286 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 .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 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of d9e09e1d456f757370127c14ed95820ba5def286 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 .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 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] d9e09e1

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable d9e09e1d456f757370127c14ed95820ba5def286 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d9e09e1

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d9e09e1d456f757370127c14ed95820ba5def286 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 27, 2026
@iamwhatever
iamwhatever force-pushed the crew/issue-triage/fix-24787-seed-loop-chip branch from df4301c to b7e85e0 Compare October 27, 2026 12:51
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto main d069596, which carries the #24765 fix (PR #24774). New head b7e85e0. Targeted test website/src/test/useWebSocketGoalLoopSeed.test.ts passes 24/24; CI re-running.

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 27, 2026
@iamwhatever
iamwhatever force-pushed the crew/issue-triage/fix-24787-seed-loop-chip branch from b7e85e0 to d9e09e1 Compare October 27, 2026 13:29
@iamwhatever

iamwhatever commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: a live frame cancels any pending per-slot cold read before its cache write

  • span=6722c045372e Late cold reads can resurrect a loop stopped before reconnect

fixed in d9e09e1: onAutonudgeState now calls queryClient.cancelQueries({ queryKey: ['session-automation', slot] }) before writing the frame's record, so a cold read that started earlier cannot land after the frame and be carried by the seed.
React Query reverts a cancelled fetch synchronously in onCancel, before the frame's setQueryData, so the frame's record is what stays cached.
Test: does not let a cold read that lands after a stop frame restore the chip in website/src/test/useWebSocketGoalLoopSeed.test.ts; red with the cancel removed, green with it (25/25).

@github-actions github-actions Bot added 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: action required A blocking check or review needs attention labels Oct 27, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready at d9e09e1 (main c7189a8; base moved since in no file this PR touches). PR Readiness passed: 111 checks, 0 failing, label readiness: passed. GPT and Opus lanes ran on this head; the GPT finding 6722c045372e is answered as fixed. Design, First Principles and UX pass. The remaining gate is a maintainer review. Closes #24878; follows #24795.

🤖 AI-assisted comment 🤖

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 27, 2026 15:07

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@KiroCrewCaptain
KiroCrewCaptain merged commit d02d00d into main Oct 27, 2026
112 of 118 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the crew/issue-triage/fix-24787-seed-loop-chip branch October 27, 2026 15:10
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 27, 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.

Sidebar loop chip can reappear after stop when a cold read lands late Sidebar row drops loop chip that the chat header still shows

2 participants