Skip to content

feat(sse): add dynamic claude code client version and identity resolver - #12555

Closed
TheDemonTuan wants to merge 4 commits into
diegosouzapw:release/v3.8.51from
TheDemonTuan:feat/dynamic-claude-code-version
Closed

feat(sse): add dynamic claude code client version and identity resolver#12555
TheDemonTuan wants to merge 4 commits into
diegosouzapw:release/v3.8.51from
TheDemonTuan:feat/dynamic-claude-code-version

Conversation

@TheDemonTuan

Copy link
Copy Markdown
Contributor

Summary

Resolves hardcoded Claude Code client version and fingerprint drift by introducing a dynamic identity resolver.

Problem

Previously, CLAUDE_CODE_CLIENT_VERSION and associated metadata were static constants. When upstream Anthropic/Claude Code releases new client versions or requires updated wire identities for newly released models, static constants lead to outdated headers, fingerprint divergence, or upstream rejections.

Solution

  1. Dynamic Identity Resolver (src/shared/services/claudeCodeIdentity.ts):
    • Resolves consistent ClaudeCodeIdentity tuple (version, buildRevision, sdkVersion, runtimeVersion, billingVersion, userAgentCli, userAgentSdkCli).
    • Priority pipeline:
      • Explicit environment override (CLAUDE_CODE_CLIENT_VERSION or CLAUDE_CODE_VERSION_MODE=fixed)
      • Locally installed binary (claude --version via execFile without shell interpolation)
      • NPM registry lookup (@anthropic-ai/claude-code dist-tags with configurable channel stable or latest)
      • Bundled known-good baseline fallback (2.1.236)
    • In-memory SWR caching so hot-path calls (getClaudeCodeIdentity()) have zero latency.
  2. Unified Facade (src/shared/constants/claudeCodeClient.ts):
    • Dynamic accessors while maintaining backward-compatible constant exports.
  3. Synchronized Downstream Consumers:
    • Updated open-sse/config/anthropicHeaders.ts, open-sse/config/providers/shared.ts, open-sse/executors/base.ts, open-sse/services/claudeCodeCompatible.ts, and open-sse/services/ccBridgeTransforms.ts.
    • Async bootstrap initialization in src/instrumentation-node.ts.
  4. Environment Variables:
    • Added CLAUDE_CODE_VERSION_MODE, CLAUDE_CODE_VERSION_CHANNEL, CLAUDE_CODE_CLIENT_VERSION, CLAUDE_CODE_VERSION_CACHE_TTL to .env.example.

Testing

  • Added unit test suite tests/unit/claude-code-dynamic-identity.test.ts.
  • Verified lockstep synchronization in tests/unit/claude-codex-identity-version-sync.test.ts.
  • Passed all unit tests, TypeScript typecheck (npm run typecheck:core), and cycles check (npm run check:cycles).

@HandyKnox

HandyKnox commented Sep 3, 2026 via email

Copy link
Copy Markdown

@TheDemonTuan

Copy link
Copy Markdown
Contributor Author

Closing this unmerged change at the operator's request. Dynamic Claude Code wire-identity resolution can diverge from the known-good client fingerprint and block model calls. The static identity logic on release/v3.8.51 remains the supported behavior.

@TheDemonTuan
TheDemonTuan deleted the feat/dynamic-claude-code-version branch September 3, 2026 10:14
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.

3 participants