codex - 💡(How to fix) Fix Codex App Remote SSH new worktree does not run local environment setup script

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When using Codex App against a Remote SSH project, creating a new worktree thread with an environment configured in the remote repository does not run that environment.toml setup script at all.

To avoid ambiguity: by "environment" here I mean Codex's Local environments feature, but in this reproduction the environment.toml being modified is in the repository on the remote SSH host, not on my local client machine.

I confirmed this with a minimal setup script that only appends diagnostics to /tmp on the remote host. The new worktree/thread is created, but the log file is never written, so this looks like the setup script is not invoked for the Remote SSH + New worktree path, rather than a failure inside the script.

Root Cause

When using Codex App against a Remote SSH project, creating a new worktree thread with an environment configured in the remote repository does not run that environment.toml setup script at all.

To avoid ambiguity: by "environment" here I mean Codex's Local environments feature, but in this reproduction the environment.toml being modified is in the repository on the remote SSH host, not on my local client machine.

I confirmed this with a minimal setup script that only appends diagnostics to /tmp on the remote host. The new worktree/thread is created, but the log file is never written, so this looks like the setup script is not invoked for the Remote SSH + New worktree path, rather than a failure inside the script.

Code Example

{
  echo "=== codex setup $(date) ==="
  echo "pwd=$PWD"
  echo "whoami=$(whoami)"
  echo "git_root=$(git rev-parse --show-toplevel 2>/dev/null || true)"
  env | grep -E '^(CODEX|SSH|SHELL|PWD|HOME)=' | sort
} >> /tmp/codex-setup-debug.$USER.log 2>&1

---

tail -n 200 /tmp/codex-setup-debug.$USER.log
RAW_BUFFERClick to expand / collapse

Summary

When using Codex App against a Remote SSH project, creating a new worktree thread with an environment configured in the remote repository does not run that environment.toml setup script at all.

To avoid ambiguity: by "environment" here I mean Codex's Local environments feature, but in this reproduction the environment.toml being modified is in the repository on the remote SSH host, not on my local client machine.

I confirmed this with a minimal setup script that only appends diagnostics to /tmp on the remote host. The new worktree/thread is created, but the log file is never written, so this looks like the setup script is not invoked for the Remote SSH + New worktree path, rather than a failure inside the script.

Expected behavior

If an environment from the remote repository is selected when starting a new worktree thread, Codex should run that environment's setup script before the thread starts using the new worktree.

This is also the behavior implied by the Local environments and Worktree documentation: setup scripts are expected to run when Codex creates a new worktree / starts a new thread with a selected environment. Since Codex App Remote SSH threads run against the remote filesystem and shell, the selected repo environment should be applied there too.

Actual behavior

The new worktree is created and the thread starts, but the selected environment's setup script is never called.

A diagnostic setup script like this produces no output on the remote host:

{
  echo "=== codex setup $(date) ==="
  echo "pwd=$PWD"
  echo "whoami=$(whoami)"
  echo "git_root=$(git rev-parse --show-toplevel 2>/dev/null || true)"
  env | grep -E '^(CODEX|SSH|SHELL|PWD|HOME)=' | sort
} >> /tmp/codex-setup-debug.$USER.log 2>&1

After creating a Remote SSH new worktree thread and selecting that repository environment, checking the remote host with:

tail -n 200 /tmp/codex-setup-debug.$USER.log

shows that no setup log was written.

Reproduction steps

  1. Open Codex App.
  2. Connect to a project through Remote SSH.
  3. On the remote SSH host, modify the repository's environment configuration (environment.toml) so its setup script writes to /tmp, for example the script above.
  4. From that Remote SSH project, create a new worktree thread.
  5. Select that repository environment for the new worktree thread.
  6. Wait for the thread to start.
  7. On the remote host, inspect /tmp/codex-setup-debug.$USER.log.

Result

No log entry is created. The setup script appears not to be invoked at all.

Related issues

This seems related to other cases where new worktree flows do not correctly carry environment or project-local configuration:

  • #18981: New handoff to worktree doesn't use environments
  • #22545: Codex App Remote SSH new worktree does not discover repo-local skills

Possibly related setup/environment issues:

  • #10543
  • #11223

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

If an environment from the remote repository is selected when starting a new worktree thread, Codex should run that environment's setup script before the thread starts using the new worktree.

This is also the behavior implied by the Local environments and Worktree documentation: setup scripts are expected to run when Codex creates a new worktree / starts a new thread with a selected environment. Since Codex App Remote SSH threads run against the remote filesystem and shell, the selected repo environment should be applied there too.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING