Repository navigation
docs(plans): plan mid-run compaction (F03) and propose the retention contract (F20) - #91
Merged
lg2m merged 1 commit intoSep 21, 2026
Conversation
…contract (F20) Neither finding is code-ready. F03 needs a decision on where a run may compact and what the resumed turn carries; F20 needs a retention contract before any archival, export, or limit signal is built. This commit writes both down so the decisions can be made once, in review, rather than re-litigated inside an implementation PR. `docs/plans/mid-run-compaction.md` (ENG-793): defines the safe turn boundary (turn persisted, no pending approval, no half-applied steering, no awaited child), what the resumed turn must see (static prefix, summary that may cover the run's own oldest turns, verbatim prompt, the last K whole turns with the F23 projection, steering in place, one continuation notice), a durable Decide/Mark/Summarize/Resume/Crash/Cancel protocol built on F04's fold steps with a `cutoff_turn_ordinal` qualifier, slices MRC-0..5 with acceptance, five open questions for the ADR, and why stubbing harder or auto-starting a follow-up run are worse. Reserves ADR-0039 for MRC-0. `docs/adr/0038-session-retention.md` (ENG-803, Proposed): the unit of retention is the session; archive is a state, not a location; automatic archival is age-based on idle roots with their subtree and never size-based; deletion is explicit and cascades, now including the session's events; receipts are never trimmed; cursors fail closed; approaching-limit events at 80 % and 95 %; export as JSONL of protocol types. Two facts checked against the store while writing it: `commands` already has no reference to `sessions`, and `delete_idle_session` leaves a deleted session's rows in `events`, so the event log grows regardless of deletion today. Index and ledger: plans README rows, ADR index entry, ADR reservations 0038 and 0039 (next free 0040), F03 and F20 rows in `progress/root.md` and a dated entry. No code.
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.
Linear: ENG-793 (F03), ENG-803 (F20). Stack 3/3 — based on #90; retarget to
mainafter #89 and #90 merge. Docs only; the ledger is the only overlapping file.Neither finding is code-ready, and the audit's remaining order-2 items are otherwise accounted for: F24 is in review on another lane (ENG-805), F28 is a paid eval (ENG-807). This PR writes the two decisions down so they get made once, in review.
docs/plans/mid-run-compaction.md(F03)A run whose turn N+1 no longer fits today stubs stale results and then fails (
CompactionDisposition::BetweenRunsOnly). The plan proposes compacting and continuing the same run:runs.compaction_resume_turn) → Summarize (F04 fold steps, cutoff may fall inside the run viacutoff_turn_ordinal) → Resume → Crash/Cancel semantics.docs/adr/0038-session-retention.md(F20, Proposed)archived_at_ms), not a second store.next_sequencenever rewinds.WorkspaceLimitApproachingat 80 % / 95 % plusWorkspaceSummary.limits.Two facts verified against the store while writing it, worth knowing regardless of the ADR's fate:
commandsalready has no reference tosessions, so receipts survive deletion by accident today.delete_idle_sessionremoves every session-scoped table except the session's rows inevents— the event log grows regardless of deletion.Also
ADR index entry;
plans/README.mdrows;progress/root.mdreservations 0038/0039 (next free 0040), F03/F20 rows, dated entry.Review asks
Decide on the ADR's eight points and the plan's five questions here. Accepting 0038 turns ENG-803 into a plan; accepting the boundary in the plan lets MRC-1/MRC-2 start in parallel.