A late poll answer no longer overwrites a newer one on a session page (#932) #933

Merged
claude-bot merged 2 commits from fix/session-stale-poll into main 2026-09-29 12:53:38 +00:00
Collaborator

Closes #932.

J5 failed on #926's CI: after Withdraw, The recording still read "Approved" (desktop, j5-after-the-session.spec.js:402). The phone and keyboard failures after it were a cascade, because the projects share one database.

Cause. useAsync.run keeps an overtaken answer out of its own state but still returns it, and useSessionData drew whatever came back. The review page polls the session every 15 s while the wiki run is going, and that run starts at approval. So a poll that left before the withdrawal and landed after the page's refresh put the approved session back until the next poll. This is a real bug: any GM action during a poll could be visually undone for up to 15 s.

Fix. useSessionData counts its reads, and only the newest may draw the page.

Tests

  • New useSessionData.test.jsx reproduces the race. It fails without the fix ("expected true to be false") and passes with it.
  • src/pages/session: 455 pass; eslint is clean.

Changelog: changelog.d/932-session-stale-poll.fixed.md.

🤖 Generated with Claude Code

Closes #932. J5 failed on #926's CI: after **Withdraw**, The recording still read "Approved" (desktop, `j5-after-the-session.spec.js:402`). The phone and keyboard failures after it were a cascade, because the projects share one database. **Cause.** `useAsync.run` keeps an overtaken answer out of its own state but still **returns** it, and `useSessionData` drew whatever came back. The review page polls the session every 15 s while the wiki run is going, and that run starts at approval. So a poll that left before the withdrawal and landed after the page's refresh put the approved session back until the next poll. This is a real bug: any GM action during a poll could be visually undone for up to 15 s. **Fix.** `useSessionData` counts its reads, and only the newest may draw the page. **Tests** - New `useSessionData.test.jsx` reproduces the race. It fails without the fix ("expected true to be false") and passes with it. - `src/pages/session`: 455 pass; eslint is clean. Changelog: `changelog.d/932-session-stale-poll.fixed.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
useAsync keeps an overtaken answer out of its own state but still returns
it, and useSessionData drew whatever came back. A 15-second poll that left
before Withdraw and landed after the page's refresh put "Approved" back
until the next poll — J5 caught it on #926's CI. useSessionData now counts
its reads and only the newest draws the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge remote-tracking branch 'origin/main' into fix/session-stale-poll
All checks were successful
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m57s
CI / Bot tests and audit (pull_request) Successful in 1m59s
CI / Backend lint (ruff) (pull_request) Successful in 1m3s
CI / Bot/backend version sync (pull_request) Successful in 30s
CI / Feedback site tests (pull_request) Successful in 47s
CI / Does this change touch the recording path? (pull_request) Successful in 23s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Has been skipped
CI / Docker image build (pull_request) Successful in 50s
CI / End-to-end journeys (desktop, phone, keyboard-only) (pull_request) Successful in 18m57s
CI / Frontend tests, audit, and build (pull_request) Successful in 40m47s
CI / Backend migration, tests, and audit (pull_request) Successful in 40m14s
40f535eeed
Sign in to join this conversation.
No description provided.