fix(miner): forward HOME and the real coding-agent credential to CLI subprocesses - #6901
Merged
Merged
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
loopover-ui | a1d9504 | Commit Preview URL Branch Preview URL |
Jul 17 2026, 11:42 AM |
Bundle ReportChanges will increase total bundle size by 39 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: loopover-uiAssets Changed:
|
…subprocesses
The claude-cli/codex-cli driver's parentEnv is deliberately, strictly
allowlisted and never carries HOME or any credential (a coding-agent
subprocess getting the operator's full, unvetted environment is the
exact thing that allowlist exists to prevent). Its separate `env`
field ("extra env overlaid on the allowlisted parent") is the
intended channel for exactly this kind of deliberately, narrowly
forwarded value, but nothing ever populated it -- a spawned claude/
codex subprocess had no HOME to locate a persisted credential file
with, and no credential env var either, unable to authenticate at
all, independent of and more fundamental than #6840's separate
--permission-mode gap.
Resolves only HOME plus the invoked command's own real credential
keys (CLAUDE_CODE_OAUTH_TOKEN/ANTHROPIC_API_KEY for claude,
OPENAI_API_KEY/CODEX_ACCESS_TOKEN for codex) from the full env this
factory already has, command-scoped so an operator with both
providers' keys set never leaks the unrelated one -- never the raw
env object itself, preserving the strict-allowlist boundary for
everything else. Confirmed via a live, authenticated end-to-end
reproduction (real Read/Bash tool use, a real committed fix).
Closes #6875
Predates #5653, which wired real per-iteration token accumulation into finalMeterTotals.tokens -- the pipeline already correctly persists real tokens_used today; only a genuinely non-running or non-reporting driver produces an honest 0.
JSONbored
force-pushed
the
fix/ams-cli-driver-env-allowlist-6875
branch
from
July 17, 2026 11:40
0e16bd1 to
a1d9504
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6901 +/- ##
=======================================
Coverage 93.70% 93.70%
=======================================
Files 685 685
Lines 68284 68292 +8
Branches 18715 18718 +3
=======================================
+ Hits 63985 63993 +8
Misses 3302 3302
Partials 997 997
Flags with carried forward coverage won't be shown. Click here to find out more.
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude-cli/codex-clidriver'sparentEnvis deliberately, strictly allowlisted and never carriedHOMEor any credential — a coding-agent subprocess getting the operator's full, unvetted environment is the exact thing that allowlist exists to prevent. Its separateenvfield ("extra env overlaid on the allowlisted parent") is the intended channel for exactly this kind of deliberately, narrowly forwarded value, but nothing ever populated it — a spawnedclaude/codexsubprocess had noHOMEto locate a persisted credential file with, and no credential env var either, unable to authenticate at all, independent of and more fundamental than claude-cli driver's --permission-mode acceptEdits denies every Read/Bash call, silently blocking all real work #6840's separate--permission-modegap.HOMEplus the invoked command's own real credential keys (CLAUDE_CODE_OAUTH_TOKEN/ANTHROPIC_API_KEYfor claude,OPENAI_API_KEY/CODEX_ACCESS_TOKENfor codex) from the full env this factory already has, command-scoped so an operator with both providers' keys set never leaks the unrelated one — never the raw env object itself, preserving the strict-allowlist boundary for everything else.docs/observability.md/ams-observability.mdxclaim thattokens_usedis alwaysNULL— that predates Extract and persist real coding-agent token usage (Agent SDK usage.input_tokens/output_tokens, CLI JSON output) #5653, which already wired real token accumulation through; confirmed via this fix's own live verification (tokensUsed: 323on a real successful run).Closes #6875
Test plan
npm run test:ci— green for every check touching this diff (3 unrelated, pre-existing failures from separate main commits — a deletedterraform/dir, a stale rename string, a stale branding-drift baseline — none touch anything in this PR's diff; flagged separately)HOME+ credential passthrough confirmed via a direct driver-level test against a real repo (realRead/Bashtool use, zero denials, real response)