Skip to content

fix(claude-plugin): follow installed Claude CLI identity - #478

Merged
shuv1337 merged 1 commit into
integration-v2from
fix/claude-cli-identity
Nov 9, 2026
Merged

shuv1337 merged 1 commit into
integration-v2from
fix/claude-cli-identity

Conversation

@shuv1337

@shuv1337 shuv1337 commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Summary

Fix the Claude subscription plugin advertising claude-cli/2.1.280, which Anthropic rejects for Fable 5.2 (minimum 2.1.290), even when a newer Claude Code is installed.

  • Resolve claude --version lazily, directly through execFile (no shell), once per process; share the in-flight promise across concurrent OAuth/inference requests.
  • Bound detection to 1.5 seconds and 1 KiB stdout, kill timed-out processes, and fall back silently on missing/failing/malformed/older installs to verified CLI 2.1.319.
  • Use the same resolved user-agent for OAuth exchange/refresh and subscription inference. Ordinary API-key requests do not trigger detection.
  • Keep x-app: cli, the system identity and dated beta feature IDs unchanged: they are not CLI version numbers. There is no plugin model allowlist; regression tests cover Fable 5.2 and Opus 5.5 model IDs and caller beta flags surviving shaping.
  • Document the fallback floor and process cache (restart the server after upgrading Claude Code). No package version/release changes. No feature flag needed: this is a compatibility fix.

Changed files

All changes are confined to packages/claude-plugin/:

  • src/identity.ts: detection, version floor and shared cache (new).
  • src/oauth.ts: use the shared asynchronous identity for token requests.
  • src/wire.ts: resolve the same identity for inference headers.
  • src/hooks.ts: await headers and recheck cancellation before rewriting the request.
  • test/identity.test.ts: detection parsing, newer/older versions, fallback failures, lazy/concurrent caching and minimum-version guard (new).
  • test/oauth.test.ts, test/wire.test.ts: shared-identity assertions.
  • test/hooks.test.ts: new-model and beta passthrough assertions.
  • README.md: detection behavior and maintenance notes.

Validation

  • bun test in packages/claude-plugin: 43 passed.
  • bun test --only-failures --rerun-each 10 --randomize: 430 passed, seed 2900260791.
  • bun typecheck in packages/claude-plugin: passed (package script uses tsc --noEmit).
  • Root bun run check: passed, 37/37 typecheck tasks; lint reported existing warnings and zero errors.
  • bun run prettier --check packages/claude-plugin and git diff --check: passed.
  • Direct runtime checks: Node with installed Claude Code 2.1.319 and Bun with an empty executable search path both resolve the expected identity.
  • OPENCODE_CHANNEL=integration-v2 OPENCODE_TARGET=linux-x64 bun run --cwd packages/cli build: passed. Host-target restriction only; no release or installation.

Live smoke test: blocked before provider request

Ran the built CLI with --standalone, anthropic/claude-fable-5-2, an archived, explicitly titled session, and a one-step agent denying every tool. Prompt: Reply with exactly OK. Do not use tools.

The run exited 1 with provider.no-route: Model unavailable: anthropic/claude-fable-5-2 before any Anthropic inference request. Follow-up --standalone auth list returned No authenticated integrations; --standalone models listed only Morph/Yeta models. This host's shuvcode does not have an active Claude subscription connection. No credential import/rotation or live server replacement was attempted. End-to-end Anthropic acceptance and subscription billing eligibility remain unverified.

Release

Do not merge/release from this task. Intended for the orchestrator's later integration-v2 release together with the upstream sync.

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72">
  <g fill="none" stroke="currentColor">
    <rect x="6" y="18" width="88" height="36" rx="8" opacity=".45"/>
    <path d="M102 36h32m-7-6 7 6-7 6"/>
    <rect x="142" y="18" width="92" height="36" rx="8"/>
    <circle cx="118" cy="36" r="3" fill="currentColor">
      <animate attributeName="opacity" values="1;.25;1" dur="2s" repeatCount="indefinite"/>
    </circle>
  </g>
  <g fill="currentColor" font-family="monospace" font-size="11" text-anchor="middle">
    <text x="50" y="40">2.1.280</text><text x="188" y="40">CLI / floor</text>
  </g>
</svg>

@shuv1337
shuv1337 merged commit 51cede0 into integration-v2 Nov 9, 2026
5 checks passed
@shuv1337
shuv1337 deleted the fix/claude-cli-identity branch November 9, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant