Skip to content

fix(loop): eval P1 fixes — prompt fidelity, multi-process safety, tool validation (0.7.2) - #17

Merged
jkrandom-sudo merged 1 commit into
mainfrom
fix/p1-eval-findings
Jul 26, 2026
Merged

fix(loop): eval P1 fixes — prompt fidelity, multi-process safety, tool validation (0.7.2)#17
jkrandom-sudo merged 1 commit into
mainfrom
fix/p1-eval-findings

Conversation

@jkrandom-sudo

Copy link
Copy Markdown
Owner

Summary

Fixes the three P1 findings from the OpenCode vs Claude Code /loop comparison eval (L10/L11/L14):

  • LOOP-001 prompt fidelity: flags (--once/--all/--jitter=*) are only parsed in the option prefix before the prompt begins; -- terminates flag parsing; the prompt is kept as the original substring — flag-like text, whitespace, and newlines in the body are preserved verbatim (previously silently stripped).
  • LOOP-002 multi-process safety: tasks record ownerPid/ownerStartedAt; store load drops only tasks whose owner is confirmed dead (signal-0 probe, conservative on errors) instead of tombstoning everything written by another live process. Instance lock now only serializes same-process instances (shouldFire) — a second OpenCode process fires its own tasks instead of starving.
  • LOOP-003 tool validation: shared validateFixedInterval (≥1000ms) across slash parser, loop_schedule create, and set_fixed; schema gains .min(1000); adaptive/maintenance create with intervalMs rejected.

Also: bare /loop stop cancels all tasks in scope (session, or all with --all).

Test plan

  • npm test — 164/164 (new parser fidelity, dual-process store, shouldFire, tool validation, stop tests)
  • Real opencode E2E (two opencode serve processes, same project):
    • L14: marker 中文 空格 --once --all $HOME written verbatim; one-shot fired once and auto-cleaned
    • L11: process B no longer wipes A's tasks; list --all sees them; dead owner's tasks dropped on next load
    • L10: loop_schedule(create, fixed, intervalMs=0) rejected, no ghost task
    • bare /loop stop cancels only current-session tasks

🤖 Generated with Claude Code

…, tool validation (0.7.2)

Addresses the three P1 findings from the OpenCode/Claude Code /loop
comparison eval (L10/L11/L14):

- LOOP-001: flags (--once/--all/--jitter=*) are parsed only in the option
  prefix before the prompt begins; `--` terminates flag parsing; prompt
  text is kept as the original substring, so flag-like text, whitespace,
  and newlines in the body survive verbatim (was: silently stripped).
- LOOP-002: tasks now record ownerPid/ownerStartedAt. Store load drops
  only tasks whose owner process is confirmed dead (signal-0 probe,
  conservative on probe errors); tasks owned by other live OpenCode
  processes survive and stay visible via --all. The instance lock now
  only serializes same-process instances (shouldFire), so a second
  process fires its own tasks instead of starving.
- LOOP-003: shared validateFixedInterval (>=1000ms) used by the slash
  parser, loop_schedule create, and set_fixed; tool schema gains
  .min(1000); adaptive/maintenance create with intervalMs is rejected.

Also: bare `/loop stop` cancels every task in scope (current session, or
all sessions with --all); `/loop stop <id>` stays single-task cancel.

Verified end-to-end against real opencode serve instances: L14 marker
verbatim, L11 dual-process coexistence + dead-owner cleanup, L10 tool
rejection, and stop scoping. 164/164 unit tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jkrandom-sudo
jkrandom-sudo merged commit 639eb3d into main Jul 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant