Set environment variable through Local environments

Open 💬 1 comment Opened Feb 3, 2026 by amit-mittal

What version of Codex is running?

260202.0859 (517)

What subscription do you have?

Enterprise

Which model were you using?

GPT-5.2-Codex

What platform is your computer?

MacOS

What terminal emulator and version are you using (if applicable)?

_No response_

What issue are you seeing?

I am using Codex MacOS app's local environment to setup an environment variable to the location of the worktree, but it is not working. The environment variable still points to the original root.

What steps can reproduce the bug?

tools/bin/setup-git-worktree.sh

repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [[ -z "${repo_root}" ]]; then
  echo "Error: unable to determine repo root with git rev-parse --show-toplevel" >&2
  return 1
fi

export MY_ROOT="${repo_root}"

environment.toml

[setup]
script = "source tools/bin/setup-git-worktree.sh"

What is the expected behavior?

I expect MY_ROOT to be set to ~/.codex/worktrees/<git-id>/<repo>, but it is not set if I ask Codex to emit the value of MY_ROOT.

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗