graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Merge resume state fixes into release/v0.0.297
justrache78437c0fed8
diff --cc docs/adr/0109-resume-retains-catalog-and-layout-snapshots.mdindex 00000000,033b2ff3..d0c93c8dmode 000000,100644..100644--- a/docs/adr/0109-resume-retains-catalog-and-layout-snapshots.md+++ b/docs/adr/0109-resume-retains-catalog-and-layout-snapshots.md@@@ -1,0 -1,38 +1,38 @@@-# 0104. Resume retains catalog selections and the layout snapshot++# 0109. Resume retains catalog selections and the layout snapshot++ Status: accepted 2026-09-12++ ## Context++ Restoring message history alone does not restore the request prefix. Deferred+ native/MCP tool selections lived only in process memory, and rebuilding the+ project map after file changes changed the system prompt. A fresh-process+ resume could therefore send different tools and instructions for the same+ conversation (#867).++ ## Decision++ - Save loaded native names, MCP names in their rendered order, and RLM+ visibility. Include them in the save fingerprint. Restore selections and+ invalidate cached catalogs before materializing the resumed provider format.+ - Resolve names against today's available catalog. Never persist or trust+ saved schemas, credentials, or permission grants. Legacy/malformed selection+ fields start without another session's loaded selections.+ - Save only the project-layout snapshot, not the assembled system prompt.+ Restore that segment when resuming in the same workspace. Keep today's+ instructions around it, and respect prompts that opt out of the map.+ Legacy and cross-workspace resumes use the startup map.+ - Preserve the existing native-first/MCP-by-load-order rendering contract;+ changing catalog ordering across tool families is a separate decision.++ ## Consequences++ With unchanged instructions, capabilities, and schemas, process restart no+ longer discards these cache-relevant parts of the prefix. Provider cache+ availability remains separate from successful state restoration; neither a+ cache hit nor a miss alone proves whether history was restored.++ The production save/load regressions cover catalog equality, stale and malformed+ selections, layout changes, and updated instructions. The synthetic process+ verifier is `scripts/test-resume-cache.py`; its live mode is opt-in and reports+ restoration independently from provider-reported cached input.diff --cc docs/adr/README.mdindex a2c211ab,39d6f66e..ef5f27f4--- a/docs/adr/README.md+++ b/docs/adr/README.md@@@ -114,11 -114,7 +114,12 @@@ record only when you need the evidence| [0101](0101-gui-tests-preserve-desktop-focus.md) | GUI tests stay hidden by default; visible opt-in can overlap other apps, and native foreground checks require separate opt-in. || [0102](0102-workspace-agents-and-cancel-recovery.md) | Agents uses the workspace area, Tasks visibility is explicit and persisted, and timed-out cancellation retires the worker before session recovery. || [0103](0103-mcp-apps-are-isolated-result-views.md) | MCP Apps are private saved result views in isolated GUI/browser sandboxes; app tool calls require a future approval path. |-| [0104](0104-resume-retains-catalog-and-layout-snapshots.md) | Resume restores loaded tool selections and the same-workspace layout snapshot, without freezing current instructions or granting permissions. |+| [0104](0104-live-publication-and-deferred-tool-evidence.md) | Requests merge only ready MCP tasks; publication and completion use fresh head evidence; claim transactions serialize handoffs. |+| [0105](0105-explicit-legacy-listener-stop.md) | Only an explicit identity-bound stop-suspect action may terminate an unrecorded legacy listener; automatic cleanup stays conservative. |+| [0106](0106-desktop-html-explanations.md) | Desktop HTML explanations are private saved results in static, opaque sandboxes with bounded source and offscreen teardown. |+| [0107](0107-model-drawn-pages-render-in-an-opaque-frame.md) | A page the model draws (`render_html`) is a private snapshot served under a CSP sandbox; the model picks the presentation, never the privilege. |+| [0108](0108-browser-events-outrank-pending-snapshots.md) | Browser page-info events invalidate older pending IPC snapshots; a loaded page must not revert to loading. |++| [0109](0109-resume-retains-catalog-and-layout-snapshots.md) | Resume restores loaded tool selections and the same-workspace layout snapshot, without freezing current instructions or granting permissions. |## When to write onediff --cc src/main.zigindex 0012218f,264abd40..a95fede8--- a/src/main.zig+++ b/src/main.zig@@@ -563,10 -563,10 +563,10 @@@ const agentJobsReap = subagent.agentJobconst workflow = @import("workflow_test.zig"); // the engine's tests live here (workflow.zig hit the 600-line cap)const exec = @import("exec.zig");test { // ── Unit tests (`zig build test`): pull in tests from imported modules (mcp.zig)- _ = @import("mcp_apps.zig");+ _ = .{ @import("mcp_apps.zig"), @import("html_view.zig") };_ = @import("main_test.zig");- _ = @import("http_client.zig");- _ = @import("http_client_tests.zig");+ _ = @import("session_catalog.zig");+ _ = @import("session_prompt.zig");_ = @import("prompt_astra.zig");_ = @import("agent_empty_completion.zig"); // #745: plain-final reconciliation_ = @import("agent_model_loop.zig");