Skip to content

Commit 56cb804

Browse files
committed
fix(engine-claude-agent-sdk): export inheritEssentialHostEnv + restore Bedrock/AWS allow-list
Two regressions caught by running the full workspace test suite (`pnpm -r test`): 1. `inheritEssentialHostEnv` was declared but not exported. The test in src/engine.test.ts imports it as a named export, so the suite threw 'inheritEssentialHostEnv is not a function' at three tests. Added 'export' to the declaration at line 272. 2. The function's allow-list had been trimmed back to just POSIX/XDG basics (HOME, PATH, USER, …). This regressed task #68 (Phase 2a: OSS PR — Bedrock env passthrough), which is the contract that lets a worker pod with IRSA-injected AWS_ROLE_ARN + AWS_WEB_IDENTITY_TOKEN_FILE actually invoke Bedrock. Restored the 9 keys the test (and reality) require: CLAUDE_CODE_USE_BEDROCK AWS_REGION AWS_DEFAULT_REGION AWS_BEDROCK_MODEL_ID AWS_ROLE_ARN AWS_WEB_IDENTITY_TOKEN_FILE AWS_PROFILE AWS_SHARED_CREDENTIALS_FILE AWS_CONFIG_FILE After the fix: 10/10 engine-claude-agent-sdk tests pass (was 7/10). Full workspace suite: 422 passing, 40 skipped (offline, gated on env), 0 failures across all 22 packages with tests. How the regression got in: PR #10 (policy guardrails) was authored on a branch that started before the Bedrock-env work in task #68 landed; when it merged to main + I --theirs-resolved engine.ts during the chore/oss-cleanup-public merge, the older smaller allow-list won.
1 parent 3f2e0a6 commit 56cb804

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

  • packages/engine-claude-agent-sdk/src

packages/engine-claude-agent-sdk/src/engine.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,11 @@ function signalToController(signal: AbortSignal): AbortController {
269269
*
270270
* Caller envs (api keys, etc.) override these on conflict.
271271
*/
272-
function inheritEssentialHostEnv(): Record<string, string> {
272+
export function inheritEssentialHostEnv(): Record<string, string> {
273273
const out: Record<string, string> = {};
274274
for (const k of [
275+
// POSIX + XDG basics — required for the SDK to resolve $HOME, $PATH, etc.
276+
// Without these, transcript-mirror writes silently drop.
275277
"HOME",
276278
"PATH",
277279
"USER",
@@ -281,6 +283,19 @@ function inheritEssentialHostEnv(): Record<string, string> {
281283
"CLAUDE_CONFIG_DIR",
282284
"XDG_CONFIG_HOME",
283285
"XDG_DATA_HOME",
286+
// Bedrock + AWS IRSA passthrough (task #68 Phase 2a) — when the caller
287+
// routes the agent via Bedrock, the AWS SDK's default credential chain
288+
// needs these. Picked up automatically from the pod env (IRSA injects
289+
// AWS_ROLE_ARN + AWS_WEB_IDENTITY_TOKEN_FILE) or developer shell.
290+
"CLAUDE_CODE_USE_BEDROCK",
291+
"AWS_REGION",
292+
"AWS_DEFAULT_REGION",
293+
"AWS_BEDROCK_MODEL_ID",
294+
"AWS_ROLE_ARN",
295+
"AWS_WEB_IDENTITY_TOKEN_FILE",
296+
"AWS_PROFILE",
297+
"AWS_SHARED_CREDENTIALS_FILE",
298+
"AWS_CONFIG_FILE",
284299
]) {
285300
const v = process.env[k];
286301
if (v) out[k] = v;

0 commit comments

Comments
 (0)