Repository navigation
Keep checkpoint delivery across a resumed session - #60
Merged
Merged
Conversation
Claude Code and Codex sessions received the top hot checkpoint on every prompt, even when it shared no words with the prompt, and the same excerpt and the ~600-character capture contract were repeated each turn. - Record per host session which checkpoint digests it received (local state only). A checkpoint the session already holds is not sent again; PreCompact, PostCompact, SessionStart(compact), a changed checkpoint or 25 prompts without a reset send it again. - After the first prompt, a checkpoint that shares no terms with the prompt is reduced to one line naming its request and the page command. - The capture contract is sent only when the session holds no earlier delivery (first prompt, after compaction). - Within an entry, superseded earlier findings come first and the latest finding last, labelled with its time. Other hosts are unchanged. Task Master 162.
…te precedence as conditions - Summary compaction now ranks sentences about unresolved, blocked or remaining work as important, so they survive when a finding is cut. - The capture contract asks that a check reported as passed name the command, working directory, commit and dirty state, and that a saved status (tests, CI, review, mergeability) be checked again before use. - The prior-findings guidance is written as one conditional sentence per conflict case: current message, what the agent sees now, and other saved findings. The separate 'Unresolved:' field waits on the task 161 headroom pilot. Task Master 165 (items 1, 3, 4).
…ng, per-session files From an independent review: - Pointer vs full is decided by whether the session holds any delivery, not by the start claim, so a lost claim, an auto-compaction or a racing hook process still gets the full checkpoint. - One delivery file per host session. A compaction reset deletes it, so another session's concurrent write cannot restore the stale record. - A session's own checkpoints are not sent back to it until compaction. - The earlier-findings header is written only when a finding fits under it, so the latest finding is never cut to make room. - A pointer also names the search command, in case its page key has been evicted.
Hot checkpoints carried no HEAD, branch, dirty or untracked-file state, and captured command output carried no revision, so a session in another checkout or after the tree moved trusted results observed on other bytes. - Evidence captured at Stop, PreCompact and PostToolUse records the workspace's git state (one 'git status --porcelain=v2', 1.5 s timeout, no optional locks; untracked files hashed, at most 20, private names skipped). Command output is stamped with the commit it ran at. - Rendering compares with the reader's tree: one 'Workspace drift' line when HEAD, branch, uncommitted state or untracked files differ; file excerpts no longer on disk or changed are marked; command output run at another commit is marked. Same checkout: nothing. - Sources dropped to fit a bound keep their name and digest and are listed as not kept. - The field is optional inside the opaque evidence: older clients drop it, sync budget unchanged. Warning only; nothing is restored. Handoff capsules do not carry git state yet. Task Master 164.
… and latency From an independent review: - Only sources that plainly name a file (a path, or one cat/head/tail/sed read) are checked on disk; command-named reads were always 'missing'. - An untracked entry captured without a hash (symlink, large or unreadable file) is checked for presence only. - Synced untracked paths must be workspace-relative (no '..', absolute or NUL); reads lstat first, open with O_NOFOLLOW|O_NONBLOCK, require a regular file and check realpath containment, so a FIFO cannot block a hook and a symlink cannot read outside the workspace. - Metadata is bounded (10 untracked, 8 dropped names, 160-char paths) and is dropped before any excerpt when a checkpoint is over budget. - git status uses -unormal; drift and file checks are computed once per prompt; the drift line is capped at 320 characters. - The private-name filter covers more secret-like names.
…le history Hot memory kept the newest 12 checkpoints (72,000 characters), so newer turns evicted explicit 'remember' saves like anything else. - Local store: the newest capture, then the latest three explicit saves per workspace (six in all), then the rest by most recent use or capture. Use is when a checkpoint was last delivered to a session on this machine (state/hot-checkpoint-use.json, local only). An entry that does not fit is skipped so a smaller one can still be kept. - Synced replica: the same save protection, deterministic and without device-local use, so every device retains the same set. The displaced-history benchmark rerun waits on the task 161 paid pilot. Task Master 166.
… half the budget - Replica: the newest visible checkpoint ranks above protected saves, so saves can no longer push the turn just captured out of the view. - Protected saves are held to half the character budget (15,000 in the replica, 36,000 locally); disputed or superseded saves are not protected. - Use-based ranking applies to local-only profiles; the use file is read only when retention has to choose. Docs say so, and note that older clients still retain by recency.
A started, resumed, cleared or forked session holds none of what a reused session id recorded, so SessionStart resets that session's delivery in both hooks (a false reset costs one repeat). New test drives the installed hook commands against a real daemon on both hosts: first prompt delivers, a repeat does not, automatic PreCompact and a later SessionStart deliver again.
…y after rendering From the completion review: - With newest-last ordering the oldest earlier finding took the history budget first. Budget now goes newest first; text still reads oldest to newest, then the latest finding. - The per-session delivery record is written after the text is built, so a failure while rendering never marks an unsent checkpoint as delivered.
# Conflicts: # src/runtime/host-adapter-base.ts
…and round-trip tests - Export records continuityIr.provenance.workspace (head, branch, dirty, filtered untracked names) for the exporting workspace. The field is optional and signed with the capsule; older importers ignore it. - Import attaches it as evidence on the imported checkpoint, so opening the handoff in a different tree shows the drift line. - Tests: export and import through the lifecycle engine, a git that hangs (null within the timeout), and a synced document with git state that the wire validator accepts unchanged.
From a fresh review: every capsule, including deal handoffs uploaded to a counterparty, carried branch, HEAD, dirty state and untracked file names with content hashes. - Only the Claude Code and Codex handoff export opts in; deal handoffs and other callers never carry it. - A capsule carries commit, branch and dirty state only: no untracked names or hashes leave the machine. Hot sync (own devices) is unchanged.
…of files changed on disk The pilot's saved requests showed the capture contract's request for the commit and dirty state made candidate agents run git rev-parse/status in most sessions (192 rev-parse calls vs 0) and cite a SHA in 70/72 continuation finals. Crosshead already records the tree in evidence.workspace, so the contract now asks only for the command and working directory. All 52 '[changed on disk since observed; reread]' marks in the pilot were files the agent itself had edited in an earlier session. A changed excerpt is now dropped and the file named once, without a reread instruction.
…e changed files first; no reconcile mark against a dropped version; no header-only block Without source excerpts nothing captures evidence.workspace, so the contract still asks the agent for the commit and tree state there.
…eckpoint's commit In the #55 rerun, the drift warning fired in 61 candidate sessions. In most of them the checkpoint was written with uncommitted changes and HEAD had since moved forward on the same branch: the work was committed, not lost. A fast-forward now gets one neutral clause with no reread instruction and no uncommitted-changes warning; rewritten or switched history keeps the full warning.
…ted changes Review: ancestry shows the commits moved forward, not that the saved uncommitted changes were committed.
Codex 0.164 (exec resume) and Claude Code 2.1.332 (--resume) both fire SessionStart with source "resume" and the same session id, and both replay the transcript, including earlier hook-injected context (verified offline against a local request recorder). Resetting delivery there resent every checkpoint the session already held. Started, cleared and forked sessions still reset.
Contributor
Author
|
Fresh review: nothing blocking. Residual cases (rewind/truncation then resume, a recorded delivery the host never kept, a compaction Crosshead did not see) now heal only at the 25-prompt redelivery interval instead of on resume; each can withhold, never lose, and a changed checkpoint is still sent. Comment wording about forks corrected in the latest commit. TUI |
…d took 6.9 s on CI's Node 24 runner
…eat/checkpoint-git-state
…feat/hot-retention-by-use
…feat/checkpoint-token-fixes
…o feat/drift-fast-forward
…x/resume-keeps-delivery
Merged
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.
Stacked on #56.
#50 resets a session's checkpoint-delivery record on every SessionStart. On resume that is wrong: both hosts fire SessionStart with
source: "resume"and the same session id, and both replay the transcript including the context Crosshead injected earlier. Every resumed prompt therefore got all checkpoints again.Evidence (offline, no provider calls): Codex 0.164.0
exec resumeand Claude Code 2.1.332--resumewere pointed at a local request recorder with a hook that injects a marker. The resumed request contained the earlier marker plus the new one (2 markers) on both hosts, and the hook payload carriedsource: "resume".Change: skip
resetSessionDeliveryon SessionStart when source isresume(Codex and Claude Code hooks). Startup, clear and fork still reset; compaction still resets via the compaction hooks.Tests: the end-to-end hook test now expects no redelivery after a resume and redelivery after a new startup, on both hosts. Focused suites pass (hot-delivery-hooks, hot-delivery, scoped-review-regressions: 42/42).
Found while building a multi-prompt benchmark fixture for task 162 (onlybots !93).