Skip to content

codex harness: secret diagnostics, missing-key fast-fail, --json streaming; switch dev.md to codex#34459

Merged
pelikhan merged 5 commits into
mainfrom
copilot/update-copilot-harness-configuration
May 24, 2026
Merged

codex harness: secret diagnostics, missing-key fast-fail, --json streaming; switch dev.md to codex#34459
pelikhan merged 5 commits into
mainfrom
copilot/update-copilot-harness-configuration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 24, 2026

Codex was failing with ERROR: Missing environment variable: \OPENAI_API_KEY`on every attempt because AWF excludes both API keys from the sandbox. The existingAUTHENTICATION_FAILED_PATTERN` didn't match this error, so the harness burned all 3 retries on an unrecoverable config problem before giving up.

codex_harness.cjs

  • Secret diagnostics — logs CODEX_API_KEY=set (length=N)/not set and same for OPENAI_API_KEY at startup; no values exposed
  • Pre-flight check — exits immediately with an actionable message if neither key is configured, before spawning codex
  • isMissingApiKeyError() + MISSING_API_KEY_PATTERN — detects Missing environment variable: \OPENAI_API_KEY|CODEX_API_KEY`` and breaks the retry loop on any attempt (not just attempt 0)
  • injectJsonFlag() — injects --json after codex exec automatically so stdout becomes a JSONL event stream per the codex exec non-interactive mode spec; no-op if already present or subcommand isn't exec

codex_harness.test.cjs

New tests for isMissingApiKeyError, injectJsonFlag, and the updated shouldRetry policy (missing key is non-retryable on all attempts).

dev.md

Switched engine from pi / claude-sonnet-4-20250514 to codex / gpt-5.4; lock file recompiled.



✨ PR Review Safe Output Test - Run 26364283342

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · opus47 6.9M ·

Copilot AI and others added 3 commits May 24, 2026 14:15
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…tion, --json streaming, and pre-flight check; update dev.md to codex engine"

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…sh in error message

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title feat: codex harness — secret diagnostics, missing-key detection, --json streaming, and dev.md engine switch codex harness: secret diagnostics, missing-key fast-fail, --json streaming; switch dev.md to codex May 24, 2026
Copilot AI requested a review from pelikhan May 24, 2026 14:24
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions github-actions Bot removed the smoke label May 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

🚀 Smoke Gemini MISSION COMPLETE! Gemini has spoken. ✨

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

The threat detection results could not be parsed.

Review the workflow run logs for details.

Testing safeoutputs CLI

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

🚀 Smoke Pi MISSION COMPLETE! Pi delivered. 🥧

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge manic recompile fix conflicts, fix lint js, update wasm

https://github.com/github/gh-aw/actions/runs/26363799116/job/77605156732#step:6:1

@github-actions
Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.54.0
jq 1.7
yq 4.53.2
curl 8.5.0
gh 2.92.0
node 22.22.3
python3 3.14.5
go 1.24.13
java 21.0.11
dotnet 10.0.300

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test · sonnet46 504.2K ·

@github-actions
Copy link
Copy Markdown
Contributor

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

The threat detection results could not be parsed.

Review the workflow run logs for details.

Smoke Test: Gemini - 26364283367\n- GitHub MCP Testing: ✅\n- Web Fetch Testing: ✅\n- File Writing Testing: ✅\n- Bash Tool Testing: ✅\n- Build gh-aw: ❌\n\nOverall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

Smoke Gemini — Powered by Gemini ·

@pelikhan pelikhan marked this pull request as ready for review May 24, 2026 14:52
Copilot AI review requested due to automatic review settings May 24, 2026 14:52
Copilot AI and others added 2 commits May 24, 2026 14:53
…ation

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ixture

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Smoke Claude — Run 26364283342

Core #1#13: ✅ all pass
PR review #14#16, #18, #19: ✅
#17 resolve thread: ⚠️ skipped (no unresolved threads)
#20 close PR: ⚠️ skipped (no safe test PR)

Overall: ⚠️ PARTIAL (skips only; no failures)

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · opus47 6.9M ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 Automated smoke test review - all systems nominal!

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · opus47 6.9M

Comment thread .github/workflows/dev.md
provider:
id: github
model: claude-sonnet-4-20250514
id: codex
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Smoke test review: switching engine to codex with gpt-5.4 looks clean — consider noting the model rationale in the PR body for downstream reviewers.

Comment thread .github/workflows/dev.md
id: github
model: claude-sonnet-4-20250514
id: codex
model: gpt-5.4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Smoke test review: a comment block above the engine: stanza explaining the migration from the pi runtime would help future maintainers.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 24, 2026

@copilot merge manic recompile fix conflicts, fix lint js, update wasm

https://github.com/github/gh-aw/actions/runs/26363799116/job/77605156732#step:6:1

Done in 7e09f4c (merge origin/main) and 7da11ca:

  • lint-js fixed — ran npx prettier --write codex_harness.cjs; make lint-cjs now passes
  • wasm updated — regenerated codex.golden via make update-wasm-golden; the golden now reflects --exclude-env CODEX_API_KEY --exclude-env OPENAI_API_KEY from the codex engine secret-isolation change
  • merge conflictsgit merge origin/main applied cleanly (only the README updates in pkg/errorutil, pkg/linters, pkg/syncutil needed merging); dev.lock.yml already had the correct --exclude-env flags so no recompile was needed

@pelikhan pelikhan merged commit 1aa669a into main May 24, 2026
@pelikhan pelikhan deleted the copilot/update-copilot-harness-configuration branch May 24, 2026 14:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Codex CLI harness and the Dev workflow configuration to (a) diagnose and fast-fail when required API keys are missing, (b) treat missing-key failures as non-retryable, and (c) ensure codex exec uses --json to emit JSONL events for CI log parsing.

Changes:

  • Add missing-API-key detection + preflight key checks to codex_harness.cjs, plus --json injection for codex exec.
  • Add unit tests for missing-key detection, --json arg injection, and updated retry policy.
  • Switch .github/workflows/dev.md (and the compiled lock) to the codex engine / gpt-5.4.
Show a summary per file
File Description
actions/setup/js/codex_harness.cjs Add missing-key detection, secret diagnostics, preflight fast-fail, and --json injection.
actions/setup/js/codex_harness.test.cjs Add tests for missing-key detection, --json injection, and retry policy updates.
.github/workflows/dev.md Switch the Dev workflow engine configuration to Codex / gpt-5.4.
.github/workflows/dev.lock.yml Recompiled lockfile reflecting Codex engine + updated runtime wiring/log parsing.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 5/5 changed files
  • Comments generated: 3

Comment on lines +293 to +299
// Diagnose API key presence so CI failures can be triaged without exposing secret values.
const codexApiKey = process.env.CODEX_API_KEY;
const openaiApiKey = process.env.OPENAI_API_KEY;
log(`secrets: CODEX_API_KEY=${codexApiKey ? `set (length=${codexApiKey.length})` : "not set"}` + ` OPENAI_API_KEY=${openaiApiKey ? `set (length=${openaiApiKey.length})` : "not set"}`);

// Pre-flight: require at least one API key before spawning codex.
// Without a key, codex exits immediately with "Missing environment variable" and every
Comment on lines 321 to 330
const hadPromptFile = args.includes("--prompt-file");
const safeArgs = hadPromptFile && resolvedArgs.length > 0 ? [...resolvedArgs.slice(0, -1), "<prompt omitted>"] : resolvedArgs;

// Inject --json after `exec` to stream structured JSONL events to stdout, making
// Codex output machine-readable in CI without affecting the stderr progress stream.
resolvedArgs = injectJsonFlag(resolvedArgs);

// Fetch AWF API proxy reflection data before running the agent to capture initial proxy state.
// This is best-effort: failures are logged but do not affect the agent run.
await fetchAWFReflect({ logger: log });
Comment on lines +854 to +855
sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env CODEX_API_KEY --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --exclude-env OPENAI_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull --difc-proxy-host host.docker.internal:18443 --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt \
-- /bin/bash -c 'export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/codex_harness.cjs codex exec${GH_AW_MODEL_AGENT_CODEX:+ --model "$GH_AW_MODEL_AGENT_CODEX"} -c web_search="disabled" -c fetch="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log
@github-actions
Copy link
Copy Markdown
Contributor

Ug! Smoke test agent was here! Me caveman. Me test all tools. All work good. Fire hot. Code run. 🔥🪨

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · sonnet46 2.2M ·

@github-actions
Copy link
Copy Markdown
Contributor

🎉 Ug! Caveman very excited! New discussion born! Me smoke test agent run 26364283374. Me build big binary (29MB!). Me test playwright - see GitHub cave painting. Me find symbols in code rock. All fire hot and working! Cave art: 🪨🔥💻 Smoke rise, tests pass, caveman happy dance! 🕺

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · sonnet46 2.2M ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ug! Caveman review PR. Me find good changes. Missing key now stop early. No waste retries. LGTM. 🪨

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · sonnet46 2.2M


/**
* Determines if the collected output indicates a missing API key at startup.
* Codex exits before producing any agent output in this case, so retrying is futile.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caveman like isMissingApiKeyError. Fast-fail before retry loop — club bad config early! 🦴

const AUTHENTICATION_FAILED_PATTERN = /Authentication failed(?:\s*\(Request ID:[^)]+\))?/i;

// Pattern to detect a missing API key at startup — Codex emits this before making any API
// calls when neither CODEX_API_KEY nor OPENAI_API_KEY is available in the environment.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ug! Caveman see new pattern. MISSING_API_KEY_PATTERN good catch. No retry on bad key. 🪨

@github-actions
Copy link
Copy Markdown
Contributor

📰 DEVELOPING STORY: Smoke Copilot reports failed to deliver outputs. Our correspondents are investigating the incident...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants