Repository navigation
Conversation
Fails on main: mergeClaudeProcessEnvironment labels every Claude process t3-code, and that label makes Anthropic refuse subscriber API credits. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since pingdotgg#28410 every Claude process is labeled t3-code. Anthropic answers that label with "Credit balance is too low" on an organization holding only subscriber API credits, although those credits cover the Agent SDK. Leave the entrypoint unset when the process authenticates with ANTHROPIC_API_KEY, so the Agent SDK applies sdk-ts. Subscription logins keep t3-code, and explicit overrides still win. Fixes pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — API-key Claude instances now default to the Agent SDK entrypoint, enabling subscriber API-credit usage while retaining explicit overrides. Human review is required to confirm this change to default credit-consumption behavior. You can add or adjust custom eligibility rules. Learn more. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Merge Risk:
|
…abel Claude's settings env beats the process env, so an empty key there means the session uses the subscription login. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude's settings env beats the process env, so a session whose settings empty ANTHROPIC_API_KEY uses the subscription login and keeps the t3-code label. Found by CodeRabbit on pingdotgg#29406, confirmed with Claude Code 2.1.316. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fails before the fix: an API key in project or local settings, or in --settings, is not seen, so the session keeps t3-code and can hit "Credit balance is too low". Reported by CodeRabbit on pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The label was chosen once when the adapter was created, from user and managed settings. An API key in project or local settings or in --settings was missed, so that session kept t3-code and could hit "Credit balance is too low". Turns and text generation now resolve it at process start, in Claude's own order: user, project, local, --settings, then managed. Files are read each time, so a new session sees edits. A wrongly typed value no longer hides the rest of a file. The local settings lookup moves to ClaudeSkills so both paths share it. Reported by CodeRabbit on pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fails before the fix: a label read from settings at startup stays after it is removed, and an instance that configures t3-code loses it when a key is present. Found by an independent review of pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Turns and text generation now start from an env holding only the label an instance configured, and add the default when each process starts. Removing a label from settings takes effect on the next session, and an instance that configures t3-code keeps it. Capability probes still use the startup label. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… label Fails before the fix: T3 Code reads a key from a settings file with a comment or a trailing comma, while Claude Code skips that file and uses the subscription. Reported by CodeRabbit on pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude Code skips a settings file with comments or trailing commas, confirmed with Claude Code 2.1.316, so its key must not remove the t3-code label. This reader also serves ANTHROPIC_BASE_URL, which now follows the same rule. Reported by CodeRabbit on pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fails before the fix: on Windows a host Anthropic_Api_Key reaches Claude, but the copied environment does not match ANTHROPIC_API_KEY, so the process keeps t3-code. The text generation test also stops depending on the runner's key. Reported by CodeRabbit on pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows, Node's process.env ignores case, but a copy of it does not. A host Anthropic_Api_Key reached Claude while T3 Code missed it and kept t3-code, and a differently cased inherited label or session variable was not dropped. Reported by CodeRabbit on pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fails before the fix: a host Claude_Config_Dir or ProgramData keeps its spelling, so T3 Code reads the wrong settings while Claude receives the configured value. Reported by CodeRabbit on pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matching a fixed list missed Claude_Config_Dir, so T3 Code read the default settings while Claude used the configured directory, and ProgramData, which hid managed settings. Instance variables are already upper-cased on Windows. Reported by CodeRabbit on pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note Written by Verified in a real dev environmentverified the launch behavior as-is at used separate main and pr checkouts, installed dependencies with
before, main with the api-key instance: after, the same prompt on the pr: recorded follow-up turn through the real claude provider: the uploaded screenshots were inspected, and the uploaded 10.8-second video played to completion and supported seeking in t3's browser. Not verifiedactual subscriber-credit spending and the original native subscription login, windows environment-name handling, macos/electron shell behavior, native ios/android clients, managed settings, and direct remote/relay/tunnel connections were not exercised. haiku 4.5's short model alias was rejected by the proxy; the successful claude app checks used supported haiku 5.5. |
Fails before the fix: a key only in managed-settings.d is not seen, so the session keeps t3-code. Windows also looked in PROGRAMDATA, while Claude Code reads C:\Program Files\ClaudeCode. Found by a Codex review of pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude Code applies managed-settings.json and then sorted managed-settings.d/*.json, skipping hidden files, as ClaudeMaintenance already does. A key only in a drop-in was missed, so the session kept t3-code. The Windows managed directory is now C:\Program Files\ClaudeCode, as in the Agent SDK, instead of PROGRAMDATA. Found by a Codex review of pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fails before the fix: settings left out by --setting-sources still change the label, and root local settings count in a checkout another user owns. Found by a Codex review of pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings left out by --setting-sources no longer change the label, confirmed with Claude Code 2.1.316. Root local settings now apply only when the current user owns the root, .git and .claude, matching the Agent SDK. Tool search uses the same lookup. Found by a Codex review of pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fails before the fix: a key under the configured root is missed, and the working directory's settings still count. Found by a Codex review of pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude Code loads project and local settings from that directory, confirmed with Claude Code 2.1.316, and T3 Code forwards the flag from launch arguments. The lookup now follows it, and resolves a relative root from the working directory. Found by a Codex review of pingdotgg#29406. Refs pingdotgg#29393 Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>



Problem
Since #28410, every Claude process T3 Code starts is labeled
CLAUDE_CODE_ENTRYPOINT=t3-code. On a Console organization that holds only the included API credits for subscribers, Anthropic answers that label withCredit balance is too low, so an API-key Claude instance fails every turn while the balance is available. T3 Code runs through the Agent SDK, which those credits cover.Fixes #29393
Change
A Claude process that authenticates with an API key now leaves the entrypoint unset, so the Agent SDK applies its own
sdk-ts, and text generation throughclaude -pgetssdk-cli.The label is chosen when each process starts, from the settings that process will load:
resolveClaudeSessionEnvironmentruns for turns inClaudeAdapterV2and for commands inClaudeTextGeneration, using their working directory. Before this, the label was chosen once, when the adapter was created.mergeClaudeBaseEnvironment, which holds only a label the instance configured, so removing a label from settings takes effect on the next session.readClaudeSessionSettingsEnvreads settings in Claude's order: user, project, local,--settings, then managed. Files are read each time, so a new session sees edits.--project-config-rootmoves project and local settings to that directory, as in Claude Code.--setting-sourcesdo not change the label.--settingsand managed settings always apply. Root local settings apply only when the current user owns the root,.gitand.claude, as in the Agent SDK. Tool search shares that lookup.managed-settings.json, then sortedmanaged-settings.d/*.json, skipping hidden files. On Windows the directory isC:\Program Files\ClaudeCode, notPROGRAMDATA. This Windows path also applies to the existing skill settings reader.ANTHROPIC_API_KEYin a higher layer counts as no key, because Claude's settings env beats the process env.process.envloses the case-insensitive lookup. This also lets T3 Code findCLAUDE_CONFIG_DIRhowever Windows spells it. Code in this repository that readsPATHaccepts the upper-case name.ANTHROPIC_BASE_URL, which follows the same rule.ClaudeAdapterV2toClaudeSkillsso both paths share it, with no change in behavior.Nothing changes for subscription logins, which keep
t3-code. A configured label from the instance or from settings still wins, and an inherited host value is still dropped, as #28410 intended.The cost is that API-key requests no longer carry the
t3-codelabel.Scope and approval
There is no maintainer approval to link, and #29393 has not been triaged yet. This began under the small bug fix exception as one condition in one function. It grew when CodeRabbit showed that a key in project or local settings, or in
--settings, would still fail, so it may now need a maintainer's view of scope. All of it serves the one problem in #29393. It keeps thet3-codedefault for subscription logins, which #28410 and #25597 were about.This does not cover keys from
apiKeyHelperor a Console/login, because they are not in the environment or the settingsenv. They keep today's behavior. Capability probes keep the label chosen at startup, because their never-yielding prompt sends no model request, according to the comment onprobeClaudeCapabilities.Verification
The problem, on one organization holding only these credits, with Claude Code 2.1.316 and desktop
0.1.7-nightly.20261102.4080:t3-code(default), Haiku 5.5 and Opus 5.5Credit balance is too lowsdk-tsset in the instance environment, Haiku 5.5 and Opus 5.5claude -pwith an API keyt3-codeCredit balance is too lowclaude -pwith an API keysdk-cli, or unsetThe Agent SDK 0.3.276 source sets
sdk-tsonly when the variable is unset, so the T3 Code row withsdk-tsis the value this change produces for turns.An empty key in settings beats the process env, checked with Claude Code 2.1.316: with an invalid
ANTHROPIC_API_KEYin the environment,claude -preturned401 Invalid API key, and with--settings '{"env":{"ANTHROPIC_API_KEY":""}}'added, it succeeded on the subscription login.Claude Code 2.1.316 also skips a non-strict settings file: with an invalid key in project settings, valid JSON returned
401 Invalid API key, while the same file with a line comment or a trailing comma succeeded on the subscription login.Claude Code 2.1.316 also ignores project settings under
--setting-sources user: an invalid key in the project file returned401 Invalid API keywith--setting-sources project, and authenticated normally with--setting-sources user.The fix, from a checkout on macOS, with a failing test committed before each fix:
expected { …(3) } to deeply equal { ANTHROPIC_API_KEY: 'key', KEEP: '1' }expected undefined to be 't3-code'expected 't3-code' to equal undefined. Text generation:CLAUDE_CODE_ENTRYPOINT was unset.mergeClaudeBaseEnvironmentmissing (TypeError)expected undefined to be 't3-code'expected { Anthropic_Api_Key: 'key', …(1) } to deeply equal { ANTHROPIC_API_KEY: 'key' }expected { Claude_Config_Dir: 'config', …(2) } to deeply equal { ANTHROPIC_API_KEY: 'key', …(2) }expected 't3-code' to be undefinedexpected undefined to be 't3-code'andexpected 't3-code' to be undefinedexpected undefined to equal 't3-code'On 562c2c7, with
mainsynced by the merge in 9d37d87:vp run check:changedpasses: format, lint, knip, graphql, typecheck, and the 5 test files beside the change, 346 tests, which includeClaudeAdapterV2.test.ts.vp test run apps/server/src/provider/ProviderRegistry.test.tspasses, 50 of 50, because the same reader servesANTHROPIC_BASE_URL.TMPDIR. With the default macOSTMPDIR,ClaudeSkills.test.ts > merges plugin enablement and selects installs in native registry orderfails. It also fails on unmodifiedmain(ac8dce0), so it is not related to this change.I could not check:
The Agent SDK types say that omitting
settingSourcesloads all sources, and the adapter omits it, so a session does load those files.managed-settings.jsonwithout drop-ins, as before this PR.ClaudeDriverline that passes the base environment to text generation. The tests cover the functions on each side of it, but not that call.visible: yes
Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code
🤖 Generated with Claude Code