Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

docs(context): say why the artifact sweep reclaims late, not at the rename (#409)

Rach Pradhan3d8d5a28e2bc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 057feb2f..468dd84f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,7 +10,7 @@ The release workflow uses a tag's section here as its release notes (a
hand-written `docs/releases/<tag>.md` wins if present), so keeping this file
current is part of cutting a release.
-## v0.0.240 (unreleased)
+## v0.0.241 (unreleased)
- An oversized tool output is now spilled, not destroyed (#409). The
per-result cap (#193/#201) used to delete the elided bytes, leaving the
@@ -23,6 +23,9 @@ current is part of cutting a release.
disk), and reclaimed with the session: an artifact dir whose
`<session>.session.json` is gone is swept at the next spill. Subagents,
whose history is never persisted, keep the plain truncation.
+
+## v0.0.240 (2026-08-06)
+
- The REPL/engine separation began (#422): agent output now flows through a
typed event vocabulary and a strict sink boundary (`engine_events.zig` /
`engine_sink.zig`), with streamed model output, the codex WS transport
diff --git a/src/tool_spill.zig b/src/tool_spill.zig
index e26a4674..c1339e95 100644
--- a/src/tool_spill.zig
+++ b/src/tool_spill.zig
@@ -169,6 +169,12 @@ fn refund(len: usize) ?[]const u8 {
/// at the FIRST spill: a run that never spills does no extra I/O at all, and by
/// then this session's own dir is either current (skipped by name) or still
/// young enough for the grace window.
+///
+/// Reclaiming late is deliberate. The AI-title rename deletes the old session
+/// file mid-conversation; MOVING that session's artifacts with it (or deleting
+/// them there and then) would strand every path already handed to the model in
+/// this transcript. Leaving them put keeps those paths valid for the rest of the
+/// session, and the next run collects what the rename left behind.
fn sweepOnce(sink: Sink, arena: Allocator, current: []const u8) void {
if (g_swept.swap(true, .monotonic)) return;
var names: std.ArrayList([]const u8) = .empty; // collect first: deleting mid-iteration is not portable