Stop CLI Polling for Empty Mirrors · Entire

We're most of the way through a change where the CLI will stop polling if the mirror is known to be empty

1mo ago·5m·27 calls

Understood — leaving it test-free, consistent with the existing RunE-flow convention.

The change is complete and verified. Final state of the working tree:

go build ./..., mise run lint (0 issues), and coreapi + mirror tests all pass. Nothing is committed — let me know if you'd like me to commit, or run the full mise run check before you push.

commit

1mo ago·6m·5 calls

Committed on dont-poll-empty-mirrors as 93735addc:

repo mirror create: skip clone polling when upstream is empty

All 5 files (CLI + regenerated coreapi client + spec) are in one commit. mise run check passed before committing (the earlier FAIL was a flake that didn't reproduce). Let me know if you'd like me to push or open a PR.

93735addrepo mirror create: skip clone polling when upstream is empty

CreateMirror now returns empty: true when the upstream has no refs to clone. In that case there is no initial GitHub→EntireDB clone to wait for, so entire repo mirror create prints a short note and returns instead of polling the smart-HTTP probe until the wait-timeout expires.

Regenerates the coreapi client from the updated spec (ogen v1.20.3).

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Entire-Checkpoint: 0e34d9843cd3+50/-11

Cursor said: "Empty skip hides suspension hint
Medium Severity
When created.Empty is true, mirror create returns immediately and never runs waitForMirrorClone. For an existing placement (created false), that bypasses the repo-scoped token exchange that triggers explainSuspendedMirror on suspended mirrors—users can see a success-style empty-upstream message instead of the resume guidance."

Copilot said: "The new created.Empty early-return path isn’t covered by tests. Since repo_mirror_test.go exists for this command set, it’d be good to add a regression test that simulates a CreateMirror response with empty: true and asserts the command prints the “nothing to clone” note and does not enter the clone-wait/polling path."

1mo ago·10m·29 calls

Both review comments are addressed and committed as 499e9abd0.

Cursor (the real bug — medium): An existing, suspended mirror with an empty upstream now still gets diagnosed. The early-return on Empty used to skip waitForMirrorClone, which is the only place the repo-scoped token exchange runs (and that exchange's invalid_target/ErrRepoTargetUnknown is what explainSuspendedMirror keys on). I split the flow into finishMirrorCreate:

Copilot (test): Splitting the decision out with the probe and wait injected made it unit-testable without the auth/control-plane stack. TestFinishMirrorCreate covers all eight branches — including asserting the empty path never polls, a fresh create never probes, and a suspended empty mirror returns a SilentError with resume guidance instead of the success note.

mise run fmt, mise run lint (0 issues), and mise run test:ci all pass. The branch now has two commits: the original feature + this fix.

499e9abrepo mirror create: still detect suspension on empty existing mirrors

The empty-upstream skip returned before waitForMirrorClone, which is also where the repo-scoped token exchange runs — the only signal that surfaces a suspended placement. So an existing, suspended mirror with an empty upstream showed a success-style "nothing to clone" note instead of the operator resume guidance.

Split the post-create flow into finishMirrorCreate: an empty upstream still skips the HEAD-poll loop (an empty repo never advertises a HEAD, so polling would only spin to the timeout), but an existing empty placement now runs the token-exchange probe so suspension is diagnosed. A fresh create still skips both — it can't be suspended. A non-suspension probe error stays non-fatal, since the placement exists and is genuinely empty.

The probe and wait are injected so the branching is unit-tested in TestFinishMirrorCreate without the auth + control-plane stack.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Entire-Checkpoint: c7a7f4be5684+207/-24