Harden compaction: durable anchor, atomic commit, continuation ledger - #1
Merged
Merged
Conversation
Name the last completed todo in the all-complete wrap-up anchor so the report obligation stays concrete instead of a generic wrap-up, and add a post-anchor invariant plus non-sensitive anchor provenance to the compacted event. - selectDurableAnchor is the single source of truth for the active objective/report, shared by the semantic prompt anchor and the deterministic continuation anchor. - validateCompactionAnchor fails compaction (before any destructive write) if the current objective or pending report is empty, the selected todo is lost, or a resolved request is reopened. - context.compacted now carries anchor_source, anchor_todo_*, anchor_hash, and resolved-request source counts. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
russellhaering
force-pushed
the
russell_h/compaction-anchor-hardening
branch
12 times, most recently
from
August 18, 2026 18:18
4464a8f to
1b37459
Compare
- go.mod: lower to go 1.26.5 so the module builds with the local toolchain (no dependency requires 1.26.6). - ApplyCompaction: commit durable summary, message trim, and cache invalidation in one transaction so compaction can never leave a half-compacted state. - Checkpoints now snapshot and restore pending_inputs, so restoring a checkpoint no longer silently drops an unanswered user ask. - Continuation ledger: work_items + continuation tables populated by SetTodos, with the compaction anchor derived from the ledger (active work item, report obligation) instead of todo prose. Completed work items are retained so the report obligation survives a cleared plan. Forks copy the ledger. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
russellhaering
force-pushed
the
russell_h/compaction-anchor-hardening
branch
from
August 18, 2026 18:25
1b37459 to
bdf0b7a
Compare
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.
Summary
Hardens Orrery's context compaction so the active objective and report obligation stay concrete, durable, and verifiable after compaction, and makes the module build with the local toolchain.
Changes
Anchor hardening (
internal/core/compaction.go)selectDurableAnchoris the single source of truth for the active objective/report, shared by the semantic-summary prompt and the deterministic continuation anchor. All-complete wrap-up names the last completed todo.validateCompactionAnchorfails compaction before any destructive write if the objective/report is empty, the selected todo is lost, or a resolved request is reopened as active work.context.compactedcarries non-sensitive anchor provenance (anchor_source,anchor_todo_*,anchor_hash, resolved-request source counts).Atomic commit (
internal/store/store.go)ApplyCompactioncommits the durable summary, message trim, and cache invalidation in one transaction — compaction can never leave a half-compacted state.Checkpoint semantics
pending_inputsand the continuation ledger (work_items+continuation), so restore reproduces retained completed work and completion chronology.Continuation ledger
work_items+continuationtables populated bySetTodos(typed, plan-aware reconciliation: idempotent resubmission, phase-aware matching, retained completed rows, live-duplicate promotion). The compaction anchor derives from the ledger.Engine.finishcallsAcknowledgeReporton a passing final response, clearing the report obligation so a follow-up turn does not re-assert already-reported work (completed history retained).Build
go.modlowered togo 1.26.5so the module builds with the local toolchain (no dependency requires 1.26.6).Verification
go test ./...passes (all packages),go vetclean,gofmtclean.gpt-5.6-sol) approved after multiple rounds; all findings fixed with regression tests covering: active-todo selection, all-complete named wrap-up, fallback anchoring, compacted-event metadata, atomic compaction, checkpoint pending-input + ledger restore, duplicate-objective reconciliation (idempotency, phase, order-independence, live promotion), and report-acknowledgement clearing.