From 55692ef239e9eca92365327f19045ef705f28559 Mon Sep 17 00:00:00 2001 From: Daniel Kim <79390398+sox8502@users.noreply.github.com> Date: Sun, 12 Jul 2026 17:36:18 -0700 Subject: [PATCH] Codex harness: inject GitHub token so sandboxed git/gh can authenticate (v0.1.50) (#53) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Codex harness: inject GitHub token so sandboxed git/gh can authenticate Codex's workspace-write Seatbelt sandbox blocks the macOS keyring, so gh inside the runner reports its stored token invalid and git's credential helper can't authenticate — private-repo fetch/push fail even with the network access granted in #51. Resolve the token in the parent process (GITHUB_TOKEN env, synced env, gh auth token) and pass it to the codex child as GH_TOKEN/GITHUB_TOKEN, which gh and its credential helper prefer over the keyring. * Bump version to 0.1.50 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/local/harness/codex.rs | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59dda05b..79e4dc49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -928,7 +928,7 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "openresearch-cli" -version = "0.1.49" +version = "0.1.50" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 96e2a5e8..646c1c99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openresearch-cli" -version = "0.1.49" +version = "0.1.50" edition = "2021" description = "OpenResearch CLI (orx) — Rust port" repository = "https://github.com/alphaXiv/openresearch-cli" diff --git a/src/local/harness/codex.rs b/src/local/harness/codex.rs index 91d0f098..7095175f 100644 --- a/src/local/harness/codex.rs +++ b/src/local/harness/codex.rs @@ -325,6 +325,13 @@ async fn run_turn(ctx: &mut TurnCtx) -> Result<()> { }; cmd.arg(prompt); prepare_env(&mut cmd); + // The sandbox blocks the keyring `gh` keeps its token in ("stored token is + // invalid" from inside the workspace), so resolve it out here and pass it + // down; both `gh` and its git credential helper prefer these env vars. + if let Some(token) = crate::local::git::resolve_github_token() { + cmd.env("GH_TOKEN", &token); + cmd.env("GITHUB_TOKEN", token); + } let mut child = cmd .spawn()