Repository navigation
Description
Summary
In a thread whose project directory is not a git repository, each run settle re-materializes the previous run's baseline checkpoint on top of the checkpoint the previous run just captured, because checkpoint IDs are deterministic (scope + ordinal) and the baseline-presence check only counts status = 'ready' rows — which never exist in non-git scopes (everything persists as 'missing').
The overwrite erases runId/appRunOrdinal from all but the newest checkpoint. The client builds revert targets ("edit from here" pencils) only from checkpoints with non-null runId + appRunOrdinal, so in a multi-turn non-git thread only the first message gets the revert affordance (it targets the thread-start checkpoint, target 0).
Observed on the 0.1.9 desktop build (Linux). Current main already guards run-linked 'missing' rows with (status = 'ready' OR (status = 'missing' AND run_id IS NOT NULL)) in getCheckpointCaptureContext — that fixes the pencil-destroying case. This report documents the 0.1.9 mechanism with production evidence and two small residual gaps on main.
Evidence (production data, 4-run non-git thread)
Every run row still points at its own checkpoint (run.checkpointId = ...:name:1..4), but the checkpoint rows were overwritten by baselines stamped with the next run's requestedAt:
checkpoint (id = name:K) |
runId / appRunOrdinal | capturedAt | equals |
|---|---|---|---|
| 0 | null / null | 23:33:15.542 | run 4 requestedAt (thread-start re-materialized) |
| 1 | null / null | 23:28:23.177 | run 2 requestedAt |
| 2 | null / null | 23:30:45.249 | run 3 requestedAt |
| 3 | null / null | 23:33:15.542 | run 4 requestedAt |
| 4 | run4 / 4 | 23:33:24.849 | run 4 end (survived — no run 5 yet) |
Same pattern found in 74 checkpoint rows across 14 threads on one machine — every non-git thread with ≥ 2 settled runs was affected.
Mechanism
CheckpointCaptureService.execute (apps/server/src/orchestration-v2/CheckpointCaptureService.ts) on every settle:
- Materializes a thread-start checkpoint (ordinal 0) if
hasReadyCheckpoint(0)is false. - Materializes a baseline at
run.ordinal - 1ifhasReadyCheckpoint(...)is false —runId: null,appRunOrdinal: null,capturedAt: run.requestedAt. - Captures the run's own checkpoint at ordinal
run.ordinalwithrunId+appRunOrdinal.
In 0.1.9, hasReadyCheckpoint is fed by getCheckpointCaptureContext (apps/server/src/orchestration-v2/ProjectionStore.ts), which selects ordinals with status = 'ready'. In a non-git cwd, CheckpointService.capture records checkpoints with status = 'missing' (there are no git refs to capture), so the check is always false and step 2 re-materializes every time. Checkpoint IDs are derived from scopeId + ordinalWithinScope, and the checkpoint.captured projection write is an upsert keyed by checkpoint_id (ON CONFLICT(checkpoint_id) DO UPDATE), so the re-materialized baseline replaces the previous run's just-captured checkpoint row.
Git-backed threads are unaffected: their checkpoints are 'ready', the baseline check finds them, and run-linked rows survive — which is why this only shows up in non-git projects (e.g. a home directory or an arbitrary folder).
Repro
- Start a thread in a directory that is not a git repo.
- Send 3+ messages (separate runs).
- Observe: only the first message shows the revert affordance;
orchestration_v2_projection_checkpointsrows for earlier ordinals haverun_id = null,app_run_ordinal = null, andcaptured_atequal to the next run'srequestedAt.
Suggested hardening on main
The main guard already covers the reported bug. Two residuals worth considering:
'error'-status run-linked rows are still unprotected. Ifcheckpoints.capturefails, the row persists withstatus: 'error'and a non-nullrunId; the next settle's baseline materialization (not finding a'ready'/run-linked-'missing'row) upserts over it. Counting any existing row for the ordinal (i.e. dropping the status filter entirely — a baseline is only meant to fill absent ordinals) closes this.- Thread-start (ordinal 0) is re-materialized on every settle in non-git scopes (the run_id-null
'missing'row doesn't count as preserved). Harmless content-wise (null/null either way, onlycapturedAtchurns) but it's a wasted write per turn for exactly the projects that have no other checkpoint writes.
A regression test exists in my local branch: CheckpointCaptureService.test.ts > "preserves the prior run's missing checkpoint when the next run settles" — it seeds two sequential runs against a mocked non-git CheckpointStore, and asserts that the second settle commits exactly one checkpoint.captured event (ordinal 2, run-linked) and that the ordinal-1 row keeps runId/appRunOrdinal. It fails on 0.1.9's code and passes with the fix.
Impact
- Non-git threads lose per-turn revert after the second turn (only message 1 is editable).
- Affected persisted rows are repairable: any row where
run.checkpointIdpoints at a checkpoint row with nullrun_idcan be restored (run_id = run.id,app_run_ordinal = run.ordinal,captured_at = run.completedAt).
Activity
juliusmarminge commentedon Nov 16, 2026
I tried to reproduce this on the current build and could not.
On origin/main eeae88d: started
T3CODE_DEV_SEED=0 vp run devin a fresh worktree, added a project in a folder that is not a git repository withnode src/bin.ts project add, then ran three turns with the free Replay provider (thread start --provider devReplay --model multi-turn --wait, then twothread send --wait). Read orchestration_v2_projection_checkpoints read-only: ordinal 0 missing/no run link with capturedAt equal to run 3's request time (rewritten on every settle); ordinals 1, 2, 3 missing and still linked with appRunOrdinal 1, 2, 3. So the reported overwrite (only the first message editable) does not happen on main: it was fixed by #18379, merged 2026-11-11T19:08Z, after v0.1.9 was tagged at 11:33Z. The leftover gap the reporter flagged (a run-linked 'error' row from a failed capture is not counted as kept, so the next settle's baseline overwrites it and clears runId/appRunOrdinal) was not triggered in the app (that needs a failing git capture). It is shown by a test: an assertion added to the existing cancelled-run case in CheckpointCaptureService.test.ts fails on main (preservedCheckpointOrdinals is [0], expected [0, 1]).Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.