graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Prepare v0.302.53 terminal UX release
Rach Pradhandd7298587c8f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d2da8284..a22b38c0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,12 @@ The release workflow uses a tag's section here as its release notes (ahand-written `docs/releases/<tag>.md` wins if present), so keeping this filecurrent is part of cutting a release.+## v0.302.53++- Normal terminal startup keeps background connection receipts and legacy-listener diagnostics behind `GRAFF_REPL_DEBUG=1`; boot timing stays behind `GRAFF_BOOT_DEBUG=1`. Explicit `/mcp` and `graff servers` inspection remains available, and listener ownership protections are unchanged.+- Live thinking shows `Ctrl+T collapse` and `Ctrl+T expand` beside its header. Enable it with `/thinking on`; completed terminal scrollback remains read-only.+- Retains all changes from v0.302.52.+## v0.302.52- The terminal REPL has a clearer session strip, a subtle divider, and distinct styling for active and completed checklist items. The bare prompt, scrollback, and plain output remain intact; no native window or graphical toolkit is required.diff --git a/scripts/eval-tier1.sh b/scripts/eval-tier1.shindex 37a679c1..a2331b7f 100755--- a/scripts/eval-tier1.sh+++ b/scripts/eval-tier1.sh@@ -41,7 +41,7 @@ checks, in order:build zig buildshell durable shell IDs and stale-handle isolation after a crashtests zig build test, and the suite count never shrinks- terminal PTY cleanup integrity and line-REPL prompt reflow+ terminal PTY cleanup, line-REPL prompt reflow, and live thinking controlsinvariants the named goal/loop/todo tests actually ran, not just compiledsdk the committed SDKs match `graff --schema`EOF@@ -266,8 +266,10 @@ if wanted terminal; thenif ((!build_ok)); thenskip_dependent terminalelse- announce terminal "PTY cleanup integrity and line-REPL prompt reflow"- if python3 scripts/eval/test_pty_cleanup.py && python3 scripts/eval/process_guard.py --timeout 90 python3 scripts/test-repl-prompt-reflow.py zig-out/bin/graff; then :; else+ announce terminal "PTY cleanup, line-REPL prompt reflow, and live thinking controls"+ if python3 scripts/eval/test_pty_cleanup.py &&+ python3 scripts/eval/process_guard.py --timeout 90 python3 scripts/test-repl-prompt-reflow.py zig-out/bin/graff &&+ python3 scripts/eval/process_guard.py --timeout 90 python3 scripts/test-repl-thinking.py zig-out/bin/graff; then :; elserecord_fail terminalfifidiff --git a/scripts/eval/tier1-manifest.json b/scripts/eval/tier1-manifest.jsonindex 452f2a7d..d3f89d38 100644--- a/scripts/eval/tier1-manifest.json+++ b/scripts/eval/tier1-manifest.json@@ -14,7 +14,7 @@"src/main.zig","src/repl.zig"],- "test_count_baseline": 3498,+ "test_count_baseline": 3499,"test_count_slack": 25,"required_invariants": [{diff --git a/scripts/test-mcp-async-start.py b/scripts/test-mcp-async-start.pyindex 6e53747a..e6131233 100644--- a/scripts/test-mcp-async-start.py+++ b/scripts/test-mcp-async-start.py@@ -4,7 +4,8 @@An interactive graff (no --yolo) in a pty, one project MCP server that sleepsbefore answering `initialize`, and a scripted model. After the consent promptis answered, the first message reaches the model while the handshake is still-running, and the request after it finishes names the server as connected.+running. Its tools join the next request in quiet and debug modes; only debug+mode prints the connection receipt."""import json, os, select, sys, tempfile, timefrom pathlib import Path@@ -41,12 +42,13 @@ class Timed(ScriptedModel):self.arrivals = []def next_reply(self, body):+ if not body.get("tools"):+ return {"text": "Fixture session"}self.arrivals.append(time.monotonic())return super().next_reply(body)-def main():- binary = str(Path(sys.argv[1] if len(sys.argv) > 1 else "zig-out/bin/graff").resolve())+def run(binary, debug):model = Timed([{"text": "ok"}, {"text": "ok again"}])port = model.start(0)with tempfile.TemporaryDirectory(prefix="graff-mcp-async-") as tmp:@@ -57,11 +59,14 @@ def main():(work / ".mcp.json").write_text(json.dumps({"mcpServers": {"slow": {"command": sys.executable, "args": [str(root / "server.py"), str(HANDSHAKE_S)]}}}))# NO_COLOR (zig build sets it) turns off the interactive consent path.- env = {k: v for k, v in os.environ.items() if not k.endswith("_API_KEY") and k != "NO_COLOR"}+ env = {k: v for k, v in os.environ.items() if not k.endswith("_API_KEY")+ and k not in ("NO_COLOR", "GRAFF_REPL_DEBUG", "GRAFF_BOOT_DEBUG")}env.update(HOME=str(root), AI_GATEWAY_API_KEY="local", GRAFF_VERCEL_URL=f"http://127.0.0.1:{port}/v1/chat/completions",GRAFF_NO_PLUGINS="1", GRAFF_MCP_PROBE="0", GRAFF_FLEET="off", GRAFF_NO_SMOLIFY="1",GRAFF_NO_CODEDB_GUARD="1", GRAFF_NO_TELEMETRY="1", GRAFF_BEHAVIOR_TRACE="0",TERM="xterm-256color", COLUMNS="120", LINES="40")+ if debug:+ env["GRAFF_REPL_DEBUG"] = "1"pid, fd = pty.fork()if pid == 0:# A fresh pty is 0x0 on Linux; give the TUI a real screen.@@ -94,16 +99,29 @@ def main():time.sleep(max(0.0, HANDSHAKE_S + 1.0 - (time.monotonic() - consent)))os.write(fd, b"again\r")- assert read_until(lambda: b"slow connected" in out, 20), "no notice that the slow server joined:\n" + out[-800:].decode("utf-8", "replace")- print("PASS the request after the handshake names the server as connected", flush=True)+ assert read_until(lambda: len(model.requests) >= 2 and b"ok again" in out, 20), "the second request did not finish"+ assert "slow_echo" not in json.dumps(model.requests[0]), "the first request waited for the slow catalog"+ assert "slow_echo" in json.dumps(model.requests[1]), "the slow server's tools did not join the next request"+ if debug:+ assert out.count(b"slow connected") == 1, "debug mode must name the joined server once"+ else:+ assert b"mcp: slow" not in out and b"MCP still connecting" not in out, "normal startup exposed connection diagnostics"+ print("PASS the catalog joins without blocking; receipts are " + ("visible in debug mode" if debug else "quiet by default"), flush=True)finally:try:os.kill(pid, 9)os.waitpid(pid, 0)except (ProcessLookupError, ChildProcessError):pass+ os.close(fd)model.stop()+def main():+ binary = str(Path(sys.argv[1] if len(sys.argv) > 1 else "zig-out/bin/graff").resolve())+ for debug in (False, True):+ run(binary, debug)++if __name__ == "__main__":main()diff --git a/src/cli.zig b/src/cli.zigindex f2b915f0..46e028e7 100644--- a/src/cli.zig+++ b/src/cli.zig@@ -24,6 +24,10 @@ const update_target = @import("update_target.zig");pub const changelog_text =\\What's new\\──────────+ \\0.302.53+ \\ • normal terminal startup is quiet; diagnostics stay opt-in+ \\ • live thinking shows Ctrl+T collapse/expand beside its header+ \\\\0.302.51\\ • Kimi API keys and logins work again (no more RstStream)\\ • a used-up Kimi plan window stops instead of retryingdiff --git a/src/session_connect_tests.zig b/src/session_connect_tests.zigindex 1bfd16df..29feb797 100644--- a/src/session_connect_tests.zig+++ b/src/session_connect_tests.zig@@ -44,7 +44,7 @@ test "connectCompanion on interactive yolo queues instead of addServer" {try std.testing.expect(std.mem.indexOf(u8, src, "companion: {s} (background)") != null);}-test "connectCompanion yolo writes the companion receipt and does not addServer" {+test "connectCompanion yolo gates receipts on debug without addServer" {const main_mod = @import("main.zig");const io = std.testing.io;var tmp = std.testing.tmpDir(.{});@@ -64,16 +64,19 @@ test "connectCompanion yolo writes the companion receipt and does not addServer"defer arena_state.deinit();var env = std.process.Environ.Map.init(std.testing.allocator);defer env.deinit();- var aw: Io.Writer.Allocating = .init(std.testing.allocator);- defer aw.deinit();- var registry = mcp.Registry.empty(std.testing.allocator, io);- defer registry.deinit();+ for ([_]bool{ false, true }) |debug| {+ if (debug) try env.put("GRAFF_REPL_DEBUG", "1");+ var aw: Io.Writer.Allocating = .init(std.testing.allocator);+ defer aw.deinit();+ var registry = mcp.Registry.empty(std.testing.allocator, io);+ defer registry.deinit();- try session_start.connectCompanion(io, arena_state.allocator(), ®istry, .{ .yolo_flag = true }, &aw.writer, false, env);- const out = aw.writer.buffered();- try std.testing.expect(std.mem.indexOf(u8, out, "companion: codedb-pro (background)") != null);- try std.testing.expectEqual(@as(usize, 0), registry.servers.len);- try std.testing.expectEqual(@as(usize, 0), registry.tools.len);+ try session_start.connectCompanion(io, arena_state.allocator(), ®istry, .{ .yolo_flag = true }, &aw.writer, false, env);+ const out = aw.writer.buffered();+ try std.testing.expectEqual(debug, std.mem.indexOf(u8, out, "companion: codedb-pro (background)") != null);+ try std.testing.expectEqual(@as(usize, 0), registry.servers.len);+ try std.testing.expectEqual(@as(usize, 0), registry.tools.len);+ }}test "skipOptionalServer keeps deepwiki/mobbin out of the default catalog" {