feat(checkpoint): discover refs-native checkpoints on a second device via List remote enumeration#1771
Open
suhaanthayyil wants to merge 4 commits into
Open
feat(checkpoint): discover refs-native checkpoints on a second device via List remote enumeration#1771suhaanthayyil wants to merge 4 commits into
suhaanthayyil wants to merge 4 commits into
Conversation
Under a git-refs primary, a second device running `entire checkpoint list` saw zero refs-native checkpoints: storage-level List enumerated local refs only, and the on-demand ref fetcher is ID-keyed (it can fetch a known checkpoint, not discover which exist). PR #1719 healed this for the git-branch backend by fetching the v1 metadata branch, but refs- native checkpoints do not live on that branch, so the symptom survived. Add opt-in remote discovery to the git-refs List: when the context is marked with WithRemoteListDiscovery and a remote lister is configured, List runs a single `git ls-remote refs/entire/checkpoints/*` (names only, no object transfer) and surfaces checkpoints that exist on the remote but have no local ref yet. Each discovered checkpoint's CreatedAt is recovered from its ULID timestamp so it sorts correctly, and its contents are hydrated lazily on the next read via the existing ID-keyed fetch. Enumeration follows the same authority rule as #1719: with a checkpoint_remote configured it queries that remote, never origin; with none configured it is a no-op, so List stays local-only and default behavior is unchanged. The discovery marker is set only on user-facing enumeration (`checkpoint list` / the branch `explain` view), never the per-turn commit hook, so the hot path stays network-free. Enumeration is best-effort: an ls-remote failure logs and returns the local list. Closes #1770 Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds opt-in remote discovery for the git-refs checkpoint backend so that a second device can discover refs-native checkpoints that exist only on the configured checkpoint_remote, without fetching checkpoint objects up front. It extends the checkpoint store interface via a remote-ref listing seam, recovers CreatedAt from ULID timestamps for correct sorting, and wires the feature into user-facing enumeration paths (while keeping hook hot paths network-free).
Changes:
- Add a
RemoteRefListFuncseam andWithRemoteListDiscoverycontext marker sogitRefsStore.Listcan enumerate remote checkpoint refs via a singlegit ls-remote(names only) and append remote-only checkpoints for lazy hydration. - Add
CheckpointID.Time()(ULID timestamp recovery) to support correct recency sorting for remote-discovered (not-yet-hydrated) checkpoints. - Wire remote ref listing through
checkpoint.Open(...)and enable discovery for the branchexplainview; add docs + tests covering discovery, parsing, and routing-store behavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/architecture/ref-checkpoint-backend.md | Documents storage-level List behavior and the new opt-in remote discovery flow. |
| cmd/entire/cli/git_operations.go | Adds ListCheckpointRefsOnRemote and parseCheckpointRefNames for checkpoint-remote-scoped ls-remote enumeration. |
| cmd/entire/cli/git_operations_test.go | Adds unit + “real ls-remote” tests for parsing and authority gating behavior. |
| cmd/entire/cli/explain.go | Opts user-facing branch explain enumeration into remote discovery via WithRemoteListDiscovery. |
| cmd/entire/cli/checkpoint/routing_store_test.go | Verifies discovery flows through the routing store union listing. |
| cmd/entire/cli/checkpoint/registry.go | Threads RemoteRefLister through the backend factory env wiring. |
| cmd/entire/cli/checkpoint/refs_store.go | Implements remote discovery in List and context marker helpers. |
| cmd/entire/cli/checkpoint/refs_store_test.go | Adds coverage for discovery opt-in behavior, dedupe, and best-effort failure handling. |
| cmd/entire/cli/checkpoint/open.go | Adds OpenOptions.RemoteRefLister and passes it through to backend construction. |
| cmd/entire/cli/checkpoint/id/id.go | Adds CheckpointID.Time() to recover creation time from ULIDs. |
| cmd/entire/cli/checkpoint/id/id_test.go | Adds tests for CheckpointID.Time(). |
| cmd/entire/cli/checkpoint/fetching_tree.go | Introduces the RemoteRefListFunc type used by the git-refs store. |
Shorten ls-remote discovery timeout to 5s, pin FetchURL/ls-remote to the worktree root, and mint the ULID Time() fixture with deterministic entropy. Co-authored-by: Cursor <cursoragent@cursor.com>
Names-only remote-discovered CheckpointInfos left SessionID empty, so `entire checkpoint list --session` silently dropped the second-device checkpoints this path is meant to surface. Hydrate on collect (and match archived SessionIDs in the human list filter). Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://entire.io/gh/entireio/cli/trails/871
Problem
Under a git-refs primary, a second device running
entire checkpoint listshows 0 refs-native checkpoints:Listenumerates local refs only;PR #1719 fixed this for the git-branch backend by fetching/healing the
entire/checkpoints/v1branch, but refs-native checkpoints don't live on that branch, so the "device B sees zero" symptom survives under git-refs. This is a pure discovery problem (reads-by-ID already work), and it must land before git-refs becomes the default primary.Approach
Add opt-in remote discovery to the git-refs
List, per the issue's preferred direction (List-timels-remote, hydrate lazily on read):gitRefsStore.Listgains aRemoteRefListFuncseam. When the context is markedWithRemoteListDiscoveryand a lister is configured, List runs a singlegit ls-remote 'refs/entire/checkpoints/*'— names only, no object transfer — and appends checkpoints that exist on the remote but have no local ref yet.CreatedAtis recovered from its ULID timestamp (via a newid.CheckpointID.Time()), so it sorts by real recency with no fetch; the rest of its contents hydrate lazily on the next read through the existing ID-keyed on-demand fetch.ListCheckpointRefsOnRemoteresolves the target with the same authority rule as fix(enable): fetch existing checkpoint_remote branch instead of orphan #1719: with acheckpoint_remoteconfigured it enumerates that remote, never origin; with none configured it is a no-op, soListstays local-only and default behavior is unchanged.entire checkpoint list/ the branchexplainview) only; the marker keeps the per-turn commit-hook hot path network-free.ls-remotefailure logs and returns the local results rather than failing the listing.Files
checkpoint/refs_store.go—RemoteRefListFuncfield/setter,WithRemoteListDiscoverymarker, discovery inList.checkpoint/fetching_tree.go,open.go,registry.go— the lister type + wiring throughOpenOptions/OpenEnv.checkpoint/id/id.go—CheckpointID.Time()(ULID → creation time).cli/git_operations.go—ListCheckpointRefsOnRemote+parseCheckpointRefNames(authority-scopedls-remote).cli/explain.go— optgetBranchCheckpointsinto discovery.docs/architecture/ref-checkpoint-backend.md— document List + remote discovery.Test plan
checkpointstore tests: discovery surfaces a remote-only checkpoint when opted in; stays local-only without the marker / without a lister; no duplicate for a locally-present ref; enumeration failure degrades to local-only; routing store surfaces discovery through the unionList.idtest:Time()recovers a ULID's creation instant and reports false for legacy/non-ID strings.clitests:parseCheckpointRefNamesfilters realgit ls-remote 'refs/entire/checkpoints/*'output (incl. HEAD/branches/peeled tags);ListCheckpointRefsOnRemoteis a no-op with nocheckpoint_remoteconfigured (behavior unchanged, never scans origin)../cmd/entire/cli/...unit tests green;golangci-lintclean on touched packages.Closes #1770
Made with Cursor