Repository navigation
[Spec 1912] consult: run the claude lane on the installed claude CLI, on the subscription - #1913
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…laudeAuth config
Everything the claude lane decides before spawning a review, built and
tested in isolation, with no consult wiring yet:
- lib/claude-cli.ts: binary resolution (CODEV_CLAUDE_BIN pin, PATH walk,
test-runner guard), the 2.1.141 version floor, auth mode, the child env
(session markers dropped; API keys withheld in login mode), auth status
parsing, the auth and binary lines, and preflightClaude, whose
ClaudePreflightError carries whichever report lines were known.
- consult.claudeAuth ("login" | "api-key"), typed in config.ts and
validated at load time in consult-lanes.ts.
- lib/dotenv.ts: the pure .env parser; consult's loadDotenv is built on it.
- test-env: CODEV_ALLOW_REAL_CLAUDE (renamed from _SDK) and
assertClaudeLaneAllowedUnderTest. vitest-setup pins a fake claude.
- A reusable stub-claude test helper, and stream fixtures trimmed from one
real CLI 2.1.326 run with the lane's argv (stdout JSON-only, init tools
exactly Glob/Grep/Read).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rtion Error-message assertions that ran a stub-backed call twice now capture the error once and match on it, halving the node processes those tests start. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ne; absolute pin Review iteration 1 (codex REQUEST_CHANGES, claude APPROVE with notes): - The auth line names the credential the CLI uses, by its precedence, and every other credential variable present in the child env. The precedence agrees with the CLI's own authMethod (probed on 2.1.326). apiKeySource is not used to pick the winner: with both API variables set it still names the key while authMethod reports the bearer token. - A relative CODEV_CLAUDE_BIN is resolved to an absolute path, so the review spawned with cwd = the workspace runs the file that was checked. - A preflight timeout reads "no answer within 30s". Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…installed claude CLI The claude lane now spawns the user's own `claude -p` (stream-json, prompt on stdin, role plus a capability note in a 0600 system-prompt file in consult's sandbox dir) instead of the Agent SDK. No SDK import is left in consult/. - buildClaudeReviewArgs: --tools Read,Glob,Grep (availability, not just approval), dontAsk + --allowedTools, no settings sources, strict empty MCP, no slash commands, no session persistence, 200 turns, $25, --add-dir sandbox - init guard: the session must report only Read/Glob/Grep before any assistant event; a mid-stream protocol failure terminates the child and waits for its exit before the lane fails - distinct failures: no result (exit code + bounded stderr tail), exit 0 with no result, non-JSON line, error subtype, is_error result (names the credential), "Prompt is too long" (context exhaustion, model id, #1641) - SIGINT/SIGTERM: terminate the child, remove the temp file and stale --output, exit 130/143; handlers are removed after every run - CLI permission denials are named on stderr, since dontAsk denies silently - SDK_MODELS -> RUNNER_LANES; SDKResultLike -> ClaudeResultLike - assertClaudeVersion rejects a malformed version instead of comparing NaN (phase_1 review nit) Tests: new claude-cli-lane.test.ts; consult, bugfix-1754, lane-models and tripwire-wiring drive a stub claude instead of mocking the SDK; the obsolete claude-auth-env test is removed (its #985/#1754 cases live in claude-cli.test.ts); the opt-in read-only e2e drives the real CLI with the lane's argv. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…CLI; drop the Agent SDK codev doctor's Claude rows now check what the claude lane actually runs, with no model call: - "AI CLI Dependencies": resolveClaudeBin + readClaudeVersion + assertClaudeVersion. A missing claude (install hint) or one below 2.1.141 (`claude update`) is a warning, and claude counts as installed only when the row is ok, so a codex-only machine still meets the one-working-model rule. - "AI Model Verification": `claude auth status` with the child env the lane would build (workspace .env merged into a copy of process.env, then consult.claudeAuth and buildClaudeChildEnv). A withheld key is reported with its origin; logged out, unparseable output, a missing api-key-mode key or a bad consult.claudeAuth are warnings carrying the lane's own message. The SDK probe (a one-turn model session with bypassPermissions) is gone, and with it the last import of @anthropic-ai/claude-agent-sdk, which is removed from package.json and the lockfile. The lockfile diff deletes the SDK, its @anthropic-ai/sdk dependency and their exclusive packages (sharp natives, json-schema-to-ts, ts-algebra); no version changes. It also marks @modelcontextprotocol/sdk's subtree optional: that is now reachable only through @google/genai's optional peer. describeWithheldKeys is factored out of describeClaudeAuth so doctor and the auth line word the withheld-key note identically. The Bugfix #341 comment in cli.ts no longer names the Claude Agent SDK. Tests: doctor.test.ts drops the SDK mock and keeps execFileSync real, so the Claude cases run a stub claude: scenarios 27-31, plus .env/shell keys withheld (process.env untouched), api-key mode and unparseable auth status. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t guard; thread: phase_3 reviews Co-Authored-By: Claude Opus 5.5 <[email protected]>
…claude CLI, in every tree CLAUDE.md/AGENTS.md, the consult and codev skills (four copies each), and consult.md in codev/ and codev-skeleton/ now describe the installed `claude` CLI on the user's login. They document consult.claudeAuth (login by default, api-key as the opt-in, which is the breaking change for key-only CI), CODEV_CLAUDE_BIN and CODEV_ALLOW_REAL_CLAUDE. codev.md's doctor section names the CLI check. Skill hashes are regenerated, and the [From 0120] lesson gets a Spec 1912 note. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… named Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e does; claudeAuth source wording The [CLAUDE] warning example now shows the quoted path excerpt() emits, and the consult.claudeAuth bullet says the auth line names the file that set consult.claudeAuth. Thread: phase_4 reviews, the release-note draft, and the pre-1912 global consult billing the API key from .env. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…DEPENDENCIES floor row Co-Authored-By: Claude Opus 5.5 <[email protected]>
… successful review fails PR review iter1 (codex): the runtime guard accepted any subset of the review tools. It now also fails on a missing or repeated tool. Claude's notes: a success result with no assistant text fails instead of writing an empty --output, and the floor comment says what was verified at 2.1.105. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ailure Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Thank you, this is careful work: Independent integration reviews: codex APPROVE, claude APPROVE. CI 8/8 green. Three small fold-ins before it goes to the owner:
Targeted tests only, please. |
…ls, doctor honours a .env pin Architect PR review fold-ins: - Init-guard failures say what they found instead of "write or shell tools" and name the way out: pin a known-good claude with CODEV_CLAUDE_BIN. - CLAUDE_UPDATE_HINT covers both install routes (claude update / npm). - resolveClaudeBin(env): doctor resolves from its .env merge, as consult does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
waleedkadous
added a commit
that referenced
this pull request
Nov 17, 2026
waleedkadous
added a commit
that referenced
this pull request
Nov 17, 2026
This was referenced Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
consult -m claudeno longer uses the bundled Claude Agent SDK. It runs the user's installedclaudeCLI in read-only print mode (claude -p --output-format stream-json). By default it uses the CLI's own login, which is the subscription for most people.ANTHROPIC_API_KEYandANTHROPIC_AUTH_TOKENare withheld unlessconsult.claudeAuth: "api-key"opts in.codev doctorchecks the installed CLI with no model call, and@anthropic-ai/claude-agent-sdkis removed.Closes #1912
Changes
lib/claude-cli.ts(new): binary resolution (CODEV_CLAUDE_BINpin, elsePATH; refused unpinned under a test runner) and a version floor (CLAUDE_MIN_VERSION = 2.1.141). Also the auth mode (consult.claudeAuth:logindefault |api-key, validated at config load), the child env (session markers and, by default, API credentials removed;process.envnever mutated), theauth status --jsonpreflight, and the[CLAUDE] binary:/[CLAUDE] auth:lines.claude -p --output-format stream-json --verbose --tools Read,Glob,Grep --permission-mode dontAsk --allowedTools Read,Glob,Grep --setting-sources "" --strict-mcp-config --disable-slash-commands --no-session-persistence --max-turns 200 --max-budget-usd 25 --model <id> --system-prompt-file <0600 file> --add-dir <sandbox>, with the prompt on stdin.consultant.mdis unchanged.permission_denialsare reported on stderr.claude auth status, using the lane's env, so withheld.envkeys are reported truthfully). No model call.packages/codev/package.jsonandpnpm-lock.yaml. The lockfile has no version changes; it marks 54@modelcontextprotocol/sdk-subtree packagesoptional: true.CLAUDE.md/AGENTS.md(byte-identical), theconsultandcodevskills (4 copies each, hashes regenerated),consult.mdandcodev.md(both trees),DEPENDENCIES.md(both trees), andarch.md/lessons-learned.md(cold tier).arch.md's pre-SDK claude spawn line and its stale "Claude nesting limitation" paragraph;codev.md's doctor section, which listed@anthropic-ai/claude-code.Testing
helpers/stub-claude.tsrecords argv, env and stdin, and replays fixtures captured from a real 2.1.326 stream):claude-cli.test.ts,claude-cli-lane.test.ts, plus migratedconsult,doctor,bugfix-1754-dotenv-auth,lane-models,tripwire-wiring,metrics,consultant-roleandtest-isolation. No live model calls in the suite.consult -m claude --protocol bugfix --type pr --issue 1821. Exit 0, VERDICT COMMENT,--outputbyte-identical to stdout. Metrics row: claude-opus-5, 148.9 s, 18 / 186,510 cached / 11,019 tokens, $0.7473. stdout was JSON-only, with no hook or plugin output.dontAsk+--add-dirpermits the sandbox (PR-diff) read:permission_denials: [].consult-readonly-review.e2e.test.ts(nowCODEV_ALLOW_REAL_CLAUDE). The owner's standing order bars the local e2e suite.Flaky Tests
Pre-existing tests, untouched here. They failed once under load in a porch run and passed alone (48/48):
consult/__tests__/agy-auth-cache.test.ts,agent-farm/__tests__/pir-1233-session-launch-loop.test.tsandagent-farm/__tests__/bugfix-1267-launch-loop.test.ts.Release note (ready to paste)
consult: the claude lane now runs your installed
claudeCLI, on your subscription (#1912).consult -m claudeno longer uses the bundled Claude Agent SDK. It runs theclaudeon yourPATH(2.1.141 or newer, orCODEV_CLAUDE_BIN) in read-only print mode, so upgradingclaudeupgrades the lane. It uses the CLI's own login by default, which for most people is the Claude subscription.ANTHROPIC_API_KEYandANTHROPIC_AUTH_TOKENare withheld from it, whether set in the shell or in the workspace.env, and the[CLAUDE] auth:line says when a key was ignored. Breaking for key-only environments: a CI job withANTHROPIC_API_KEYand noclaudelogin now fails loudly. To keep billing the API, add"consult": { "claudeAuth": "api-key" }to.codev/config.json.codev doctornow checks the installedclaudeversion and login, with no model call. The@anthropic-ai/claude-agent-sdkdependency is removed. The test-only opt-inCODEV_ALLOW_REAL_CLAUDE_SDKis renamedCODEV_ALLOW_REAL_CLAUDE.Spec
codev/specs/1912-consult-run-the-claude-review-.md
Review
codev/reviews/1912-consult-run-the-claude-review-.md
🤖 Generated with Claude Code