graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Merge fix/U4-pipeline-worktree-reject
Rach Pradhan52fefee3f0c1
diff --cc src/workflow.zigindex dc385554,39088abb..b4210b64--- a/src/workflow.zig+++ b/src/workflow.zig@@@ -599,32 -446,22 +626,52 @@@ test "pipelinePrompt substitutes {{itemtry std.testing.expect(std.mem.indexOf(u8, s3, "DONE") != null);}+test "execWorkflow rejects a non-object argument tree instead of dereferencing it" {+ var ctx: ToolCtx = undefined;+ ctx.gpa = std.testing.allocator;+ ctx.from_sub = false;++ const out1 = try execWorkflow(ctx, .{ .string = "do it" });+ try std.testing.expect(out1.is_error);+ try std.testing.expect(std.mem.indexOf(u8, out1.text, "object") != null);+ std.testing.allocator.free(out1.text);++ const parsed = try std.json.parseFromSlice(Value, std.testing.allocator, "{\"phases\":\"nope\"}", .{});+ defer parsed.deinit();+ const out2 = try execWorkflow(ctx, parsed.value);+ try std.testing.expect(out2.is_error);+ try std.testing.expect(std.mem.indexOf(u8, out2.text, "array") != null);+ std.testing.allocator.free(out2.text);+}++test "execSubagent rejects a non-object argument tree instead of dereferencing it" {+ var ctx: ToolCtx = undefined;+ ctx.gpa = std.testing.allocator;+ ctx.from_sub = false;++ const parsed = try std.json.parseFromSlice(Value, std.testing.allocator, "[1,2]", .{});+ defer parsed.deinit();+ const out = try subagent.execSubagent(ctx, parsed.value);+ try std.testing.expect(out.is_error);+ std.testing.allocator.free(out.text);+}+++ test "pipelineIsolationError: stage 0 may isolate, stage 1+ worktree is refused naming the stage, non-worktree is always allowed (#295 guard rail)" {+ // Stage 0 (the first stage) may isolate with its own worktree.+ try std.testing.expect(pipelineIsolationError(0, .worktree) == null);++ // Stage 1+ requesting worktree isolation is refused — a pipeline is a+ // dependent chain over one item, so a later stage in its own worktree+ // cannot see what the prior stage did.+ const msg1 = pipelineIsolationError(1, .worktree) orelse return error.TestExpectedNonNull;+ try std.testing.expect(std.mem.indexOf(u8, msg1, "stage 1") != null);+ try std.testing.expect(std.mem.indexOf(u8, msg1, "phases") != null);++ const msg3 = pipelineIsolationError(3, .worktree) orelse return error.TestExpectedNonNull;+ try std.testing.expect(std.mem.indexOf(u8, msg3, "stage 3") != null);++ // Non-worktree isolation (shared_cwd) is allowed at any stage index.+ try std.testing.expect(pipelineIsolationError(0, .shared_cwd) == null);+ try std.testing.expect(pipelineIsolationError(1, .shared_cwd) == null);+ try std.testing.expect(pipelineIsolationError(4, .shared_cwd) == null);+ }