Week 4 extension: COW/radix cache plan (design only) - #258
Closed
skyzh wants to merge 9 commits into
Closed
Conversation
PR 3 of the restructured Week 4 stack. Day 2 per docs/week4-day-split.md: workspace authorization core + immutable effect receipts. - refsol workspace.py (simplified): bounds, protected/secret path rejection, symlink rejection, inspection-before-overwrite with observed digests, atomic writes (temp + fsync + rename), default-deny approvals, exact command allowlist with timeout, execute dispatch + receipt recording. Deliberately no mutation journal / undo / session binding (Day 6's exactly-once reconcile replaces that machinery). - refsol receipts.py: content-addressed EffectReceipt + durable ReceiptStore (by_tool_call index, verified expand, tamper fail-closed). - tests day_3: 22 tests (list/read bounds, unsafe/symlink paths, write/edit inspection, approvals, command allowlist, receipts via execute). 62/62 day-1..3 refsol tests pass; weeks 1-3 unchanged.
Session-tree feature PR (maps into Day 3). session.py only: append-only SessionLog/SessionStore (fsync-backed, tamper fail-closed), parent_of/ active_path (deterministic root-to-leaf), active_path_events. Pi-inspired id/parentId tree; event-level only. The loop records into any session-like object (Day 1 contract); this PR provides the real implementation.
KV-checkpoint feature PR (maps into Day 4). checkpoint.py: CacheManifest (model/tokenizer/layers/position/prefix/tool-catalog/workspace-fingerprint) with content-address digest, tamper fail-closed from_dict, require_current; export_cache_manifest/validate_resume gates. generation.py: GenerationSession restored with model/tokenizer identity and layer_count (rewind_to arrives in the sequential-rewind feature PR).
Sequential-rewind feature PR (maps into Day 4). branch.py: SequentialBranch (checkpoint -> act -> rewind -> do_again) over one GenerationSession with honest BranchStats. generation.py: rewind_to discards only the divergent cache tail; the unchanged prefix stays cached and is reused. No COW/registry/ refcounts (deferred to the COW/radix extension).
Receipt-compaction feature PR (maps into Day 5). compaction.py: compact_tool_results replaces oversized tool-result renderings with verified receipt handles (canonical bytes stay in the receipt store; durable trace never mutated); expand_receipt_range/reexpand_receipt_message verify and re-expand bounded ranges, failing closed on digest/range/handle errors. receipts.py: compact_rendering keeps the full receipt handle intact so re-expansion can always verify the content address. The old summarizer-based ContextManager is not part of the new course.
Steering/status feature PR (maps into Day 6). control.py: CancellationToken (first-writer-wins cooperative stop) and SteeringHandle (durable queued steering). status.py: AgentStateCard derived only from the durable event trace (goal, current action, approval state, last evidence, next safe step, phase); never hidden chain-of-thought. StatusQuery answers a tool-disabled paraphrase via sequential snapshot + rewind, leaving the main run unchanged.
…overy Exactly-once reconcile feature PR (maps into Day 6). reconcile.py: reconcile_effect/reconcile_interrupted_effects close interrupted tool calls exactly once from durable receipts keyed to the session tool_call id; orphans are reported, never guessed or re-run. largest_safe_checkpoint returns the highest-position manifest passing fail-closed model/tokenizer/geometry/ catalog/workspace checks, else a cold reason.
Equivalence-harness feature PR (maps into Day 7). harness.py: RunSnapshot (final/reason/completed/tool actions/receipts/observations/approval+world state/token accounting) and compare_runs with three planes: semantic (final + exact tool-action sequence), evidence (receipt IDs + observations), policy (approval/world state). Token/page/latency gains are reported but never pass a run whose behavior differs. The old static-held-out grader is not part of the new course.
COW/radix plan PR (non-day extension). docs/week4-cow-radix-extension-plan.md: design-only plan for the deferred copy-on-write / radix cache — why it is deferred (scaling, not correctness), capabilities it uniquely adds (concurrent divergence, cross-session prefix sharing), proposed API sketch, safety invariants, honest accounting, evaluation. docs/week4-day-split.md: 11-PR feature stack shape with the 7-day teaching mapping.
skyzh
force-pushed
the
agent/week4v3-cow-radix-plan
branch
from
August 11, 2026 11:33
563b114 to
cc01e8c
Compare
Owner
Author
|
Closed as superseded by the merged seven-day Week 4 course and the fresh Days 8–9 design. The branch and pull-request history are intentionally preserved. — Forge |
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.
Why
Final PR of the 11-PR restacked Week 4 stack: preserve the deferred COW/radix-cache plan as a design-only document, per Chi's instruction. Stacked on the equivalence harness (#257); base branch
agent/week4v3-day7-harness@5ae28aa.What changed
docs/week4-cow-radix-extension-plan.md(new, design only) — why COW is deferred (a scaling mechanism, not a correctness one), the capabilities it uniquely adds (concurrent divergence, cross-session prefix sharing), a proposedPrefixRegistry/ForkedPrefixAPI sketch, safety invariants, honest accounting rules, and an evaluation outline. No implementation.docs/week4-day-split.md— the 11-PR feature stack shape with the 7-day teaching mapping (Day 4 = checkpoint + rewind; Day 6 = steering/status + reconcile).Review note
AI-Assisted: DeepSeek V4 Flash + Forge