Repository navigation
Let cc-harness helpers route with env credentials (swarm 0.17.1) - #102
Merged
Merged
Conversation
gering
force-pushed
the
task/fix-swarm-cc-harness-env-filter
branch
from
November 3, 2026 17:51
6d601bb to
9e769a7
Compare
2 tasks
- Split the secret-shaped env filter around the helper: before it, strip only the Anthropic credentials it replaces, Claude Code markers and git config; after it (`exec <id> -- env -u ...`), strip every secret-shaped name the parent holds, so the jailed claude still never sees them - Run readiness (`list`) under the same pre-helper env as exec, so a helper that cannot route there is not reported ready - Hermetic tests with a stub helper that needs a *_SECRET var Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RtoWD2CayLPgnn8FrtyqLG
- Match infix secret names (CLIPROXY_API_KEY_<PROFILE>, *_CLIENT_ID, *_TOKEN_*, *_SECRET_*) in the env filter and the findings scrub; the suffix-only patterns let a gateway API key reach every jailed voice - Build HARNESS_POST only where exec uses it; share the git redirects - Document the exec target shape and the helper trust boundary in the cc-harness contract Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RtoWD2CayLPgnn8FrtyqLG
Bash exports OLDPWD valueless at startup; exec's cd into the empty cwd gave it the repo path, so exec saw one env name more than list (Linux CI only; a zsh parent already exports it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RtoWD2CayLPgnn8FrtyqLG
- Mirror the profile-suffix scrub in the workflow output gate and test that both scrubbers redact identically - Replace the (?i) keyword tail, which redacted token_path and friends, with a case-sensitive uppercase env-name rule that keeps the name and also covers *_CLIENT_ID - Strip *_PASSWORD_*, *_CREDENTIALS_*, *_ACCESS_KEY*, *_PRIVATE_KEY* - Set CLAUDE_CONFIG_DIR after the helper so list and exec give it the same env; the parity test now compares the full name sets - Bring README, CHANGELOG and knowledge in line with 0.17.1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RtoWD2CayLPgnn8FrtyqLG
gering
force-pushed
the
task/fix-swarm-cc-harness-env-filter
branch
from
November 4, 2026 13:12
9e769a7 to
5d8be5e
Compare
4 tasks done
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.
Problem
Every
cc-harness:<id>exec failed with rc=3 "no gateway token" (10/10 calls in the PR #100 review) while readiness reported the voices ready. cc-router's remote route readsCLIPROXY_API_KEY_<PROFILE>/CLIPROXY_CF_ACCESS_<PROFILE>_CLIENT_SECRETfrom the env, and the adapter stripped secret-shaped names before the helper ran;listran unfiltered.Fix
_harness_env_prefixsplits the filter around the helper:listandexec): strips only the Anthropic credentials the helper replaces, the parent's Claude Code markers, and redirects git config.exec <id> -- env -u …before the jail): strips every secret-shaped name the parent holds, derived from the same_env_filter_args(no profile names). The routingANTHROPIC_AUTH_TOKENthe helper injects survives.listunder HARNESS_PRE, so ready and exec see the same env._hardened_env_prefixloses its now-unused extra-names parameter.Tests
New hermetic tests in
test_cc_harness.pywith a stub helper that needs a*_SECRETvar: exec succeeds, the claude stub sees neither the secret,GH_TOKEN, nor the parent's Anthropic creds (but does see the helper's routing token); the helper sees identical env names inlistandexec; a helper that cannot route is not ready. The first two fail on 0.17.0.scripts/check-structure.pygreen.Local review (swarm, 1 round)
5 findings, all acted on in f6268fe:
CLIPROXY_API_KEY_<PROFILE>reached every jailed voice (already true in 0.17.0). Both now match infix forms; tests cover it.env -u … [jail] claude) and the helper trust boundary (the helper's own exports are its call) are documented incc-harness-agents.md.CI fix after review
9e769a7: the readiness/exec parity test failed on Linux CI only. Bash exports
OLDPWDvalueless at startup, and exec'scdinto the empty cwd gave it the repo path, so exec saw one env name more thanlist.HARNESS_PREnow unsetsOLDPWD; the test asserts it. Not covered by the recorded local review.Local review, round 2 (swarm)
8 findings on 9e769a7, all applied in 5d8be5e (now covers the OLDPWD commit too; merge gate
covered=yes):scrubFieldinswarm-review.js) gets the same profile-suffixed rule as the adapter scrub; a test runs both on the same cases.*_PASSWORD_*,*_CREDENTIALS_*,*_ACCESS_KEY*,*_PRIVATE_KEY*(no blanket*_KEY).*_CLIENT_ID;token_path/password_hashstay untouched.CLAUDE_CONFIG_DIRmoves behind the helper, solistand exec see exactly the same env; the parity test compares all names.Rebased onto main (#100).
Live check (approved by Robert)
One real
cc-harness:solvoice through the 0.17.1 adapter on a planted off-by-one diff: rc=0 in ~7 s, 1 correct critical finding, schema-valid output. The same call through the installed 0.17.0 adapter fails withrc=3(no gateway token) in the helper, which confirms the root cause live.🤖 Generated with Claude Code
https://claude.ai/code/session_01RtoWD2CayLPgnn8FrtyqLG