Skip to content

[Bugfix #1941] consult claude lane: mode-aware login advice, set-based tool guard, npm install hint, configurable caps, docs - #1942

Merged
waleedkadous merged 15 commits into
mainfrom
builder/bugfix-1941
Nov 23, 2026
Merged

waleedkadous merged 15 commits into
mainfrom
builder/bugfix-1941

Conversation

@waleedkadous

@waleedkadous waleedkadous commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1941

Five follow-ups to the consult claude lane, found by the live review after it moved to the installed claude CLI (#1912).

Problem → root cause → fix

  1. Wrong advice in api-key mode. assertLoggedIn always said Run `claude auth login` , and a review result saying Not logged in · Please run /login was quoted with no remedy beyond the CLI's own /login. In api-key mode the fix is the key. A new claudeLoginRemedy(mode, source) gives the remedy for the mode: claude auth login in login mode; in api-key mode it names consult.claudeAuth and the file that set it, and says to check the key or remove the setting. It is used by the preflight, by codev doctor, and by classifyClaudeRun when an error result says the session is not logged in. Probed on the real claude 2.1.330: with any key set (even a bogus one) auth status reports loggedIn: true, so the preflight branch is defensive today. With no login, a print-mode run ends with Not logged in · Please run /login (is_error: true, subtype success).
  2. Tool guard failed on a harmless duplicate. The init guard also required tools.length === 3. It now compares sets: the session must report exactly Read, Glob, Grep. A duplicate is fine; an extra tool (the security half) or a missing tool still aborts.
  3. Install hint named only curl. CLAUDE_INSTALL_HINT now names both routes (native installer and npm install -g @anthropic-ai/claude-code), like CLAUDE_UPDATE_HINT.
  4. Hard-coded caps. New consult.claudeMaxTurns (positive integer, default 200) and consult.claudeMaxBudgetUsd (positive number, default 25), validated at config load beside claudeAuth; a bad value fails loudly. The cap-reached messages name the configured value and the key to raise.
  5. Docs. README and INSTALL state the claude 2.1.141 minimum. consult.md (both trees), the consult SKILL.md (all four copies) and the arch.md lane row say that withholding the API key is a billing guarantee, not secrecy: the reviewer can still read the workspace .env with its Read tool. consult.md documents the two new keys.

Also in this PR: shipped-skill-hashes.ts regenerated for the SKILL.md edit (the skill-refresh test requires it).

Noticed, not changed: when the lane is called directly with an invalid config, it throws in resolveLaneModelChoice before its try, so a stale --output file survives. That is already true for a bad claudeAuth, and real consult loads config before any lane runs.

Testing

  • New and updated tests: a logged-out status and a logged-out review result in each auth mode (lane, preflight, codev doctor); an unrelated error result gets no remedy; a duplicated tool list runs the review, while an extra or missing tool aborts; configured caps reach the claude argv and the cap messages; bad cap values are rejected at config load and fail the lane before any review; the not-found message names npm.
  • Regression check: with the five source files reverted to the pre-fix versions, 25 of these tests fail, across all four code points. With the fix, claude-cli.test.ts, claude-cli-lane.test.ts and doctor.test.ts pass: 209 passed, 1 skipped.
  • Build passes. tsc --noEmit is clean.

Flaky Tests

The full suite, run locally through porch's tests check, failed four times, each time on a different test. The load average was 29–54 from other workspaces (once 14 at the start, rising to 39 during the run). None of these tests touches this change, and each passes alone:

Test Full-suite run Alone
src/__tests__/windows-console-spawn-guard.test.ts failed 7/7 passed
src/agent-farm/__tests__/ide-command.test.ts failed (11.6s) 21/21 passed
src/agent-farm/__tests__/bugfix-1267-launch-loop.test.ts failed (21.1s) 7/7 passed
src/commands/consult/__tests__/agy-auth-cache.test.ts failed (27.2s) 27/27 passed

Local full suite skipped by owner ruling. Under that load, porch's local tests check was skipped for this phase only, by owner ruling (decision main-28, 2026-11-23). CI ran the full suite green instead. On draft PR head 30be01278, the Unit Tests job ran 415 test files (403 passed, 12 skipped), including all four tests above, and all 8 checks passed. porch's build check still ran and passed. The skip was set in the worktree's gitignored .codev/config.local.json and removed straight after; nothing under .codev is committed.

CMAP

  • codex: REQUEST_CHANGES, on branch hygiene only; it found no code defects. "39 commits behind main": not changed. Branch protection is not strict, GitHub reports the PR as mergeable, and the pull_request CI tests the merge with current main. "chore(porch): commits off-format": not changed. Those are porch's own state commits, the standard form on main.
  • claude: REQUEST_CHANGES, one real finding, fixed in 2376792. The opt-in read-only e2e test (consult-readonly-review.e2e.test.ts) called buildClaudeReviewArgs without the now-required caps. Neither the build nor CI covers that file. A tsc run over it gives TS2345 before the fix and is clean after. The test now resolves the caps the way the lane does. Declined as cosmetic: naming the config file in the cap message, and naming the specific key in the api-key remedy (the auth line already names it). Declined as out of scope: the floor in further doc locations; the DEPENDENCIES.md consult-lane row already states it.

…install hint, caps, docs)

- A logged-out answer gets the remedy for the auth mode: `claude auth login`
  in login mode, the key and consult.claudeAuth in api-key mode. Applies to
  the auth-status preflight, codev doctor, and a review result that says the
  session is not logged in (claudeLoginRemedy).
- The init tool guard compares tool lists as sets: a duplicate is fine; an
  extra or a missing tool still aborts the review.
- CLAUDE_INSTALL_HINT names both the native installer and npm.
- consult.claudeMaxTurns / consult.claudeMaxBudgetUsd make the 200-turn and
  $25 caps configurable, validated at config load; cap-reached messages name
  the configured value and the key to raise.
- Docs: claude 2.1.141 minimum in README/INSTALL; withholding the API key is a
  billing guarantee, not secrecy (consult.md, consult SKILL.md, arch.md).
…onfigurable caps

- Logged-out auth status and a logged-out review result, in each auth mode
  (lane, preflight and doctor); an unrelated error result gets no remedy.
- A duplicated tool list runs the review; an extra or missing tool aborts.
- Configured caps reach the claude argv and the cap-reached messages; bad
  values are rejected at config load and fail the lane before any review.
- The not-found message names the npm install route.
buildClaudeReviewArgs now requires caps. The opt-in #1649 read-only e2e test
still called it without them; tsconfig excludes __tests__ and vitest excludes
*.e2e.test.ts, so neither the build nor CI saw it, and the next opt-in run
would have thrown on opts.caps.maxTurns. It now resolves caps the way the lane
does (resolveClaudeReviewCaps). Found by the claude CMAP review.
@waleedkadous
waleedkadous marked this pull request as ready for review November 23, 2026 18:58
@waleedkadous
waleedkadous merged commit d1c21db into main Nov 23, 2026
8 checks passed
waleedkadous added a commit that referenced this pull request Nov 23, 2026
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.

consult claude lane: five follow-ups from the live review (api-key logged-out advice, tool-guard duplicates, npm install hint, configurable caps, docs)

1 participant