handleSend can target the previous session during the navigation stale window #529
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
follow-up
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#529
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found during review of PR #520 (fix: keep session model on navigation). Pre-existing, not introduced by that PR — the PR fixed the same stale window for model seeding only.
When the URL session id flips, there is a one-commit window before
useSession's atomicloaddispatch replacessession/messages/parts. PR #520 guards the model-seed effect withsession?.id !== id(SessionDetail.tsx:787), buthandleSendstill readssession.id— so a message sent inside that window is delivered to the old session.Narrow race (requires sending within one render commit of navigating), but the failure is silent misdelivery of a user prompt.
Fix: have
handleSend(and any other mutation handlers readingsession.id) guard onsession?.id === idfrom the route, or use the routeiddirectly. A regression test can reuse the navigation harness added infrontend/src/pages/session-detail/modelSeed.test.tsx/harness.tsxfrom PR #520.