openai / openai/codex-plugin-cc
codex-rescue: forward intended worktree cwd to detached task
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 33.3k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
Problem
A coding task launched through the Claude codex:codex-rescue forwarder can be instructed to work in a secondary worktree, but the forwarder launches the companion task from Claude's current/main checkout. The prompt-level cd instruction is only advisory, so Codex may root its workspace in and dirty the main checkout.
This happened during a multi-worktree Command Center session: the detached task edited the main checkout for roughly 20 minutes before self-relocating, and the dirty main later blocked the repository's post-merge fast-forward sync.
Original report: https://github.com/gr-ai-labs/message-assistant/issues/889
Current behavior
plugins/codex/agents/codex-rescue.md invokes:
node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" task ...
The companion already accepts task --cwd <path> and uses that cwd for the worker and workspace root, but the rescue command/agent has no routing argument for an intended worktree and therefore does not pass it.
Suggested approach
Add an explicit rescue routing control for the target checkout/worktree (for example --cwd <path>), validate/resolve it before launch, and pass it to codex-companion.mjs task --cwd .... Keep the cwd out of the natural-language task prompt.
Acceptance criteria
- A rescue-forwarded coding task targeted at a worktree is rooted at that worktree by the runtime.
- The task cannot dirty the caller's main checkout merely because Claude was launched there.
- Foreground and detached/background task paths preserve the selected cwd.
- A regression test covers a caller cwd different from the target worktree.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with plugins/codex/agents/codex-rescue.md and scripts/codex-companion.mjs, then trace how task --cwd is handled for worker and workspace setup. Add routing for the intended worktree without putting cwd in the prompt, preserving foreground and detached paths. Done means a regression test proves a caller cwd different from the target worktree leaves the main checkout clean.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100