Done. Addressed the Copilot review comment on PR #1332.
What the comment flagged
enumerateRepoCandidates resolved the committed-read topology (and thus the v1.1 mirror opt-in) through ResolveCommittedRefs(ctx) → settings.Load(ctx), which reads settings relative to the process cwd unless settings.WithWorktreeRoot is set. But repoRoot can differ from cwd via --repo/RepoPaths, or cwd may not be a repo at all — so the mirror opt-in could be read from the wrong place, causing v1.1 custom-ref reads to be missed or misapplied.
I verified the claim against the code: ResolveCommittedRefs is the only settings-dependent piece, and the two callers (SyncCommittedReadRef, NewCommittedReadStore) were passed the unscoped ctx. The GitStore reads (ListCommitted/ReadCommitted/ReadSessionMetadata) bind to the topology ref at construction, so they didn't need scoping.
Fix
mode_local.go: derive repoCtx := settings.WithWorktreeRoot(ctx, repoRoot) and pass it to SyncCommittedReadRef / NewCommittedReadStore.
mode_local_test.go: added TestLocalMode_ExplicitRepoResolvesMirrorOptInFromTargetRepo — the target repo opts into the mirror with its checkpoint only on the custom ref, while cwd is a separate mirror-off repo. This genuinely exercises the path; the existing TestLocalMode_ExplicitRepoUsesTargetRepoCheckpointSettings read a v1-branch checkpoint that surfaces regardless of which settings are consulted, so it didn't catch the bug.
Verification
- New test fails on the unfixed code (
got []) and passes with the fix — confirmed by stashing the implementation change.
mise run fmt && mise run lint — clean (0 issues).
mise run test:ci — unit + integration + e2e canary all green (exit 0).
Committed (b08796859), pushed to the PR branch, and replied in the review thread.