Where a worker's CLAUDE_CODE_* settings came from — toolingSnapshot.workerEnv (kg4pt)
A spawned claude worker inherits the orchestrator's environment verbatim apart from provider
credentials (buildScopedChildEnv). A Claude Code session exports its settings.json env block,
so a cyberine run launched from inside one hands its workers pins such as
CLAUDE_CODE_SUBAGENT_MODEL and CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS, while the same command
from a plain terminal or the daemon hands them nothing. Those two change which model subagents use
and how many run at once, so two runs that look identical can cost and behave differently.
Decision: keep the pass-through and RECORD it. Scrubbing would silently discard settings an
operator set on purpose (a Bedrock or Vertex route, a subagent model chosen in their shell), and
pinning a set would make Cyberine own defaults for a CLI it does not control. Every
toolingSnapshot in run.json now carries:
"workerEnv": {
"launchedFromClaudeCode": true,
"inherited": [
{ "key": "CLAUDECODE", "value": "1" },
{ "key": "CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS", "value": "4" },
{ "key": "CLAUDE_CODE_OAUTH_TOKEN", "redacted": true },
{ "key": "CLAUDE_CODE_SUBAGENT_MODEL", "value": "claude-haiku-4-5" }
]
}inherited lists every CLAUDE_CODE_* and ANTHROPIC_* key plus CLAUDECODE present when the
run started, sorted. A key whose name looks like a credential (token, key, secret, password, auth,
header, cookie), or whose value has any shape beyond a plain token (a URL with userinfo, a value
with spaces or =), is recorded by NAME only. launchedFromClaudeCode is CLAUDECODE === "1".
Run recipe -- nothing to enable; read it back from any run:
jq '.toolingSnapshot.workerEnv' .local/runs/<runId>/run.json
npm run selftest:worker-env-provenance # both launch contexts, redaction, and the record vs the real worker envKnown limitations and deferred work:
- The record is the orchestrator's environment at run start, not each worker's final env: an
adapter's own
envSet(for exampleCLAUDE_CODE_MAX_SUBAGENTS_PER_SESSIONfromCYBERINE_CLAUDE_MAX_SUBAGENTS_PER_SESSION, or an injected OAuth token) is config, not launch context, and is not listed. - A tri-state pin such as
CLAUDE_CODE_TURN_UPDATESis recorded as set; absence in the record means unset, which lets Claude Code's server-side gate decide -- not "off". - Nothing is scrubbed. A run that must not depend on its launch context still has to be launched
from a clean environment (
env -i, the daemon), and the record is how to check that it was.
A non-success result subtype is a failed run (kq5rd)
parseClaudeStreamJson used to take the last type:'result' event and read its result field without looking at subtype. An error subtype carries no result (Claude Code puts errors[] there instead),...
Which Claude account a worker bills — oauthToken (k8rhz)
CLAUDECODEOAUTHTOKEN is a long-lived subscription credential that decides WHICH SEAT a claude worker bills. It used to reach every spawned worker by plain inheritance: T603's least-privilege env