Skip to content

fix: reset Run-scoped UI state on selection changes - #7

Merged
pppolf merged 1 commit into
mainfrom
agent/reset-run-scoped-ui-state
Aug 12, 2026
Merged

pppolf merged 1 commit into
mainfrom
agent/reset-run-scoped-ui-state

Conversation

@pppolf

@pppolf pppolf commented Aug 12, 2026

Copy link
Copy Markdown
Member

What changed

  • remount the selected Run workspace when the Run identity changes
  • remount the selected Session workspace when the Session identity changes
  • add regression coverage proving drafts and uncertain operation state are cleared across both identity transitions
  • verify that a draft from Run/Session A cannot be submitted against Run/Session B

Why

React reused the same workspace component instance when only runID or sessionID changed. Run-scoped local state—including unsent message drafts, mutation results, cancellation inputs, and in-memory retry/idempotency state—could therefore survive a sidebar selection change. The newly selected resource supplied the next render's API binding, so an old draft could be accidentally submitted to the wrong Run or Session.

Keying each top-level workspace by its selected identity makes React tear down the old resource scope before rendering the next one. It also aborts/unsubscribes child effects through their normal cleanup paths.

Impact

Switching between Runs or Sessions now starts with a clean resource-scoped UI. Drafts and uncertain local operation state cannot cross the identity boundary.

Validation

Run with the repository CI Node version (Node 24):

  • vitest run src/App.test.tsx — 3 passed
  • full vitest run — 55 files / 213 tests passed
  • tsc -b --pretty false
  • npm run check:api
  • Vite production build
  • git diff --check

@pppolf
pppolf marked this pull request as ready for review August 12, 2026 10:19
@pppolf
pppolf merged commit b1c1a98 into main Aug 12, 2026
4 checks passed
@NanaseInori
NanaseInori deleted the agent/reset-run-scoped-ui-state branch September 16, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant