Skip to content

consult: project auto-detect fails in slugless builder worktrees (.builders/bugfix-N) and dumps every project name #1898

Closed

Description

@waleedkadous

Problem

From a builder worktree named .builders/bugfix-<N> (no slug), consult -m codex --protocol bugfix --type pr --output <file> exits 1 without running a review. The only output is:

Model: codex
Review type: pr (protocol: bugfix)
Multiple projects found: <every directory under codev/projects/, comma-separated, on one line>

In a repo with ~2300 project directories that line is ~95,000 characters. It gives no hint to pass --issue and does not name the worktree it failed to match. The same command with --issue <N> works. Reported by an adopter on consult 3.3.7, hit twice in one evening by two builders. The consult skill says a builder context auto-detects, so builders trust it.

Root cause

getBuilderProjectState() in packages/codev/src/commands/consult/index.ts (around line 341) disambiguates with:

cwd.match(/\.builders\/[^/]*?-?(\d+)-([^/]+)/)

This requires a -<slug> after the number. Current worktrees are slugless (.builders/bugfix-1880, .builders/spir-12), so the match fails and the code falls through to the bare Multiple projects found: ${projectDirs.join(', ')} throw. Verified:

cwd matches
.builders/bugfix-7438 no
.builders/bugfix-7438/packages/x no
.builders/bugfix-7438-some-slug yes
.builders/spir-12 no

The tracker-key branch (ISSUE_KEY_SOURCE) does not catch it either. Porch-driven runs are unaffected because porch passes --project-id; only hand-run consults in a builder worktree hit this.

Fix

  1. Make the worktree-ID match accept a slugless folder: number followed by -, / or end of string. Better still, resolve the builder's project the same way porch does for the worktree, rather than a second regex.
  2. Never print the project list. All three throws at lines 348 to 359, and the Available: list at line 334, should print one short line: the worktree ID that was tried (if any), the count of projects, and "pass --issue or --project-id ".

Testing

Unit tests for getBuilderProjectState with cwd at a slugless worktree root, a subdirectory of it, a slugged worktree, and a tracker-key worktree, each with multiple project dirs. One test asserting the no-match error stays under a small length bound with 2000+ project dirs.

Activity

  1. added
    area/consult
    on Nov 14, 2026
  2. waleedkadous commented on Nov 14, 2026

    @waleedkadous
    ContributorAuthor

    On it! Working on a fix now.

  3. added 2 commits that reference this issue on Nov 14, 2026
    453eff8
    435d1f4
  4. waleedkadous commented on Nov 15, 2026

    @waleedkadous
    ContributorAuthor

    Fixed by PR #1899 (merge commit d3ffaa1). Consult now resolves the worktree's project with porch's detector, and not-found errors are one short line. On main; not yet in a published release.

  5. added a commit that references this issue on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/consult

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions