Skip to content

fix(agent): keep cloud credentials in secondary checkouts#3625

Merged
trunk-io[bot] merged 1 commit into
mainfrom
agent/codex-refresh-github-token-all-workdirs
Jul 21, 2026
Merged

fix(agent): keep cloud credentials in secondary checkouts#3625
trunk-io[bot] merged 1 commit into
mainfrom
agent/codex-refresh-github-token-all-workdirs

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem

Cloud Codex sessions receive refreshed GitHub credentials through BASH_ENV, but Codex restores its captured shell snapshot only when a tool call uses the thread's initial working directory. A shell launched directly in a secondary checkout can therefore lose gh authentication even while the refreshed credential file is valid.

Changes

  • Pin the backend-controlled BASH_ENV path in Codex's shell environment policy for managed sandbox sessions.
  • Pass the exact spawned process environment into argument construction.
  • Leave non-sandbox Codex sessions unchanged.

The backend half of the credential refresh path is in PostHog/posthog#72540.

@trunk-io

trunk-io Bot commented Jul 21, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 3bfedf6.

@tatoalo tatoalo self-assigned this Jul 21, 2026
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 21, 2026
@tatoalo
tatoalo marked this pull request as ready for review July 21, 2026 13:04

@github-actions github-actions 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.

Small, well-tested fix that propagates a sanitized env into buildAppServerArgs; the BASH_ENV value is safely escaped via the existing tomlBasicString helper and the new code path is guarded by the IS_SANDBOX check. No showstoppers.

@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(agent): keep cloud credentials in se..." | Re-trigger Greptile

@tatoalo
tatoalo requested a review from a team July 21, 2026 13:37
@trunk-io
trunk-io Bot merged commit b62749f into main Jul 21, 2026
39 checks passed
@trunk-io
trunk-io Bot deleted the agent/codex-refresh-github-token-all-workdirs branch July 21, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant