2.8 KiB
Verdict: fix-harness-command-template
Status: PASS
Summary
Fixed the non-functional default harness.command in scripts/loop-runner.py. The v1 default used --prompt-file and --cwd flags that do not exist in opencode run. Fix introduces a new {prompt_content} substitution token (single argv element under subprocess.run list mode; no shell expansion; safe for prompts with quotes/dollar signs/etc.) and changes the default to ["opencode", "run", "--dir", "{cwd}", "{prompt_content}"]. {prompt} and {cwd} tokens retained for backwards compatibility with custom harness commands.
SPEC compliance
| Requirement | Status |
|---|---|
R1 — {prompt_content} substitution token |
✓ |
R2 — New default ["opencode", "run", "--dir", "{cwd}", "{prompt_content}"] |
✓ |
R3 — No hardcoded --model in default |
✓ |
| R4 — No per-role harness command override (out of scope) | ✓ |
R5 — Test stub updates (4 _make_loop helpers) |
✓ |
| R6 — Design doc update (technical.md §8, §9) | ✓ |
R7 — Backwards compat ({prompt}, {cwd} retained) |
✓ |
| Harness agnosticism section added to SPEC | ✓ |
| Pi Dev example test case (test 8 in SPEC plan) | ✓ (implemented as test 7 in test_harness_command.py; SPEC numbering shifted, intent preserved) |
Bug reports
- BUG_REPORT: 5 observations, all non-blocking.
- ADVERSARIAL_BUG_REPORT: 7 attack vectors probed; one LOW bug found (A5: UnicodeDecodeError not caught) — fixed inline by broadening the
exceptclause to(OSError, UnicodeDecodeError). No blockers remaining.
Test results
python3 -m py_compile scripts/loop-runner.py✓python3 -m pytest tests/test_harness_command.py -v— 7 passedpython3 -m pytest tests/ -q— 440 passed (was 433; +7 new; no regressions)
D-items applied
- D-H1
{prompt_content}is a single argv element (no shell expansion) - D-H2
{prompt}retained for backwards compat - D-H3 no hardcoded
--modelin default - D-H4 no per-role override in this task
Harness-agnostic contract
Preserved and extended. The runner core has zero harness awareness. D8 (no model/provider inspection) intact. The new {prompt_content} token makes the framework MORE harness-agnostic than v1 by covering harnesses that prefer a message argument (Pi Dev, aider, any CLI taking a prompt as a positional). Non-opencode users override harness.command in loop.json.
Pipeline
research → research:awaiting_approval → research:approved → implement → code_review → code_review:awaiting_approval → code_review:approved → bug_find → adversarial_bug_find → doc_review → referee → complete
Pipeline driven end-to-end. Ready for --transition complete (which will relocate this task to tasks/complete/ per the move-completed-tasks-to-complete-folder feature).