Repository navigation
fix(nodes): bound node Claude clearEnv to the node protocol allowlist - #20
Merged
Merged
Conversation
With a selected Claude auth profile the Gateway forwarded the backend's whole clearEnv list (41 keys, including MAX_THINKING_TOKENS and CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING) to paired nodes. Nodes accept only their 40-key clear allowlist, so every node-placed Claude run on a Gateway with an Anthropic auth profile failed with "clearEnv must be a bounded array". Export the node allowlist as the protocol contract and filter what the Gateway sends against it. Deployed nodes keep working without an upgrade. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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 node-placed Claude run fails on a Gateway with an Anthropic auth profile:
With a selected Claude credential,
executePreparedCliRunforwards the backend's wholeclearEnv(CLAUDE_CLI_CLEAR_ENV, 41 keys) to the node. The node's decoder (src/node-host/invoke-agent-cli-claude-params.ts) accepts at most its own 40-key clear allowlist, and two Gateway keys are not on it at all:MAX_THINKING_TOKENSandCLAUDE_CODE_DISABLE_ADAPTIVE_THINKING.This surfaced on the first live dev-loop ticket (Workboard
node-claudetarget → mac-factory). The M1 test kit had no Anthropic profile, so the slice 1/2 proofs never took the selected-auth path.Solution
NODE_CLAUDE_CLEAR_ENV_KEYS.nodeClearEnvagainst it insrc/agents/cli-runner/execute.ts.The fix is Gateway-side on purpose: deployed nodes (mac-factory runs 2026.10.2) keep their 40-key allowlist and work without an upgrade. Widening the node list instead would still be rejected by every deployed node. The two dropped keys are never forwarded in
envto nodes (NODE_CLAUDE_FORWARD_ENV_KEYShas only the context-window keys), so nothing the Gateway sets is affected.execute.ts→node-agent-cli-runtime.tsis the only path that sendsclearEnvto a node;node-claude-skill-runtime.tsonly checks command policy.Evidence
src/agents/cli-runner/execute.node-clear-env.test.ts: node placement with a selected credential and the node list plusMAX_THINKING_TOKENS, then the captured wire params go through the node's owndecodeClaudeCliNodeRunParams.expected [ … (40) ] to deeply equal [ … (39) ]), passes with it.pnpm test src/agents/cli-runner/execute.node-clear-env.test.ts --maxWorkers=1: 1 test, ~33 s wall time (mostly the shared harness import; the test itself takes milliseconds).src/agents/cli-runner.spawn.test.ts(38) andsrc/node-host/invoke-agent-cli-claude.test.ts(34) pass.pnpm tsgo:corepasses; oxlint is clean on the changed files.check:test-mock-exports(3 hits in untouched files)tsgo:core:test(src/gateway/node-agent-cli-runtime.test.tsisWebchatConnect)0e028045(voice-diary DOC-7) on mac-factory.🤖 Generated with Claude Code