graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
fix: keep compaction handoffs out of source nudges
yxlyx493627cbcbc8
diff --git a/scripts/test-pty-codex-ws.py b/scripts/test-pty-codex-ws.pyindex 631d5791..06f72317 100644--- a/scripts/test-pty-codex-ws.py+++ b/scripts/test-pty-codex-ws.py@@ -25,16 +25,15 @@ def main() -> None:fh,)- # The AI tab-titler (titleTask, src/title.zig) fires one extra quiet SSE- # turn on the first prompt, which would corrupt the transport counters.- # Disable it the same way `/title off` does: the persisted setting in- # the session cwd's .harness/settings.json.+ # The AI tab-titler and turn recap each fire an extra quiet SSE turn,+ # which would corrupt these transport counters. Disable both through+ # the persisted settings this test is specifically not exercising.harness_dir = os.path.join(tmp, ".harness")os.makedirs(harness_dir, exist_ok=True)with open(os.path.join(harness_dir, "settings.json"), "w", encoding="utf-8") as fh:- json.dump({"ai_title": False}, fh)+ json.dump({"ai_title": False, "session_recap": False}, fh)scenarios = [(diff --git a/src/named_work.zig b/src/named_work.zigindex 762ddaa7..e67ad546 100644--- a/src/named_work.zig+++ b/src/named_work.zig@@ -21,7 +21,7 @@ pub const nudge_text =/// after the first step, so `handle` must not depend on walking messages.var remembered_task: []const u8 = "";-const source_needles = [_][]const u8{ ".py", ".zig", ".js", ".ts", "SPEC.md" };+const source_needles = [_][]const u8{ ".py", ".zig", ".jsx", ".js", ".tsx", ".ts", "SPEC.md" };pub fn remember(text: []const u8) void {remembered_task = text;@@ -55,8 +55,13 @@ pub fn beginTurn(self: *Agent) void {/// True when `text` names a source path (not a greeting.txt-style data file).pub fn hasNamedSource(text: []const u8) bool {- for (source_needles) |n| {- if (std.mem.indexOf(u8, text, n) != null) return true;+ for (source_needles) |needle| {+ var from: usize = 0;+ while (std.mem.indexOfPos(u8, text, from, needle)) |at| {+ const end = at + needle.len;+ if (end == text.len or (!std.ascii.isAlphanumeric(text[end]) and text[end] != '_')) return true;+ from = end;+ }}return false;}@@ -135,10 +140,12 @@ pub fn handle(self: *Agent, _: []const u8) !bool {return true;}-test "hasNamedSource sees SPEC and .py, ignores greeting.txt and pong" {+test "hasNamedSource sees source suffixes without confusing JSON for JavaScript" {try std.testing.expect(hasNamedSource("Read SPEC.md and affinity.py"));try std.testing.expect(hasNamedSource("Fix fib.py"));- try std.testing.expect(hasNamedSource("edit stall_notice.py"));+ try std.testing.expect(hasNamedSource("edit view.tsx and helper.jsx"));+ try std.testing.expect(!hasNamedSource("resume .graff/sessions/task.session.json"));+ try std.testing.expect(!hasNamedSource("read task.transcript.jsonl"));try std.testing.expect(!hasNamedSource("Reply with exactly: pong"));try std.testing.expect(!hasNamedSource("Create hello.txt then rename it"));}