Skip to content

fix(runtime): preserve SOP Git credentials in Codex tool shells - #1262

Open
zonemeen wants to merge 2 commits into
Tencent:mainfrom
zonemeen:fix/codex-sop-git-credentials
Open

zonemeen wants to merge 2 commits into
Tencent:mainfrom
zonemeen:fix/codex-sop-git-credentials

Conversation

@zonemeen

Copy link
Copy Markdown

What changed

Refs #1249

A Codex SOP node could have a valid HTTPS credential for its Git host and
still fail on git push. The Codex process received the credential helper
configuration, but its tool shell lost the settings needed to use it.

Build the tool shell's environment allowlist after both HTTPS and SSH are
bound. This passes the host-scoped helper settings and every indexed Git
config entry, including SSH URL rewrites. It also fixes git status failing
with missing config key GIT_CONFIG_KEY_2 in mixed HTTPS/SSH repositories.

The relay URL and Git token stay out of the Codex command line.

Scope

  • Platform core / API / runner
  • Public adapter / deployment
  • Classic
  • Portable
  • Shared behavior contract
  • Installer / CLI
  • Documentation only

Compatibility

This change applies to Codex SOP nodes on platform-managed sandboxes and
standalone runners. It requires no database migration or runner protocol
update. The Dockerfile still pins Codex CLI 0.162.1.

Two known issues remain before merge:

  • When a Git author identity is bound, the generated system Git config can
    hide the image's http.sslCAInfo setting and break HTTPS access to a
    repository that uses an internal CA.
  • On native runners, the new allowlist can drop build variables explicitly
    set in the user's Codex shell_environment_policy.set configuration.

Validation

Tested commit 21b91f5 on Docker Desktop with Linux/arm64. The original
verification used Codex CLI 0.162.1. The following four cases passed on
0.171.0, the latest stable release as of 2026-11-23. Each tool shell checked
its own codex --version.

Execution path HTTPS only HTTPS + SSH
Platform-managed sandbox Passed Passed
Standalone runner Passed Passed

All four cases ran git status, git ls-remote, and an authenticated HTTPS
push. An unconfigured host received no credential even with a pre-existing
repository helper. In both mixed cases, SSH returned the same commit SHA
that had been pushed over HTTPS. The model-response endpoint was a local
fixture. The tests used the actual Codex CLI, Git, TLS, and SSH.

  • Passed go test -race -count=1 ./internal/runtime -run '^TestCodexSOPGitBindingKeepsHelperInToolShell$'.
  • Passed go vet ./internal/runtime ./internal/runner.
  • The full runtime and runner package tests had three failures. Two runner
    timeouts passed on targeted rerun. The conversation output-quota failure
    also reproduced on the preceding commit.
  • In a separate macOS-hosted runner check, HTTPS push passed. Docker Desktop
    could not use the macOS SSH agent socket through a bind mount.
  • The full repository Go suite and public browser acceptance suite were not
    rerun on the final commit.

Safety

  • I did not include credentials, internal endpoints, production data, or organization-specific infrastructure.
  • I preserved user files and unrelated changes.
  • I updated generated Classic host bundles when applicable. (Not applicable.)
  • I documented third-party content and licensing changes when applicable. (Not applicable.)

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.

1 participant