GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): fork Codex threads with active writers by f-trycua · Pull Request #7414 · pingdotgg/t3code

Conversation

@f-trycua

@f-trycua f-trycua commented Aug 18, 2026 •
edited by juliusmarminge
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Problem

Codex rejects thread/resume when another app-server process already owns the thread writer. T3 currently stops the session and surfaces the provider stack trace, even though Codex can branch the conversation safely.

Fix

Detect the specific active-writer response and call thread/fork with the requested working directory, model, service tier, approval policy, and sandbox mode. T3 then stores the forked thread ID and continues from the persisted conversation history. Missing-thread fallback and unrelated resume failures keep their existing behavior.

Tests

  • vp test run apps/server/src/provider/Layers/CodexSessionRuntime.test.ts
  • vp run --filter ./apps/server typecheck
  • targeted lint and format checks for both changed files

Model: gpt-5.6-sol
Harness: T3 Code Codex


Note

Medium Risk
Changes Codex session open/resume behavior on a specific provider error path; incorrect detection could fork when a fresh start was intended, but scope is narrow and covered by tests.

Overview
When thread/resume fails because another Codex app-server process already holds the thread writer, the server no longer surfaces a fatal error. It detects that case via isThreadActiveWriterError, logs a warning, and calls thread/fork with the session’s cwd, runtime mode (approval policy and sandbox), model, and optional service tier so the conversation can continue from persisted history under a new provider thread id.

Missing-thread and other recoverable resume failures still fall back to thread/start; unrelated resume errors are unchanged. Tests cover the detector, the resume→fork path, and existing fallback/propagation behavior.

Reviewed by Cursor Bugbot for commit e884bb3. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fork Codex threads when thread/resume fails with an active writer error

  • Adds isThreadActiveWriterError predicate in CodexSessionRuntime.ts that detects errors containing both 'thread' and 'already has an active writer'.
  • When thread/resume fails with this error, openCodexThread now calls thread/fork instead of failing or starting a fresh thread, preserving thread continuity.
  • CodexThreadOpenResponse and CodexThreadOpenMethod types are extended to include thread/fork.

Macroscope summarized e884bb3.

Closes #8259

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

andybergon, syrok0010, and Repressoh reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
@f-trycua
fix(server): fork Codex threads with active writers
e884bb3
@f-trycua f-trycua mentioned this pull request Aug 18, 2026
fix(server): fork Codex threads with active writers trycua/t3code#1
Closed
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8434e0b4-7e1a-4e2a-bb39-93e895cc8358

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 18, 2026
macroscopeapp[bot]
macroscopeapp Bot approved these changes Aug 18, 2026
View reviewed changes
@macroscopeapp

macroscopeapp Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at e884bb3

Macroscope's review found this PR approvable — Straightforward bug fix adding error recovery for 'active writer' conflicts by forking threads instead of failing. Follows existing error handling patterns in the same file, has limited scope, and includes comprehensive test coverage.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andybergon

andybergon commented Aug 24, 2026

Copy link
Copy Markdown

Hit this in the wild today on 0.0.34-nightly.20260824.1172 (macOS 26.6): every send to a Codex task failed with ProviderAdapterProcessError ... already has an active writer and the thread was stuck.

The other writer was ChatGPT Desktop's bundled app-server (26.818.41509, codex-cli 0.149.0-alpha.4.1). I had opened the T3-created thread in Desktop's thread list; lsof ~/.codex/thread-writer-locks/<id>.lock showed the Desktop process holding it. Closing the tab there didn't release it, quitting Desktop did. Upstream tracking is openai/codex#37403.

So the fork fallback here is the right call, since Desktop won't hand the lock back while it's running. One thing worth surfacing in the UI: after a fork the T3 task continues on a new thread id, so anything sent to the old thread from Desktop afterward won't appear in T3. A short note in the chat that the thread was forked because another app owned it would make that divergence visible instead of silent.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andybergon andybergon mentioned this pull request Aug 24, 2026
[macOS][regression] Desktop cannot resume Remote Control / CLI thread: already has an active writer after latest update openai/codex#37403
Open
@rauleburro rauleburro mentioned this pull request Aug 26, 2026
feat(codex): continue provider threads across clients bellbirdpy/t3code#1
Merged
12 tasks done
@ElliotDrel

ElliotDrel commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Hitting this today on the current stable Windows build, multi-account Codex setup (shared CODEX_HOME + shadow home for a second account). Switching accounts mid-thread reliably throws:

ProviderAdapterProcessError: Provider adapter process error (codex) for thread <redacted>: thread <redacted> already has an active writer

Matches the fix described here exactly — the first account's app-server process is still holding the writer lock when the second account's process tries thread/resume on the same thread. Would love to see this merged; right now the only workaround is avoiding mid-thread account switches or manually disabling the first provider to force its process to exit and release the lock.

+1 for merging.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@t3-code-bot

t3-code-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

closing this version as part of a pr cleanup at the request of @StiensWout.

automatically forking on an active-writer conflict changes the native conversation identity without a user-facing explanation. recovery is useful, but the fork and resulting divergence should be explicit to the user, with a recovery choice where appropriate, rather than only recorded in a server log.

thanks for the contribution. if you disagree with this decision, you are welcome to open a new pr, link back to this one, and explain how your proposal addresses these concerns or why a different approach is warranted.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@t3-code-bot t3-code-bot Bot closed this Sep 8, 2026
@derektrimm derektrimm mentioned this pull request Oct 17, 2026
fix(server): Codex threads open in another client are no longer silently replaced #21045
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: Switching Codex provider instances can leave a thread stuck on "already has an active writer"

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@f-trycua @andybergon @ElliotDrel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.