Skip to content

docs: --cwd routing flag, deterministic --wait/--background stripping, non-interactive resume guard - #591

Open
scompel wants to merge 1 commit into
openai:mainfrom
scompel:docs/cwd-routing-flag
Open

docs: --cwd routing flag, deterministic --wait/--background stripping, non-interactive resume guard#591
scompel wants to merge 1 commit into
openai:mainfrom
scompel:docs/cwd-routing-flag

Conversation

@scompel

@scompel scompel commented Aug 5, 2026

Copy link
Copy Markdown

Documents the --cwd routing flag on the rescue path (the companion task command already accepts it — valueOptions in codex-companion.mjs) so parallel rescue runs can target isolated git worktrees without colliding on files or job state; makes --wait/--background stripping explicit (observed agents occasionally forwarding --wait to task); skips the resume AskUserQuestion in non-interactive sessions (it blocks autonomous runs). Docs-only — no runtime change; commands suite 8/8, full suite matches baseline.

…d stripping, non-interactive resume guard

- Document --cwd <path> as a routing control on the rescue path in the
  agent, skill, and command docs: strip from task text, forward to task,
  scoping parallel rescue runs and --resume-last threads per worktree
- State explicitly that --background/--wait are Claude-side execution
  controls that are always stripped and never forwarded to task
- Skip the resume-candidate AskUserQuestion in non-interactive sessions
  or when --cwd is present; route as --fresh unless --resume was given

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@scompel
scompel requested a review from a team August 5, 2026 00:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82ec7206db

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

- `--cwd <path>` is a routing flag. Preserve it for the forwarded `task` call as `--cwd <path>`, but do not treat it as part of the natural-language task text. It targets the Codex run at a specific working tree (typically an isolated git worktree) so parallel rescue runs never collide; the companion's job state and `--resume-last` threads are scoped per `--cwd` repository root.
- If the request includes `--resume`, do not ask whether to continue. The user already chose.
- If the request includes `--fresh`, do not ask whether to continue. The user already chose.
- If the session is non-interactive (no human available to answer a question) or the request includes `--cwd`, do not ask whether to continue. Route as `--fresh` unless `--resume` was given.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve cwd-scoped resume checks

When the user targets a worktree and gives a follow-up such as /codex:rescue --cwd ../wt continue, this new rule forces the command to add --fresh unless the user also typed --resume, so the subagent's existing “continue/keep going” heuristic is suppressed and Codex starts a new thread instead of resuming the latest task for that --cwd root. The companion helper already accepts --cwd for task-resume-candidate, so the command should check the candidate in the routed worktree (or only force fresh for truly non-interactive sessions) rather than making all --cwd follow-ups fresh by default.

Useful? React with 👍 / 👎.

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.

2 participants