Comprehensive Checkpoint Testing Coverage

Codex·GPT-5.5·Soph·2mo ago·102hr 56min·14 Checkpoints·41 file changes·+3624/-673·254.9K tokens

can you review the changes in this branch

2mo ago·9.0s

I’ll review this like a PR: first identify the branch delta against the local base, then read the touched code and tests for regressions or missing coverage. I’ll also run the repo’s entire agent-help once as requested by the repo guidance.

The branch is soph/cli-api-passthrough and the worktree appears clean. I’m checking the local base branch and the exact file delta now so the review is against the intended comparison point, not uncommitted noise.

The branch adds a new hidden-ish entire api passthrough plus tests and a small API client helper. I’m reading the full diff with enough context now, then I’ll validate behavior against nearby command and auth patterns.

The implementation is mostly self-contained, but it reaches into existing auth, mirror filtering, and API-client plumbing. I’m checking those call sites next because passthrough commands are easy to get subtly wrong around target selection and auth precedence.

I found the new command reuses auth status target resolution for core calls, which is good because it preserves the ENTIRE_TOKEN precedence documented in this repo. I’m drilling into the URL and body handling now; that’s where passthrough tools often create script-visible surprises.

One high-risk edge is emerging: the passthrough accepts a user-supplied “path”, and the shared URL resolver may treat absolute or scheme-relative inputs as a different host. I’m confirming the exact call chain and line numbers before deciding whether this is a finding.

Beyond the host issue, I’m checking whether the new helper methods preserve the semantics users would expect from -H and --input. The tests cover the happy path, but not the more security-sensitive URL cases.

The URL resolver is only used through api.Client, so the new entire api command is the first place arbitrary user input reaches it directly. I’m still scanning for a second independent issue, but the host validation gap is already strong enough to call out.

I’m going to run the focused CLI package tests to catch any compile or unit failures in the changed package. This won’t run the real agent E2E suite.

The focused test command is still running. While it runs, I’m checking the diff history to see whether the latest commit intentionally narrowed the command surface or just refactored it.

The latest commit was a simplification pass with “No behaviour change”, so the host-validation issue came from the original passthrough design rather than the cleanup. I’m waiting on the focused tests and checking command registration/docs consistency as the last pass.

go test ./cmd/entire/cli passed. I’m also running the API subpackage tests because the branch changes cmd/entire/cli/api/client.go directly.

Both focused test packages pass. I’m doing a final review pass over line references and any residual risks before summarizing findings.

The worktree stayed clean after tests. I have the review findings now; I’m just pulling one final line reference for the command registration.

Findings

  • High: cmd/entire/cli/api_cmd.go sends authenticated requests using the user-supplied <path> without rejecting absolute or scheme-relative URLs. api.Client resolves that path through ResolveURLFromBase, and url.ResolveReference will let https://evil.example/... or //evil.example/... replace the intended Entire host. Since the bearer transport then adds Authorization at client.go, entire api https://... can leak the Entire token to another host, including plain http:// despite the base URL TLS check. Validate that <path> is origin-relative before calling Request, or verify the resolved host still matches the selected backend.

Verification

  • env GOCACHE=/tmp/go-build go test ./cmd/entire/cli
  • env GOCACHE=/tmp/go-build go test ./cmd/entire/cli/api

can you review again

2mo ago·9.3s

I’ll re-review the current branch state against origin/main, assuming the branch may have changed since the last pass. I’ll check the delta first, then focus on whether the previous host-validation issue was fixed cleanly and whether any new regressions were introduced.

The branch now has an extra commit specifically addressing the token-leak fix. I’m reading that patch first, then I’ll re-scan the full added command for edge cases around URL parsing, auth target selection, and response/body handling.

The fix now rejects absolute and scheme-relative paths before the request, which addresses the previous token-leak vector. I’m continuing the re-review for non-security behavior regressions in the new passthrough surface, especially places where flags imply one thing but the shared client forces another.

One user-facing problem is surfacing: the core target path returns a SilentError for missing auth without printing the login hint first. I’m confirming how SilentError is handled so I can distinguish an actual blank failure from a normal Cobra error.

There’s another credential-boundary edge worth calling out: the path validation stops direct cross-host inputs, but the shared http.Client can still follow redirects, and the bearer transport runs again on the redirected request. I’m checking the focused tests now; after that I’ll summarize only the issues that look actionable.

The focused CLI and API package tests pass. I’m doing a final line-reference pass for the two remaining findings and checking the worktree stayed untouched.

Findings

  • High: api/client.go still uses the default redirect-following http.Client, and bearerTransport.RoundTrip re-adds Authorization on every redirected request. So the new path validation blocks entire api https://evil/..., but entire api /some/redirect can still leak the bearer if the selected backend returns a cross-host Location. Add a CheckRedirect guard that rejects origin changes, or make the transport attach auth only when req.URL matches the client’s base origin.

  • Medium: api_cmd.go returns NewSilentError for missing core auth without printing anything first. main.go suppresses SilentError, so entire api /api/v1/clusters while logged out exits non-zero with no hint. Other commands print Not logged in. Run 'entire login' to authenticate. before returning a silent error; this should do the same or return a normal error.

The previous direct absolute/scheme-relative path leak is fixed by validateAPIPath.

Verification run: env GOCACHE=/tmp/go-build go test ./cmd/entire/cli env GOCACHE=/tmp/go-build go test ./cmd/entire/cli/api

2mo ago
2db4748test(integration): add checkpoint-backend matrix (I-1) The integration suite had no git-refs coverage: every remote-touching test asserted the git-branch v1-branch topology only, while the e2e suite already ran both backends. This adds the missing axis. TestEnv gains a CheckpointStore field injected as ENTIRE_CHECKPOINTS_PRIMARY into every spawned CLI and git hook (cliEnv + gitHookEnv), and propagated to clones. A ForEachBackend(t, fn) helper runs "git-branch"/"git-refs" subtests, plus backend-aware assertion helpers (CheckpointsPresentLocally/OnRemote, CheckpointExistsOnRemote, RemoteCheckpointState, LatestCheckpointID) mirroring e2e/testutil/backend.go so one test asserts against either topology. Wires the pre-push and graceful-degradation tests in remote_operations_test.go, the HTTPS push/token tests in http_remote_test.go, and the explain fetch-on-miss test under both backends. Tests whose assertions are inherently v1-branch-shaped (commit counts/subjects, rebase parent counts, checkpoint_remote routing, treeless v1 clone, v1-ref-hash divergence) stay git-branch-only with an explicit rationale pointing at their git-refs follow-up in the test plan. One genuine git-refs divergence surfaced and is flagged, not papered over: when a session stages its file changes after the stop hook, git-refs condensation creates no per-checkpoint ref (git-branch still creates the local v1 checkpoint). Skipped for git-refs with a KNOWN BUG note; a fresh repo and a stage-before-stop clone both create the ref correctly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: f96568923ebd+509/-326
ea4cc21test: add git-branch divergence matrix + replay fidelity guards (D1, D4, D5) Systematize the local-v1 divergence & recovery matrix (the most re-broken area, #953/#1251/#1252/#1260) plus the specifically-untested replay edges. D1 (integration, git-branch): drive the local-v1 state {ahead, behind, diverged, disconnected} through the real triggers end-to-end: - pre-push (real hook): local-only survives; ahead fast-forwards; diverged replays both sides on a linear tip; disconnected cherry-picks; a repeated push is idempotent (double-replay guard, #1260). - explain fetch-on-miss for {behind, diverged}, extending the existing {missing, ahead} coverage: a remote-only checkpoint is fetched/reconciled and local-only checkpoints survive. - doctor --force reconciles a disconnected v1, preserving both sides. D4 (strategy unit): replay fidelity edges. A no-op commit must not clobber the remote tip's accumulated tree (regression 743c43f4c); a root-commit chain replays cleanly. Plus a KNOWN BUG pin: >1000-commit replay is still capped (collectCommitsSince) because the cap-removal (4cf01edb3) lives on the unmerged branch origin/no-limit; flip the assertion when it lands. D5 (strategy): TOCTOU guard for 1e8628ade -- fetchAndRebaseRefCommon replays onto the freshly fetched remote tip, not a stale earlier hash. The literal ls-remote seam the fix patched no longer exists (fix is an ancestor), so this pins the behavioural invariant. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: b19f4c2ff3bd+505
b200241test: add OPF pre-push rewrite coverage over a real remote (E1-E5) Cover the OPF (OpenAI Privacy Filter) pre-push rewrite at the integration and strategy layers, exercising what the existing in-process unit tests structurally cannot: OPF enabled via committed settings, resolved and executed inside a spawned pre-push hook, redacting real committed checkpoints and pushing the Entire-OPF-Applied trailer to a real bare remote. - E1: happy path via the real git-invoked hook — remote v1 tip carries the trailer, the fake opf binary is invoked, checkpoint + branch land. - E2: diverged v1 -> V1DivergedError aborts the user push (non-zero exit, actionable message); the branch tip on the remote does not advance. - E4: bootstrap cap exceeded -> typed abort before OPF runs; nothing pushed and the opf binary is never executed. - E5: non-TTY push (execx.NonInteractive, no controlling terminal) completes without hanging and still ships the trailer (regression 626a0344e). - E3: the CAS V1RefMovedError path is deterministically impossible to hit from a spawned hook, so it lands at the strategy layer via a fake OPF runtime that advances the local v1 ref mid-rewrite; a re-run succeeds. Integration tests point the OPF `command` at a fake opf script on disk (the in-process runtime seam is unavailable across the process boundary). OPF is git-branch only, so all E-group tests stay on the default backend. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: 950ada63c568+320
b9e9dc9test: add degraded-remote & protocol-edge coverage (F1, F2, F4, F5) - F1 (git-branch): a bare-remote pre-receive hook rejecting the checkpoint v1 branch with a GH013-style message drives the protected-ref path: the hook prints its loud one-shot banner and returns, the user's own push still lands, and a repeat push does not retry-loop the rejected branch onto the remote (regression #1033). - F2 (git-refs slice): pushCheckpointRefWithRecovery wraps its push, fetch+replay, and retry in the same shared checkpointPushBudget as the v1 path, so a stuck transport bounds total wall clock to ~one budget rather than stacking a full budget per attempt. Mirrors the existing git-branch TestDoPushRef_SharedBudget_BoundsTotalWallClock (regressions #1282, 2e2c1b73a). - F4 (git-refs): the git-refs pre-push path honors the checkpoint policy — a local policy this CLI cannot satisfy skips the per-checkpoint ref push (leaving refs queued) but does NOT abort the user push (regression 7bbdad09c follow-up). - F5 (git-branch): a session that checkpoints while HEAD is detached, pushed via `git push origin HEAD:<branch>` through the real hook, syncs and is readable from a fresh clone. Pins current (working) behavior. F6 (entire:// provider-host routing) is deferred: it needs an injectable provider host table / fake provider mapping that does not yet exist. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: ca5c18be1b8a+251
d57ee8atest(integration): add checkpoint-backend matrix (I-1) The integration suite had no git-refs coverage: every remote-touching test asserted the git-branch v1-branch topology only, while the e2e suite already ran both backends. This adds the missing axis. TestEnv gains a CheckpointStore field injected as ENTIRE_CHECKPOINTS_PRIMARY into every spawned CLI and git hook (cliEnv + gitHookEnv), and propagated to clones. A ForEachBackend(t, fn) helper runs "git-branch"/"git-refs" subtests, plus backend-aware assertion helpers (CheckpointsPresentLocally/OnRemote, CheckpointExistsOnRemote, RemoteCheckpointState, LatestCheckpointID) mirroring e2e/testutil/backend.go so one test asserts against either topology. Wires the pre-push and graceful-degradation tests in remote_operations_test.go, the HTTPS push/token tests in http_remote_test.go, and the explain fetch-on-miss test under both backends. Tests whose assertions are inherently v1-branch-shaped (commit counts/subjects, rebase parent counts, checkpoint_remote routing, treeless v1 clone, v1-ref-hash divergence) stay git-branch-only with an explicit rationale pointing at their git-refs follow-up in the test plan. One genuine git-refs divergence surfaced and is flagged, not papered over: when a session stages its file changes after the stop hook, git-refs condensation creates no per-checkpoint ref (git-branch still creates the local v1 checkpoint). Skipped for git-refs with a KNOWN BUG note; a fresh repo and a stage-before-stop clone both create the ref correctly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: f96568923ebd+509/-326