Skip to content

[Bug]: runtime-auth-service suites fail (77/96) when ORCA_REAL_CLAUDE_CLI_TEST=1 and CLAUDE_CONFIG_DIR is set #25567

Open

Description

@matbrgz

Operating system

macOS (Darwin 27.0, arm64). Test-environment issue; affects any OS.

Orca version (main @ sha)

main @ e2da3a1

Details

Repro

ORCA_REAL_CLAUDE_CLI_TEST=1 CLAUDE_CONFIG_DIR=/some/dir \
  pnpm exec vitest run --config config/vitest.config.ts src/main/claude-accounts/runtime-auth-service-

Result: 7 of 8 files fail, 77 failed / 19 passed. Without ORCA_REAL_CLAUDE_CLI_TEST=1 all 96 pass: since #23979 the global vitest guard (config/scripts/vitest-real-agent-home-write-guard.ts) unsets CLAUDE_CONFIG_DIR for every unit test. That covers the default mode. The real-CLI mode is the gap left, because the guard deliberately keeps the variable there.

Root cause

src/main/claude-accounts/runtime-paths.ts:15 prefers an inherited CLAUDE_CONFIG_DIR over homedir(). The runtime-auth suites mock node:os so homedir() points at a temp home, but never isolate the environment. The global guard in config/scripts/vitest-real-agent-home-write-guard.ts:196 deliberately keeps CLAUDE_CONFIG_DIR when ORCA_REAL_CLAUDE_CLI_TEST=1 (the real-CLI suites need it), so in that mode the resolver walks past the fake home to the developer's real config dir. The keychain double then throws Unexpected Claude config dir, and path assertions see the real dir. The shared harness src/main/claude-accounts/runtime-auth-service-test-harness.ts:141 (resetRuntimeAuthTestState) is where every suite sets up its environment.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions