Files
Lap Tran bc7daf8590 Restore archived tasks, fix dashboard scroll-reset, bind ornith, add Playwright smoke test
- **Restore 82 completed tasks** from tasks/complete/ back to tasks/ top
  level (all <7 days old per the cleanup policy; premature bulk archive
  was fixed).
- **Dashboard: fix scroll-reset on auto-refresh** — renderBoard rebuilds
  the board via innerHTML every 2s, destroying each column-body's
  scrollTop. Now snapshots column-body scrollTop + board.scrollLeft +
  view.scrollTop before rebuild and restores after (matched by
  PHASE_GROUPS index).
- **Dashboard UI additions** (pre-existing unstaged work): approval
  section cards, transition buttons, inline artifact editor (textarea for
  writing missing SPEC/VERDICT/etc from the detail modal).
- **Bind ornith as Implement model** — config.md: Model explicit to
  omlx/Ornith-1.0-35B-4bit-mlx, context window 32768. Interactive
  autopilot already used ornith via opencode default; now explicit.
- **Fix cleanup stub** — automaton-cleanup.sh had a stale --project arg
  pointing at a pytest temp dir (test isolation leak). Rewired to point
  at ~/.automaton.
- **Fix plist-isolation test** — test asserted host plist doesn't exist,
  but a real install creates it. Now snapshots mtime before run, asserts
  unchanged after (only a write during the test counts as bleed).
- **New Playwright smoke test** (tests/test_dashboard_ui.py) — 2 tests:
  board renders tasks, column scroll survives auto-refresh tick.
  Verified the test fails without the scroll fix (scrollTop resets to 0).
  Skipped via importorskip when playwright is absent (main CI stays
  green).
- **Clarify SI loop scope in README** — new-project onboarding section
  documents the framework-scoped self-improvement loop and options
  (leave/pause/create project loop).
- **CHANGELOG** documents all changes including the known model-divergence
  gap (mde tasks marked complete but per-role model binding was never
  implemented).
2026-06-26 10:05:18 -04:00

4.5 KiB

Code Review: fix-harness-command-template

Self-review against the SPEC and the harness-agnostic contract.

SPEC compliance

  • R1 {prompt_content} substitution token: ✓ implemented in _invoke_harness (loop-runner.py). Reads the resolved prompt file's text; falls back to "" on OSError. Single argv element under subprocess.run list mode.
  • R2 New default ["opencode", "run", "--dir", "{cwd}", "{prompt_content}"]: ✓ replaced both fallback branches (harness_cfg is None, and empty command array).
  • R3 No hardcoded --model in default: ✓ confirmed — model is inherited from opencode config.
  • R4 Per-role harness command override: ✓ not added (out of scope, per design).
  • R5 Test stub updates: ✓ _make_loop helpers in 4 test files write loop-local prompt stubs only when the framework prompt at ~/.automaton/prompts/<ref> does not already exist (preserves token-substitution tests in test_loop_templates). Custom-command tests now identify roles by implement-prompt/verify-prompt matchers (the temp file path); default-command tests use test-impl etc. (matching the stub content prompt: test-impl.md).
  • R6 Design doc update: ✓ design/loops/technical.md §8 and §9 (self-improvement template) updated to the new default; documented {prompt_content} alongside existing tokens; added Pi Dev, aider, and generic examples.
  • R7 Backwards compat: ✓ {prompt} and {cwd} tokens still populated; the existing custom-command test (TestHarnessSubstitution.test_custom_command_with_output_token) passes unchanged.

Harness-agnostic contract check

  • Runner core has zero harness awareness: ✓ only token substitution, no if harness == "opencode" branches.
  • D8 (no model/provider inspection): ✓ preserved; no model name appears in the runner core, only in user-overridable harness.command.
  • The fix is MORE agnostic than v1: ✓ adds {prompt_content} covering harnesses that prefer a message argument (aider, Pi Dev, any CLI taking a prompt as positional). v1 only supported file-path-based prompts.

Test plan compliance

Tests in tests/test_harness_command.py (7 new):

  1. test_default_uses_dir_not_cwd — ✓ asserts --dir is present, --cwd and --prompt-file absent
  2. test_default_passes_prompt_content — ✓ asserts the prompt text appears as the last argv element
  3. test_prompt_content_handles_special_chars — ✓ asserts a prompt containing single quotes, double quotes, and dollar signs appears as a single argv element
  4. test_prompt_token_still_available — ✓ custom ["cat", "{prompt}"] receives the temp file path
  5. test_custom_command_with_cwd_still_works — ✓ custom --cwd receives the cwd value
  6. test_empty_command_falls_back_to_new_default — ✓ empty command array falls back to --dir {cwd} {prompt_content} (NOT the old shape)
  7. test_pi_shaped_command_substitutes_correctly — ✓ proves the substitution mechanism works for a non-opencode binary (pi run --cwd {cwd} {prompt_content})

Existing tests updated (per SPEC R5):

  • _make_loop helpers in 4 test files now write loop-local prompt stubs with role-marker content prompt: <ref>, preserving the substring-matcher strategy used by tick-flow tests. Skipped when the framework prompt exists (so test_loop_templates still substitutes real framework prompt tokens).
  • The --prompt-file stub rule (fake_run.add_simple("--prompt-file", "")) is removed — the default matcher fallback handles generic invocations.
  • Custom harness.command tests using {prompt} token: matchers updated from test-impl to implement-prompt (the resolved temp file path contains tickN-implement-prompt.md).
  • Default-command tests using {prompt_content} stub content: matchers stay test-impl (matches the stub content prompt: test-impl.md).

Full suite: 440 passed (was 433; +7 new). No regressions.

Risks revisited

  • Argv length: real prompts are 2-10KB; OS argv limit is 128KB+. Acceptable.
  • Test mock drift: the fake_run fixture now mocks a different default shape. A separate smoke test that shells out to opencode run --help would catch future flag renames. Not added in this task to keep the change focused; noted for a future hardening pass. The 7 new _invoke_harness unit tests do cover the default-command construction directly, which is the main surface.
  • Pi Dev CLI: actual pi run flags unverified (pi not installed on this machine). The Pi Dev test (test 7) uses a representative shape; the user confirms actual flags against pi run --help on their machine before going live.

Verdict

PASS — proceed to bug_find.