Start from this brief. Whoever wrote it has already explored the codebase and put the plan, paths, and context you need into it — take that as your starting point and don't re-derive the overall architecture or re-discover what the brief already covers. But DO read whatever you actually need to implement the task correctly: the files you're changing, their tests, their callers and direct dependencies. That is expected, not wasteful re-exploration. What to skip is redundant open-ended surveying — broad codebase-wide greps or re-mapping whole subsystems the brief already describes. If the brief is missing something you genuinely need, read the code to get it (or flag a real gap in the plan) — don't guess, and don't stop short.
COR-1436: entire experts re-derives the repo ULID it already has
entire experts --repo owner/repo resolves the repo's ULID by fetching the caller's ENTIRE repo listing from entire-api and linear-scanning it for a matching full_name. It already holds that ULID: the cell-resolution step one line earlier resolved it from core and threw it away.
runExperts (cmd/entire/cli/experts_cmd.go, ~line 214) does two resolutions:
Core, by slug — newExpertsAPIClient → NewAuthenticatedEntireAPICellClient (cmd/entire/cli/api_client.go, ~66) → resolveRepoCellTarget (cmd/entire/cli/cell_target.go, ~70) → resolveProcessingPlacement → lookupRepoIndexEntry, which calls core with ListReposParams{Filter: fullName}, picks Primaries.Processing, finds it in Placements[], rejects failed/suspended, and dials that cell.
entire-api, by slug again — resolveExpertsRepoID (~404) → listExpertsAccessibleRepos (~427) → GET /api/v1/repos → linear scan of repos[] for a case-insensitive full_name match to get id.
Step 2 is redundant. resolveRepoCellTarget's own doc says the owner/repo path "delegates to resolveRepoCellPlacement ... and discards the placement id". And resolveRepoCellPlacement (cell_target.go, ~291) returns exactly what experts needs:
go
type repoCellPlacement struct {
// RepoID is the placement id (coreapi.RepoPlacement.ID), which entire-api
// uses as its repo_id — verified identical to the id the old
// mirrors-based lookup used (coreapi.Mirror.MirrorId) for the same placement.
RepoID string
// Target is the cell hosting THIS placement.
Target *auth.CellTarget
}
auth.CellTarget is only {BaseURL, Jurisdiction}, which is why the id is lost between the two steps.
The fix
explain already does this correctly — copy it.cmd/entire/cli/explain_repo.go, ~line 36 calls resolveRepoCellPlacement and uses placement.RepoID. Read that first; it is the pattern.
Change experts to resolve once:
For the owner/repo form, call resolveRepoCellPlacement(ctx, owner, repo) and use placement.RepoID as the repo id and placement.Target for the cell client.
Delete resolveExpertsRepoID, listExpertsAccessibleRepos, expertsRepoListItem and expertsReposListPath, plus their tests.
Keep expertsAPIPath(repoID) — the POST /api/v1/repos/{id}/experts call is unchanged.
The ULID form is unaffected: repoIsULID already short-circuits resolution and passes the id straight through. Do not change that branch.
You will need the cell client built from the placement's Target rather than from newExpertsAPIClient(ctx, insecureHTTP, fullName, ulid). Look at how explain_repo.go gets its client from a repoCellPlacement and follow it. newExpertsAPIClient exists as a test seam (setExpertsClientFactoryForTest) — keep a seam of equivalent shape so the existing tests can still substitute a stub, but it may need a different signature now.
Do NOT re-implement the id-from-placement logic. The single most important property, from resolveRepoCellPlacement's doc:
a placement id is only resolvable by the cell hosting that placement ... Taking the id from one placement and routing to a cell chosen some other way asks a cell about an id it has never seen, which comes back as an indistinguishable 404.
Using the RepoID and Target from the SAME repoCellPlacement is exactly what preserves that. Don't split them or re-resolve either half.
While you are there, update resolveRepoCellPlacement's doc comment — it says the placement id is one "which resolveRepoCellTarget has no caller for", and that stops being true.
Behaviour changes to expect (and state in the PR)
Error messages change, for the better. Today a miss produces resolveExpertsRepoID's three-guesses message: "repo %q was not found on the entire-api cell this command reached. It may be homed in another Entire region ... not onboarded to Entire, or outside your access". Core's resolution instead distinguishes not-onboarded from a failed/suspended placement and says which. Check errRepoNotOnboarded and renderRepoNotOnboarded — runExperts already handles the not-onboarded render for the client-construction failure, so make sure the same handling still applies now that resolution happens earlier/differently, and that no error gets double-wrapped (cellPlacementError and resolveProcessingPlacement both deliberately avoid naming the repo twice — read those comments before adding a wrap).
A latent public-repo bug is fixed. entire-api's /repos is the affiliation set (repo/list, which excludes the public_viewer wildcard), so today entire experts --repo owner/repo on a public repo the caller can read but does not belong to reports "not found" — even though the POST .../experts behind it is repo#pull-gated and would have succeeded. Core's filtered lookup is scoped to what the caller can read, so routing through it fixes this. This is NOT reproduced — do not claim it as fixed in the PR unless you can show it; describe it as expected.
Tests
There are existing experts tests (cmd/entire/cli/experts_cmd_test.go or similar) using the setExpertsClientFactoryForTest seam, and cell-resolution tests around cell_target.go. Read both before changing the seam.
Cover:
The owner/repo form resolves via resolveRepoCellPlacement and posts to /api/v1/repos/{placement.RepoID}/experts — with NO call to GET /api/v1/repos. That absence is the regression guard; assert it, don't just assert the happy path.
The ULID form still bypasses resolution entirely.
Not-onboarded and failed/suspended-placement errors surface with their own messages, not double-wrapped.
Delete the tests that covered resolveExpertsRepoID / listExpertsAccessibleRepos along with the functions.
Verification
Run the repo's checks — see Makefile / CLAUDE.md (go test ./..., vet/lint). Report honestly what you ran and what passed; if something can't run in the worktree, say so rather than claiming green.
Deliverable
Commit on the worktree branch and open a PR. Put the handoff in the PR description — do NOT write a HANDOFF.md or any similar summary file into the repo.
The PR description must state: what now resolves the repo id, what was deleted, how the test seam changed, which error messages change and why that is an improvement, and what you tested.
Context worth knowing
This is the last known caller of entire-api's GET /repos, which we want to retire (COR-1370). The other two consumers already moved off it: entire.io's dispatch on 2026-09-01, and mcp's list_entire_repos on 2026-09-02. This change stops NEW CLI builds calling it; released versions in the wild will keep calling until they age out, so the endpoint can't be deleted immediately — that's tracked separately, not your concern here.
Assistant
Now the constant and the main resolution logic:
Assistant
Now update expertsAPIPath and remove the dead functions:
Assistant
Now let's rewrite the test file to match the new resolution flow and seam signature.
Assistant
Let me clean these up and trim over-commenting throughout the new/edited code.
Assistant
This is fine—reasonably concise, matching the codebase's existing style. Now let me trim the test file comments per the feedback.
Assistant
Now let's trim a few other overly-verbose comments in the file (withExpertsFakeCellCore, withExpertsFakeClient, test doc comments):
Assistant
That's reasonably concise already. Now let's fix the missing io import (I used io.NopCloser but didn't import io).
Assistant
Now let's build and run the relevant tests.
Assistant
Build passes. Now run the experts test package.
Assistant
All 31 experts tests pass. Let's also check gofmt/vet and the full package test suite for the cli package to be safe.
Assistant
No formatting issues. Now let's run vet and the full lint/check for these files, plus the whole test suite for the package to be safe.
Assistant
fmt made no changes to content (just ran cleanly). Now lint:
Assistant
Need to remove the unused nolint directive.
Assistant
Lint is clean. Now run the full test suite (unit + integration per CLAUDE.md).
Assistant
All unit tests pass. Now integration tests:
Assistant
Confirmed — these fail on a clean HEAD too, unrelated to my changes (a local git/environment issue with tag messages). Let me restore my work.
Assistant
Restored. Now drop the stash entry.
Assistant
Let's confirm my changes are back and re-verify the build/tests still pass.
Assistant
All good. Now let's run the E2E vogon canary tests as required by CI, then commit.
Assistant
All canary tests pass. Now let's commit and open the PR.
entire experts --repo owner/repo now resolves its repo id via resolveRepoCellPlacement (the same control-plane lookup that already resolves the cell), instead of throwing that id away and re-deriving it with a second GET /api/v1/repos linear scan.
Deleted resolveExpertsRepoID, listExpertsAccessibleRepos, expertsRepoListItem, expertsReposListPath — expertsAPIClient is now POST-only, so the regression is structurally impossible to reintroduce.
Test seam (newExpertsAPIClient/setExpertsClientFactoryForTest) now takes a resolved *auth.CellTarget rather than (fullName, ulid).
Not-onboarded / failed-placement errors now go through the shared control-plane error path instead of the old three-guesses message.
Verified: mise run fmt && lint clean, full unit suite (10333 tests) passes, integration suite passes except 3 pre-existing TestPluginRemoteInstall_* failures I confirmed also fail on a clean main checkout (unrelated git-tag environment issue), and the E2E Vogon/roger-roger canary (60 tests) passes.
User
can you build and test the build cli binary against staging to ensure no behavioural changes
Assistant
Old binary built. Now let's switch to a staging auth context and find a mirrored repo to test against.
Assistant
Excellent — it works end-to-end against staging. Now compare against the old binary with the same command.
Assistant
Identical output. Now let's test the human-readable (non-JSON) path, the ULID form, and a few error paths.
Assistant
Now let's get the placement ULID from the JSON's implied repo id to test the ULID form (need the actual repo ULID used in the path — let's find it via API debug or the trail/checkpoint commands).
Assistant
Processing placement id is 01KSDZA7WJESDA62B8TPA1HQDJ. Let's test the ULID form against both binaries.
Assistant
ULID form also matches identically. Now let's test the not-onboarded error path against a real non-onboarded repo, to see the (expectedly different) error messages.
Assistant
All parity checks pass. Let's clean up the temp worktree and files.
Assistant
Restored your active auth context to prod. Everything's clean.
Result: no behavioral changes. I built both the old (parent commit) and new binaries and ran them against staging (ENTIRE_API_BASE_URL=https://partial.to, entire auth use us.auth.partial.to) on the real entireio/cli repo:
owner/repo form (--repo entireio/cli) — JSON output, human text output, and stderr all byte-for-byte identical between old and new binaries.
ULID form (--repo 01KSDZA7WJESDA62B8TPA1HQDJ, the repo's actual processing placement id from the control plane) — identical.
Not-onboarded error (--repo torvalds/linux) — identical message and exit code (both already routed through the same errRepoNotOnboarded path since cell resolution runs before the repo-id lookup in both versions).
I did not manage to reproduce the "public repo caller can read but isn't affiliated with" scenario mentioned in the PR as an expected-but-unverified fix — didn't have a suitable repo on hand to test it against staging, so that claim stays as stated in the PR (expected, not verified).
User
remove it from the PR statement if it's not something you can prove
Assistant
Done — removed the unverified public-repo-bug claim and added the staging parity testing I actually performed to the test plan instead.
User
fewer comments!
User
no ticket numbers in comments too
User
don't over comment, code should be self-explanitory
Assistant
Let me verify each finding against the code, starting with the two "dead code" ones (highest severity).
Assistant
Now let's apply the fixes. First, the comment fix (finding #5) and ULID casing + comment trim (finding #1):
Assistant
Now finding #4 (unreachable split) and #7 (dead renderRepoNotOnboarded guard):
Assistant
Now finding #1's second part — trim the stale-sounding comment on expertsAPIReposPath:
Assistant
Now let's trim the other comments I just added to be more concise, and simplify per feedback:
Assistant
That one's fine (single short comment explaining non-obvious behavior). Let's check the others I added:
Assistant
Now finding #2 — update the test with the assertion and rename:
Assistant
I'll narrow the signature to (ctx, insecureHTTP, fullName string) since experts no longer routes through this wrapper.
Assistant
Let's check for any other callers/tests of NewAuthenticatedEntireAPICellClient.
Assistant
No other callers. Now let's apply the CLAUDE.md fix (finding #6):
Assistant
Now let's remove the stale COR-666 reference in api_client.go's docstring... already done above (I removed COR-666 from the doc I edited). Let's verify build and run the full test/lint suite.
Assistant
Now let's rebuild, format, lint, and re-run tests.
Assistant
That's expected — gofmt doesn't apply to markdown. Fine.
Assistant
All still passing. Let's run full lint to make sure nothing's broken.
Assistant
Clean. Now let's run the full unit suite once more to be safe, then commit.
Assistant
All green. Now let's commit and resolve the addressed findings, then push.
Assistant
Now let's mark the addressed findings resolved.
Assistant
All 7 findings addressed and resolved, pushed as 36e518429:
Both medium findings were real bugs in the refactor: the renderRepoNotOnboarded guard around the client-construction error was unreachable (the auth package can't produce errRepoNotOnboarded — no import path exists), and CLAUDE.md's cell-routing section still described the old wrapper-based routing.
Low findings: normalized ULID casing before it hits the entire-api path segment, removed an unreachable strings.Cut error branch, dropped the now-dead ulid param from NewAuthenticatedEntireAPICellClient (only remaining caller always passed ""), pinned the ULID test's cell-target assertion, renamed it to reflect what it actually skips, and trimmed a comment that described deleted code.
Verified with go build, mise run lint (clean), and mise run test (10333 tests, all pass) after every change.