You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pnpm exec tsc --noEmit in harness/ fails with one error in the env-gated gateway-bridge code:
src/cli.ts(79,26): error TS2352: Conversion of type '{ Authorization: string; "x-api-key": null; }' to type 'Record<string, string>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property '"x-api-key"' is incompatible with index signature.
The offending block (harness/src/cli.ts, ~lines 78-83):
The "x-api-key": null is intentional — it deletes the default x-api-key header via Pi's mergeHeaders (the same pattern Pi's cloudflare path uses), so the gateway sees Authorization: Bearer instead. The problem is only the type assertion: null isn't assignable to a Record<string, string> index signature, so the as Record<string, string> cast is rejected.
Provenance
Pre-existing — introduced by the M1-era gateway bridge commit feat(harness): env-gated Bearer gateway bridge for headless smoke (ANTHROPIC_BASE_URL/AUTH_TOKEN). Not introduced by M2.
It became visible during M2 (Task 9) because the harness previously had no tsconfig.json; a minimal one was added to wire @sh/k8s-sandbox, which makes tsc --noEmit runnable. The harness runs via tsx + vitest, so this error does not affect runtime or the test suite today.
Impact
Harmless at runtime, but harness will fail any future CI typecheck gate (tsc --noEmit).
Suggested fix
Type the header map to allow header deletion rather than force-casting. Either:
(matching what Pi's mergeHeaders accepts — null means "delete this header"), or, if the surrounding type strictly requires Record<string, string>, as unknown as Record<string, string> with a short comment.
Prefer the string | null form since it is type-honest about the deletion semantics.
Resolved — this was fixed by #6 (merged 2026-06-26).
The gateway-bridge code was refactored out of harness/src/cli.ts into harness/src/run-turn.ts. The offending cast is gone; lines 122–123 now read:
"x-api-key": null,// strip x-api-key when using gateway Bearer auth}asunknownasRecord<string,string>,
This is the fallback (option 2) from the issue. The "preferred" Record<string, string | null> form was not viable because the consumer field requires Record<string, string>, so as unknown as ... is the type-honest escape with a comment documenting the deletion semantics. A regression test guards it: harness/test/model-gateway.test.ts asserts headers["x-api-key"] is null on the gateway path.
Verified tsc --noEmit on main no longer reports TS2352 / any x-api-key error.
Note: tsc --noEmit still fails with 6 unrelated errors introduced by later milestones (leaf-session tools, work-queue). Those are tracked separately so the CI typecheck gate can be turned on cleanly.
Activity
pdettori commentedon Jun 29, 2026
Resolved — this was fixed by #6 (merged 2026-06-26).
The gateway-bridge code was refactored out of
harness/src/cli.tsintoharness/src/run-turn.ts. The offending cast is gone; lines 122–123 now read:This is the fallback (option 2) from the issue. The "preferred"
Record<string, string | null>form was not viable because the consumer field requiresRecord<string, string>, soas unknown as ...is the type-honest escape with a comment documenting the deletion semantics. A regression test guards it:harness/test/model-gateway.test.tsassertsheaders["x-api-key"]isnullon the gateway path.Verified
tsc --noEmitonmainno longer reportsTS2352/ anyx-api-keyerror.Assisted-By: Claude Code
test: strengthen flag-OFF select-sandbox test to assert list() not ca…
docs(spec): P5 v1.1 — absorb MU1 composition and P6 entry-point asks
feat(microvm): per-VM cgroups, systemd containment, orphan sweep (Tas…
fix(microvm): SH_PARENT_CGROUP is slice-relative, and the shipped uni…
feat(tui): session manager with remint, per-session queue and retries