Skip to content

fix(agents): bind reads to route and session lifetimes - #3338

Open
Chris0Jeky wants to merge 6 commits into
mainfrom
audit/3337-agent-read-ownership
Open

Chris0Jeky wants to merge 6 commits into
mainfrom
audit/3337-agent-read-ownership

Conversation

@Chris0Jeky

@Chris0Jeky Chris0Jeky commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Closes #3337.

Summary

Binds the three agent read surfaces to explicit route and session lifetimes:

  • profiles, run lists and run details have independent request-owner lanes;
  • a newer request retires only the previous owner in the same lane;
  • A-old → B → A-new cannot let old A overwrite newer A;
  • clearRuns() and clearRunDetail() synchronously invalidate their pending lane;
  • user identity, authentication or demo-session replacement advances an epoch and clears all agent data;
  • same-user token rotation advances that request epoch and retires old work, but preserves already loaded route data;
  • stale successes, failures, toasts and finally settlement cannot alter the replacement lifetime;
  • independent lanes remain concurrent with truthful per-lane loading;
  • demo mode retains its no-network behavior.

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: 307c3b8b50bec1cb0bfaea3e570a942bcb1d4451

Initial test-only head ae52930c6eb5d5b80a2f6a7347242f4ad60a0036 ran 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 finally versus 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 cff0fda917582af4e9be58a4330e0dbea86f280e found that treating every token refresh as a full session reset blanked unchanged Agent routes.

Review-regression head 7b6e137d9625ee6b2ba6ad747a4fdecc5fabe172 added 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 refresh

The 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: c48346128982366c0abdf4f1f766246f5cc351dc

  • Smart CI Self-Test 35626913814: success.
  • CI Extended 35626914280: success.
  • Required CI 35626914346: success across the complete repository matrix, including frontend lint, typecheck, production build and full tests on Ubuntu and Windows.
  • The original review thread was answered with the reproducing RED evidence and resolved after the correction.

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.

@Chris0Jeky
Chris0Jeky marked this pull request as ready for review September 21, 2026 15:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-21T17:19:33.392891Z c483461 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread frontend/taskdeck-web/src/store/agentStore.ts Outdated
@Chris0Jeky
Chris0Jeky marked this pull request as draft September 21, 2026 15:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +96 to +99
watch(
() => session.token,
invalidateReads,
{ flush: 'sync' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending

Development

Successfully merging this pull request may close these issues.

Agent reads can repopulate cleared or replacement-session state

1 participant