update the claude entrypoint identifier for accuracy#28410

merged1
main
t3/investigate-claude-usage-tips
opened10d agobyTtheo
View on GitHubTwo-way sync enabledPR last imported 8d ago

Claude processes started by T3 Code identify themselves with CLAUDE_CODE_ENTRYPOINT. Today that value is the Agent SDK default sdk-ts, or a value inherited from the host. For example, it is claude-desktop when T3 Code is started from inside a Claude Code session.

Change

  • mergeClaudeProcessEnvironment in ClaudeHome.ts sets CLAUDE_CODE_ENTRYPOINT=t3-code for the Claude processes T3 Code runs: turns, version and capability probes, and text generation.
  • A value set in the instance's environment wins over t3-code.
  • A value set in Claude's settings.json env wins over both. Claude Code 2.1.316 reads the entrypoint only from the process env and ignores the one in settings.json, so T3 Code reads it from there itself. readClaudeSettingsBaseUrl became readClaudeSettingsEnv so that one reader serves both values.
  • In-app terminals do not change. An interactive claude started there keeps its own entrypoint.

Verification

  • ClaudeHome.test.ts covers three cases: the default replaces an inherited host value, the instance env overrides the default, and settings.json overrides both.
  • I ran Claude Code 2.1.316 against a local fake API and captured the request headers:
    • With CLAUDE_CODE_ENTRYPOINT=t3-code in the process env, the request carries User-Agent: claude-cli/2.1.316 (external, t3-code) and cc_entrypoint=t3-code.
    • With t3-code in the process env and a different value in settings.json, the request still carries t3-code. This is why T3 Code applies the settings.json value itself.
  • vp run check:changed passes.

Made with Claude Opus 5.5 in Claude Code, running in T3 Code.

πŸ€– Generated with Claude Code

Checks

23 successful Β· 14 skipped Β· 1 neutral
All checks passed
4d75fb8

Added 1 commit

  • update the claude entrypoint identifier for accuracy4d75fb8
Synced from GitHub

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval β€” Claude launches now default their entrypoint identifier to "t3-code", while allowing instance and settings overrides. This changes an existing product default and requires human confirmation of the intended identity and override precedence.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Thread transfer impact

βœ… Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB+35 B (+0.7%)6.8 KiBβœ…
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBβœ…
CodexLive turn WebSocket wire1.2 KiB1.3 KiB+35 B (+2.8%)2.0 KiBβœ…
CodexLive turn WebSocket decoded21.5 KiB21.6 KiB+41 B (+0.2%)24.4 KiBβœ…
CodexLive turn messages12+1 (+100.0%)8βœ…
ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiBβœ…
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBβœ…
ClaudeLive turn WebSocket wire1.3 KiB1.3 KiB0 B (0.0%)2.0 KiBβœ…
ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiBβœ…
ClaudeLive turn messages220 (0.0%)8βœ…

Baseline: 575579d Β· PR result: 4d75fb8 Β· Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Synced from GitHub

Review in Change Stack β†’

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between 575579d68ac4bae09f8426a345d4a3eac1e90c67 and 4d75fb830717ef5d9b5671534a115141c56e9995.

External image Files selected for processing: 6
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
  • apps/server/src/provider/ClaudeProvider.ts
  • apps/server/src/provider/Drivers/ClaudeDriver.ts
  • apps/server/src/provider/Drivers/ClaudeHome.test.ts
  • apps/server/src/provider/Drivers/ClaudeHome.ts
  • apps/server/src/provider/Drivers/ClaudeSkills.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

Claude settings now provide both ANTHROPIC_BASE_URL and CLAUDE_CODE_ENTRYPOINT. Claude process-environment merging applies the entrypoint from settings when it is nonempty. The Claude driver and orchestration adapter use this merger.

Changes: Claude environment resolution

Layer / File(s)Summary
Read and merge Claude settings environment
apps/server/src/provider/Drivers/ClaudeSkills.ts, apps/server/src/provider/Drivers/ClaudeHome.ts, apps/server/src/provider/Drivers/ClaudeHome.test.ts
The settings reader returns both environment values, with later settings files overriding earlier values for fields they specify. The merge function combines host and instance environments and applies a nonempty settings entrypoint. Tests cover entrypoint precedence and preservation of a host value.
Use Claude environment resolution across provider paths
apps/server/src/provider/Drivers/ClaudeDriver.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/provider/ClaudeProvider.ts
The driver and orchestration adapter use the Claude-specific merger. The provider reads ANTHROPIC_BASE_URL through the expanded settings reader and retains its process-environment fallback.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: maria-rcks

Merge Risk: External image Low Β· up to 4d75f

Project-specific entrypoint overrides may be ignored, affecting attribution. This is a bounded merge risk.

Pre-merge checks: Passed 3 Β· Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description explains the problem, implementation, behavior, and verification results. However, it omits the required "## Problem" and "## Scope and approval" sections, including an issue or mainta…Add the required "## Problem" and "## Scope and approval" sections. Include the triaged issue or explicit maintainer approval, or explain why this focused fix qualifies without prior approval. Keep the existing change and verification detai…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly identifies the main change: updating the Claude entrypoint identifier. It is concise and specific.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, implementation, behavior, and verification results. However, it omits the required "## Problem" and "## Scope and approval" sections, including an issue or maintainer approval link or an explanation for why the focused fix qualifies without one.

Resolution

Add the required "## Problem" and "## Scope and approval" sections. Include the triaged issue or explicit maintainer approval, or explain why this focused fix qualifies without prior approval. Keep the existing change and verification details under their required headings.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Synced from GitHub

Astra (AI assistant) writing on behalf of @RCXDd. Adding a measured CLIProxyAPI compatibility check for this entrypoint change.

On November 2, I compared a genuine interactive Claude Code TUI (cli) with the same binary running headless through CLIProxyAPI with CLAUDE_CODE_ENTRYPOINT=t3-code. Both entrypoints were verified in the session transcripts.

  • Claude Code 2.1.316, CLIProxyAPI 8.0.50, Opus 5.5 at low effort.
  • Same account and organization, network egress, working directory, prompts, and generated 28 KB text fixture.
  • Three user turns per arm: read the fixture and return a marker, then return two further markers without tools. Four model requests per arm. Every expected response and the Read call succeeded.
  • One-hour caching; safe/restricted mode; Read was the only tool; no MCP servers.
MeasurementNative TUIProxy with t3-code
Total input tokens processed, including cache hits48,74648,184
Output tokens110124
Final-turn input served from cache99.713%99.710%

Native usage was deduplicated by message/request identity from transcripts. Proxy totals came from the final cumulative modelUsage, avoiding partial streamed usage records. This small workload showed essentially equivalent input-token and warm-cache efficiency.

Proxy-specific behavior: CLIProxyAPI 8.0.50's native entrypoint allowlist includes sdk-ts but not t3-code. With our default OAuth configuration, its source routes t3-code through the rewriting path, which emits cli upstream and adjusts system-prompt/cache handling. Thus the new label also changes the proxy's processing path; these tests exercised that path successfully.

Scope: this reproduces the PR's environment-variable change, rather than testing an installed nightly or the full T3 instruction set. It is not proof of equal subscription quota accounting: the tested Ultra account reports five_hour: null, and the whole-percentage weekly meter cannot resolve this small workload. The proxy also began with 1,061 cached prefix tokens, so initial cache-write totals would not be a fair cost comparison. Longer sessions, compaction, and subagents were not tested.

If further quota verification is needed, the missing evidence is a controlled run on an account that still has a five-hour cap. No credentials, account identifiers, private endpoints, or raw session logs are included here.

Synced from GitHub

He's the GOAT. Thank you!