fix(agents): bind reads to route and session lifetimes - #3338
Chris0Jeky wants to merge 6 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cff0fda917
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c483461289
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| watch( | ||
| () => session.token, | ||
| invalidateReads, | ||
| { flush: 'sync' }, |
There was a problem hiding this comment.
Retry initial reads after token rotation
When Extend Session completes while an Agent route's initial read is still pending, this watcher removes that request's ownership and turns off loading; its eventual result is then ignored, but AgentsView, AgentRunsView, and AgentRunDetailView do not issue another read until mount or a route-parameter change, so the unchanged route displays a false empty/blank state. Fresh evidence in the corrected head is that the new refresh regression seeds every surface with existing data before rotating the token, leaving the first-load-empty case uncovered. Preserve same-user in-flight reads or restart them under the new token.
AGENTS.md reference: frontend/AGENTS.md:L6-L7
Useful? React with 👍 / 👎.
Closes #3337.
Summary
Binds the three agent read surfaces to explicit route and session lifetimes:
clearRuns()andclearRunDetail()synchronously invalidate their pending lane;finallysettlement cannot alter the replacement lifetime;The original transport promise still resolves or rejects to its caller. This does not claim to cancel a request already sent to the server.
Test-first evidence
Base:
307c3b8b50bec1cb0bfaea3e570a942bcb1d4451Initial test-only head
ae52930c6eb5d5b80a2f6a7347242f4ad60a0036ran the full frontend suite on Ubuntu and Windows. Both platforms passed lint, typecheck, production build and PWA validation, then failed in the new real Pinia suite.Ubuntu JUnit recorded 7,159 tests, 8 failures, 0 errors. The eight failing schedules were reverse-settling profiles, A-old → B → A-new runs, repeated run-detail identity, route clear before late success/failure, old
finallyversus newer loading, full session replacement, and stale failure after same-user relogin. The independent-lane control passed; Windows reproduced the same test-only failure set.Review correction
Codex review on
cff0fda917582af4e9be58a4330e0dbea86f280efound that treating every token refresh as a full session reset blanked unchanged Agent routes.Review-regression head
7b6e137d9625ee6b2ba6ad747a4fdecc5fabe172added the exact session-extension schedule. Ubuntu again passed lint, typecheck, build and PWA validation. Its JUnit artifact ran all 10 ownership cases and failed only:preserves loaded route data while invalidating old-token reads on refreshThe observed value was
[]instead of the retained['existing']run list.The correction separates full identity/auth/demo reset from token-only request invalidation. Old-token success and failure settlements remain unable to patch or toast after rotation while loaded route data stays visible.
Exact-head verification
Exact current head:
c48346128982366c0abdf4f1f766246f5cc351dc35626913814: success.35626914280: success.35626914346: success across the complete repository matrix, including frontend lint, typecheck, production build and full tests on Ubuntu and Windows.Ready for repeat independent review. Review should focus on the identity/token distinction, route-clear ownership, preserved caller settlement and independent-lane concurrency. Green CI is qualification evidence, not merge authorization.
No API, DTO, route, schema, dependency, workflow or backend change. This concerns truthful client state, not a demonstrated server authorization bypass.