Skip to content

Restore Fork Chat for API key users with a Codex plugin - #58

Open
Dandelion011 wants to merge 2 commits into
openai:mainfrom
Dandelion011:codex/fork-chat-fixed-plugin
Open

Dandelion011 wants to merge 2 commits into
openai:mainfrom
Dandelion011:codex/fork-chat-fixed-plugin

Conversation

@Dandelion011

@Dandelion011 Dandelion011 commented Nov 18, 2026 •

Copy link
Copy Markdown

What this adds

Restores Fork Chat in Codex desktop when using API key authentication without a ChatGPT sign-in. In this mode, built-in Fork Chat can remain stuck at execution-config-loading because its Statsig sidebar gate is unavailable (openai/codex#59308). This Codex plugin forks local chats directly through a UserPromptSubmit hook and the local App Server. Entering exactly forkchatfixed forks into the current directory; forkchatinnewworktreefixed creates a detached Git worktree with tracked changes and untracked files, records the chat owner, and forks into that directory. The trigger is handled before a model turn.

This hook package is for manual installation through a local/GitHub marketplace; lifecycle-hook plugins are not eligible for the public plugin directory.

Actions, data, and requirements

The Node hook starts the local codex app-server, calls thread/turns/list, thread/read when needed, and thread/fork. For new worktrees it runs local Git commands (rev-parse, worktree add, diff, apply, ls-files), reads tracked changes and untracked files, writes the new checkout plus its local owner metadata under CODEX_HOME/worktrees, and opens the resulting codex://threads/ URL with Windows PowerShell. It makes no plugin-originated network requests and does not store credentials. The app/server retains its usual authentication behavior. Requirements: local Codex desktop, Node.js, and Git with an existing commit for the worktree command. Outside Windows, the generated URL may need to be opened manually.

To try: install forkbuggedchat from the marketplace, trust the hook in /hooks, restart Codex, then send one of the two exact words in an existing local chat. To check the safe non-trigger path, send forkchatfixed (with a trailing space); the hook exits without creating a fork. A Git or App Server error is reported in the original chat. A failed operation may leave a new worktree directory for inspection.

Verification

  • npm run validate:marketplace — passed.
  • npm run test:forkbuggedchat — passed, including exact-match rejection, both fork request shapes, worktree contents and owner metadata against a stub App Server.
  • npm run test:marketplace:runner — passed.
  • Desktop sidebar and account-mode integration have not been tested end to end; the Windows CI job runs the plugin master suite on Node 22.19, 24 and 26. Repository-wide npm run test:marketplace was not run locally because it also invokes unrelated plugin suites.

Apache-2.0 license included with the plugin. No third-party code or runtime dependency is added.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Dandelion011

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Nov 18, 2026
@Dandelion011 Dandelion011 changed the title Add direct fork chat plugin with new-worktree support Restore Fork Chat for API key users with a Codex plugin Nov 18, 2026
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