Skip to content

fix(server): release compatible writers before cross-instance resume - #9211

Open
BranislavMateas wants to merge 1 commit into
pingdotgg:mainfrom
BranislavMateas:feature/fix/release-compatible-writer
Open

fix(server): release compatible writers before cross-instance resume#9211
BranislavMateas wants to merge 1 commit into
pingdotgg:mainfrom
BranislavMateas:feature/fix/release-compatible-writer

Conversation

@BranislavMateas

@BranislavMateas BranislavMateas commented Sep 2, 2026

Copy link
Copy Markdown

What Changed

When resuming a thread on another compatible Codex provider instance, T3 Code now:

  • reuses the persisted resume cursor
  • stops the previous provider session before starting the replacement
  • preserves the existing Codex thread and its context

Added a regression test covering account switching while the original session still owns the Codex thread.

Why

Codex allows only one active writer per thread. T3 Code previously started the replacement session before stopping the original one, causing an already has an active writer error. A retry could then create a fresh Codex thread and lose the conversation context.

Compatible provider instances share the same continuation identity, so releasing the previous writer before resuming is safe and keeps the thread intact.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • No UI changes
  • No animation or interaction changes

Note

Release compatible writers before cross-instance resume in ProviderService.startSession

Allows a persisted session to resume on a different compatible provider instance by matching on driver kind and continuation identity rather than requiring identical instance IDs.

  • When resuming with a persisted cursor across instances, retrieves the previous adapter, checks whether it still owns the thread, stops that session, and records a session-stopped analytics event before starting the new instance.
  • Preserves the resume cursor and working directory for compatible cross-instance resumes.
  • Adds an integration test in ProviderService.test.ts using two fake Codex adapters to verify the personal session is stopped before the work session starts.
  • Risk: cross-instance resume now depends on correct compatibility detection via driverKind and continuation identity; a false positive could stop a live session on the wrong adapter.

Macroscope summarized c7bc29b.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 2, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at c7bc29b

Macroscope's review found this PR approvable — This is a small, localized server bug fix that safely sequences compatible provider-session replacement while preserving continuation state. The new behavior is covered by a targeted regression test, with no schema, deployment, default, or sensitive-package changes.

You can add or adjust custom eligibility rules. Learn more.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant