You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
consult: workspace .env silently overrides the Claude lane's credentials (no log line); surfaces as 'org monthly usage limit' with no review #1754
consult -m claude --type integration --issue N failed 4 of 4 times in an adopter workspace. Right after [CLAUDE] model: claude-opus-5 the only output was You have hit your org monthly usage limit, and no review text was produced. Yet on the same machine and login, all of these worked: plain claude -p, a raw Agent SDK query() (including an 83 KB prompt, maxBudgetUsd, bypassPermissions, tools), and a node one-liner importing runClaudeConsultation() from dist/commands/consult/index.js with the identical prompt, role, workspaceRoot and model choice.
Root cause
The CLI entry (runConsultation, packages/codev/src/commands/consult/index.ts:2396) calls loadDotenv(workspaceRoot), which copies every key from <workspaceRoot>/.env into process.env when the shell does not already define it. The direct import, claude -p and raw query() never read that file.
The adopter's .env defines CLAUDE_CODE_OAUTH_TOKEN and ANTHROPIC_API_KEY. Once the OAuth token is injected, buildClaudeConsultEnv (issue #985 behaviour) strips the API key, and the SDK subprocess authenticates as the org that token belongs to, which had exhausted its monthly usage. The keychain login that every other path uses was fine. Nothing is logged about the .env load or which credential the lane will use, so the failure is indistinguishable from a real account limit.
Verified by reading .env key names in the affected workspace (values not inspected).
Fix (prescribed)
Before dispatching the claude lane, log the credential source on stderr in the same style as the model line, e.g. [CLAUDE] auth: CLAUDE_CODE_OAUTH_TOKEN (from .env) / (from shell) / keychain login. Mirror for the codex lane if it reads .env keys too.
When the assistant text of a consultation matches a usage-limit / out-of-usage reply and no review body follows, exit non-zero and do not write the output file. Today the run "succeeds" with the limit message as its output.
Consider whether loadDotenv should inject credential variables at all. At minimum, document in the consult skill that <workspace>/.env credentials take effect for consult and override the keychain login.
Protocol: BUGFIX. Keep .env loading for non-credential keys unchanged unless the builder finds no consumer.
Testing
Unit: loadDotenv + buildClaudeConsultEnv with a fixture .env containing CLAUDE_CODE_OAUTH_TOKEN; assert the auth log line names .env as the origin.
Unit: a stubbed SDK stream whose only assistant text is an out-of-usage message yields exit 1 and no output file.
Manual: in a workspace whose .env carries an OAuth token for an exhausted org, consult -m claude must name the credential source and fail loudly instead of printing the limit text as a review.
Activity
waleedkadous commentedon Sep 29, 2026
On it! Working on a fix now.
Fix #1754: name the consult lanes' credential source and fail on is_e…
[Bugfix #1754] Thread log: investigate + fix notes
[Bugfix #1754] Report every Claude provider switch, in the CLI's order
[Bugfix #1754] Thread log: CMAP results
[Bugfix #1754] Keep metrics on is_error results; phrase credential as…
[Bugfix #1754] Thread log: integration review changes
Merge pull request #1755 from cluesmith/builder/bugfix-1754
[Spec 1912][Phase: phase_2] feat: run the claude consult lane on the …