Fix fresh-agent resume pane repair#354
Conversation
Ported from ca8c188.
Ported the fresh-agent portions of bf59a03. Excluded Codex durability hunks that require the later durability subset.
Ported from ce6bb53. Excluded adjacent Codex durability dependencies from the stale dev stack.
Ported the canonical fresh-agent recovery portions of 9290e5f. Excluded sidebar live-terminal and Codex durability adjacent hunks for the later durability subset.
Port the fresh-agent canonical recovery portion of bf4f948. Exclude OpenCode lab-note churn and unrelated tabs range behavior from the stale dev-stack carrier.
Port the fresh-agent production runtime and replay-cache cleanup portions of 0dea351. Exclude Codex durability cleanup, sidecar deletion, launch-retry tests, and plan/doc residue from the stale carrier.
Remote legacy agent-chat snapshots now reopen as fresh-agent tabs while preserving the Claude mode from the source record.
Carry the canonical recovery prerequisite from e333d1a so copied legacy agent-chat panes can recover from UUID resumeSessionId values. This is limited to Claude canonical identity promotion and does not include Codex durability or OpenCode behavior.
Align shared session-contract coverage with canonical agent-chat resumeSessionId promotion carried for the fresh-agent recovery subset.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e191d2e7af
ℹ️ 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".
| (content.kind === 'agent-chat' || content.kind === 'fresh-agent') | ||
| && content.resumeSessionId === sessionId | ||
| && ( | ||
| content.kind === 'agent-chat' | ||
| ? resolvedProvider === 'claude' | ||
| : content.provider === resolvedProvider |
There was a problem hiding this comment.
Match fresh-agent repair by session identity, not provider
This implicit match gate prevents repairing the exact provider-mismatch case when a pane only has resumeSessionId (no canonical sessionRef, which is common in legacy/restored data). findTabIdForSession can still find the tab via sessionType, but repairExistingTabLayout then rejects the leaf because content.provider is wrong, so the pane is never rewritten to desiredResumeContent and users keep a broken pane/duplicate reopen path.
Useful? React with 👍 / 👎.
| provider, | ||
| resumeSessionId, | ||
| ...(sessionRef ? { sessionRef } : {}), | ||
| serverInstanceId: record.serverInstanceId, |
There was a problem hiding this comment.
Clear remote server instance when sanitizing fresh-agent panes
For reopened history from another server, this always stamps the remote serverInstanceId into the new local pane. Session matching later filters out candidates whose server instance differs from local, so even panes with a valid sessionRef stop being discoverable as existing session tabs and repeated opens create duplicates. The adjacent agent-chat migration path already avoids this by only carrying serverInstanceId on same-server restores.
Useful? React with 👍 / 👎.
…replacement/fresh-agent-canonical-recovery-main-20260518
…8' into codex/fresh-agent-resume-pane-repair-main-20260518
Summary
6e03da80onto the fresh-agent dependency stack.sessionRefwhen creating resumed tabs and terminal panes frombuildResumeContent.Dependencies
replacement/fresh-agent-foundation-main-20260518).replacement/fresh-agent-canonical-recovery-main-20260518).Tests
npm run test:vitest -- test/unit/client/store/tabsSlice.test.ts --runnpm run typechecknpm run buildNotes