Skip to content

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

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

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

Conversation

@Chris0Jeky

@Chris0Jeky Chris0Jeky commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Closes #3337. Related residual: #3352.

Summary

Binds agent profiles, run lists and run detail to independent read owners and explicit session lifetimes:

  • newer work retires only the previous owner in the same lane;
  • A-old → B → A-new and route-clear settlement cannot restore obsolete state;
  • user identity, authentication or demo replacement clears all agent data and retires work;
  • same-user token rotation preserves settled data and suppresses old-token settlement;
  • active lanes whose visible surface is still empty are restarted under the new token with the exact captured profile/run parameters;
  • loaded lanes are not refetched merely because the token changed;
  • route-clear helpers remove retry ownership;
  • no mutation is replayed.

Test-first evidence

Initial test-only head ae52930c6eb5d5b80a2f6a7347242f4ad60a0036 reached canonical Ubuntu/Windows frontend qualification and produced only the intended ownership failures. Review-regression head 7b6e137d9625ee6b2ba6ad747a4fdecc5fabe172 isolated loaded-data preservation. Corrected head c48346128982366c0abdf4f1f766246f5cc351dc then passed Smart CI, Extended and the complete Required CI matrix.

Repeat Codex review found that an empty first-load route could still be stranded. Test-only head 11ab87461ed4773b99af8e35a6625873a52e2425 adds one deferred real-Pinia case spanning profiles, runs and detail.

A dependency-free runner transpiled and executed the actual production module:

  • before the retry correction: each API was called once and all loading flags became false after token rotation;
  • after the correction: each API was called twice, old-token settlement was suppressed and fresh-token results populated all three lanes.

This supplemental runner does not replace hosted project qualification.

Current head and remaining gates

Exact final head: a2c9b57f46c72e1d22512f33563d77dfd4eb4dcf

Keep draft until this exact head passes Smart CI, Extended and the complete Required CI matrix on Ubuntu and Windows, then receives repeat independent review. The open Codex first-load thread remains unresolved until that evidence exists.

No API, DTO, route, schema, dependency, workflow or backend change. This is client-state integrity, not transport cancellation or a server-authorization claim.

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

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Confirmed and corrected. Test-only head 11ab874 adds a deferred real-Pinia schedule that starts empty profile, run-list, and run-detail reads, rotates the token for the same user, and requires all three lanes to restart under the new token while old settlements remain suppressed.

A bounded runner transpiled and executed the actual production module: before correction each API was called once and loading dropped false after rotation; current source retries each empty active lane, preserves exact run/detail parameters, suppresses old settlement, and installs fresh-token results. Exact final head is a2c9b57; hosted Self-Test, Extended, Required CI, and repeat review are still pending, so the PR remains draft and this thread remains open.

@Chris0Jeky
Chris0Jeky marked this pull request as draft September 21, 2026 17:26
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