Skip to content

tests: autonomous Claude credential-absence fixture inherits a host API key #2749

Closed as duplicate

Description

@schlessera

Out of scope

  • Do not change credential routing, production environment admission, offline guards or assertion deadlines.
  • Do not require a real credential or contact a provider.

Context

While verifying #2739, bun run test packages/ui-sdk packages/ui-server packages/core packages/ui-backend-pi packages/ui-backend-claude failed autonomous Claude envelope > an API profile without a credential refuses before a relay or worker exists: the call did not throw the expected has no inference credential error (packages/ui-backend-claude/tests/autonomous-envelope.test.ts:97-100). The invoking environment contained an ANTHROPIC_API_KEY variable. No value is included here.

The fixture passes an empty profile environment, while turnEnv combines the admitted host snapshot with that environment (packages/ui-backend-claude/src/sdk-options.ts:71-76). The negative control therefore depends on the terminal having no admitted API credential, and it creates a relay when that assumption is false.

Scope

  • Reproduce using only a fictional ANTHROPIC_API_KEY=sk-odysseus-fixture environment variable and the named focused test.
  • Make the fixture explicitly control the credential variables needed by its absence assertion, restoring their original presence and values afterward.
  • Check the other credential-absence cases in the same suite for the same assumption.

Acceptance criteria

  • The named test passes with both an absent key and a fictional inherited key, while still proving that the assembled turn has no admitted inference credential.
  • The fixture restores every changed environment variable after success and failure.
  • Removing the fixture isolation reproduces the named missing-throw assertion with the fictional inherited key.
  • 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. Retain the failing mutation and restored results.

Contract impact

None. Test fixture isolation only.

Activity

  1. added
    type: test
    area: backends
    area: ci
    on Oct 23, 2026
  2. added this to the 0.44.0 milestone on Oct 23, 2026
  3. schlessera commented on Oct 23, 2026

    @schlessera
    OwnerAuthor

    Closing as a duplicate of #1996, which covers the same test (an API profile without a credential refuses before a relay or worker exists) and the same cause: the fixture inherits an ambient ANTHROPIC_API_KEY through turnEnv. #1996 now carries this report's observation from #2739's verification, the audit of the sibling credential-absence cases, and the offline-suite criterion.

    Milestone 0.44.0 records when this was resolved; it does not claim a fix shipped.

  4. schlessera commented on Oct 24, 2026

    @schlessera
    OwnerAuthor

    Claim bk044-2749-a9f58eea: implementing the credential-absence fixture isolation on branch test/2749-hermetic-credentials-044 for 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: backendsarea: citype: test

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions