Repository navigation
backends: isolate the missing-credential fixture from ambient inference credentials #1996
Description
Out of scope
Changing production credential precedence or environment admission, handling real credentials, external inference, changing #1993's browser fixture, offline guards or assertion deadlines, or weakening the missing-credential refusal assertion.
Context
autonomous Claude envelope > an API profile without a credential refuses before a relay or worker exists (test("an API profile, packages/ui-backend-claude/tests/autonomous-envelope.test.ts:97-100) supplies an empty profile environment but does not isolate ambient inference credentials. turnEnv merges a filtered host snapshot before the profile environment (turnEnv, packages/ui-backend-claude/src/sdk-options.ts:71-76); envSnapshot reads the host environment (envSnapshot, packages/ui-backend-claude/src/config/env.ts:201). The negative control therefore depends on the terminal having no admitted API credential, and it creates a relay when that assumption is false.
Observed twice:
- During ci: native parallel-session proof reports unbound Playwright response objects #1993's bounded ordered-prefix control at checkout
ee8aa00e4b1cd3e255e4e905153a4d4f55c33f27, as the only preceding-file failure. A focused invocation with inherited Anthropic credential variables removed passes; the same invocation with only the fictionalANTHROPIC_API_KEY=sk-odysseus-fixtureadded fails because the call returns instead of throwinghas no inference credential. - While verifying tests: the offline guard misses node:net connections from an in-process egress proxy #2739, in
bun run test packages/ui-sdk packages/ui-server packages/core packages/ui-backend-pi packages/ui-backend-claude, run from a terminal whose environment held anANTHROPIC_API_KEY(no value recorded). Reported separately as tests: autonomous Claude credential-absence fixture inherits a host API key #2749, closed as a duplicate of this issue.
Both runs used the repository test wrapper and offline preload. No inference request or worker launch is required.
Scope
- Make the missing-credential fixture own its credential environment, saving and restoring every variable it changes. Keep production behavior unchanged.
- Check the other credential-absence cases in
autonomous-envelope.test.tsfor the same ambient-credential assumption and isolate any that share it.
Acceptance criteria
- The original refusal and absence-of-relay assertions pass when the invoking process has no inference credential and when it contains a fictional API key or bearer-token sentinel, while still proving that the assembled turn has no admitted inference credential.
- The fixture restores the exact preceding variable presence/value after success and failure; no real credential is printed.
- Every other credential-absence case in the suite either is shown not to depend on ambient credentials or receives the same isolation.
- A mutation removing the fixture's isolation makes the named case fail for the original missing-refusal assertion with a fictional sentinel.
- The package suite remains offline with the normal test guard enabled.
Verification
Run env ANTHROPIC_API_KEY=sk-odysseus-fixture bun run test ./packages/ui-backend-claude/tests/autonomous-envelope.test.ts, then repeat with that variable unset, plus appropriate local preflight and affected hosted proof. Retain the failing mutation and restored results. Do not use real credentials or network calls.
Contract impact
None. Test environment isolation only. This issue does not establish any relationship to #1993's Playwright GUID failure.
Part of #736's deterministic host-isolation outcome.
2026-10-24: merged #2749 into this issue (same test, same ambient-key dependency): folded in its second observation, the sibling-case audit, and the offline-suite criterion; refreshed the test and turnEnv/envSnapshot anchors; added area: ci.
2026-10-24: attached natively to #736 after #736's browser children moved to the new nested epic and freed capacity; replaced the earlier standalone-by-reference wording.
Activity
schlessera commentedon Oct 15, 2026
2026-10-16 triage: verified the test and host-environment source anchors, corrected the turnEnv range, added priority p2 and agent-ready for this complete unscheduled test-isolation brief. The existing fictional sentinel evidence establishes the scoped failure; no new inference or credential access was performed. Keep standalone by reference to full-capacity #736, without moving any child or changing production credential precedence.
schlessera commentedon Oct 24, 2026
Claim
bk044-2749-a9f58eea: implementing the credential-absence fixture isolation on branchtest/2749-hermetic-credentials-044for milestone 0.44.0. #2749 is closed as a duplicate of #1996; this claim covers that same scoped fix. Will stop at a draft PR with local receipts and draft gates, leaving #2769 untouched.