# test(integration): fix false-positive in clone graceful-degradation test

`9de736c`·  
  
Soph·1w ago·1 file·+15 added/-19 removed

Root-caused the git-refs KNOWN BUG skip: it was a harness artifact, not a backend divergence. The test staged the session's file changes after the stop hook, so the "no files modified during session" gate skipped condensation on BOTH backends. git-branch still passed only because the assertion (v1 branch exists) was satisfied by the checkpoint inherited from origin via the plain clone; git-refs correctly reported no local checkpoint (per-checkpoint refs are not fetched by a default clone).

Stage before stop like a real agent session (and like the createCheckpointedCommit helper), drop the skip, and assert a NEW checkpoint ID was condensed so inherited clone data can never satisfy the check again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>  
Claude-Session: https://claude.ai/code/session\_012yi3hHGAGepwfrfjPETjGq

## Sessions

8429f8830bfdView transcript

## Changes

1

- cmd/entire/cli/integration_test

- Mremote_operations_test.go+15/-19

```
566 unmodified lines

567
568
569
570
570
571
572
573
23 unmodified lines

597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
606
607
612
613
614
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
615
616
617
618
619
620
621
622
623
624
625
626
627
628

566 unmodified lines

bareDir := env.SetupBareRemote()

// Create a session in repo A and push
	createCheckpointedCommit(t, env, "Initial work", "init.go", "package init", "Initial work")
	initialID := createCheckpointedCommit(t, env, "Initial work", "init.go", "package init", "Initial work")
	env.GitPush("origin", "HEAD")
	env.RunPrePush("origin")

23 unmodified lines

t.Fatalf("session start should not fail with unreachable checkpoint_remote: %v", err)
	}

// Stage the session's changes before stop (as a real agent session would;
	// the stop hook skips condensation entirely when no files changed on disk
	// during the session).
	cloneEnv.WriteFile("clone.go", "package clone")
	cloneEnv.GitAdd("clone.go")

if err := cloneEnv.SimulateStop(session.ID, transcriptPath); err != nil {
		t.Fatalf("session stop should not fail: %v", err)
	}

// PrePush should also not fail -- checkpoint_remote URL derivation will fail
	// (origin is a local path, can't parse it), so it falls back to pushing to origin.
	cloneEnv.WriteFile("clone.go", "package clone")
	cloneEnv.GitAdd("clone.go")
	cloneEnv.GitCommitWithShadowHooks("Clone work", "clone.go")
	cloneEnv.RunPrePush("origin")

// Verify that the session actually created a local checkpoint despite the
	// unreachable checkpoint_remote config.
	//
	// KNOWN BUG (git-refs): this test stages the session's file changes AFTER
	// the stop hook. Under git-branch, condensation still creates the local v1
	// checkpoint; under git-refs it creates no per-checkpoint ref (only the v1
	// session-metadata branch is updated). A fresh git-refs repo and a git-refs
	// clone that stages before stop both create the ref correctly (verified), so
	// this is a real backend divergence in the write-after-stop path, not a
	// harness artifact. The graceful-degradation path this test targets
	// (session start/stop/pre-push do not error with an unreachable
	// checkpoint_remote) is exercised under git-refs above; only this final
	// local-presence check is skipped. Tracked for the section-3 follow-up.
	if env.usingGitRefs() {
		t.Skip("KNOWN BUG: git-refs creates no per-checkpoint ref when files are staged after the stop hook")
	}
	// Verify the clone's session condensed a NEW local checkpoint despite the
	// unreachable checkpoint_remote config. Comparing against the initial
	// checkpoint matters under git-branch: the clone inherits repo A's v1
	// branch from the plain clone, so mere branch presence would pass even if
	// condensation never ran.
	if !cloneEnv.CheckpointsPresentLocally() {
		t.Error("checkpoints should exist locally after session + commit in clone")
	}
	if newID := cloneEnv.LatestCheckpointID(); newID == "" || newID == initialID {
		t.Errorf("clone session should have condensed a new checkpoint, got %q (initial %q)", newID, initialID)
	}
})
```

Mcmd/entire/cli/integration_test/remote_operations_test.go+15/-19
