Skip to content

fix(procevent): retry interrupted Lavish board polls - #64

Merged
withally merged 1 commit into
mainfrom
fm/fm-lavish-interrupt-retry-c1
Aug 22, 2026
Merged

fix(procevent): retry interrupted Lavish board polls#64
withally merged 1 commit into
mainfrom
fm/fm-lavish-interrupt-retry-c1

Conversation

@withally

Copy link
Copy Markdown
Owner

Intent

Stop interrupted Lavish board polls from waking firstmate or a second mate. The registered Lavish listen must keep running and retry lavish-axi poll on the same artifact only when the published output is exactly error: Lavish Editor poll response was interrupted with code SERVER_ERROR; arbitrary SERVER_ERROR results must not be retryable. Real feedback, ended, missing, and every other non-interrupt completion must still be captured and publish the ordinary check wake, and the Lavish adapter must not become self-announcing. Keep the generic process-event runner adapter-agnostic. Own the bounded retry policy in the bin/fm-procevent-lavish.sh header and --help; use 12 retries with a five-second default delay, surface the final interrupt after exhaustion, and allow only a bounded test delay override. Test through the public adapter and runner interface with a fake lavish-axi: prove retried interrupts create no captured result and no check wake, feedback after retries captures and wakes normally, exhaustion produces a captured result and wake at the documented bound, and unrelated SERVER_ERROR completes immediately. Update process-event-sources guidance only with a pointer to the adapter-owned policy, do not grow AGENTS.md, do not edit projects/lavish-axi or the Lavish product, do not change Herdr, Moshi, or Grok scroll behavior, and do not retire live board listens. Preserve one-owner documentation, one sentence per line in Markdown, plain dashes, shellcheck-clean bin scripts, public-interface behavioral tests without implementation-source byte assertions, and run the firstmate lint and no-mistakes PR pipeline.

What Changed

  • Added a poll subcommand to bin/fm-procevent-lavish.sh that runs the registered blocking Lavish listen and retries only the exact two-line Lavish Editor poll response was interrupted / SERVER_ERROR interrupt, up to 12 times with a five-second default delay, returning every other result (feedback, ended, missing, arbitrary SERVER_ERROR) immediately and surfacing the final interrupt after exhaustion so the runner still captures and wakes.
  • Rewired arm to register fm-procevent-lavish.sh poll instead of lavish-axi poll directly, keeping transient interrupts inside the adapter's process while the generic runner stays adapter-agnostic; documented the bounded policy in the script header/--help and added a FM_PROCEVENT_LAVISH_RETRY_DELAY_SECONDS override bounded to 0–60 for deterministic tests.
  • Added public-interface tests in tests/fm-procevent.test.sh driving a fake lavish-axi to prove retried interrupts produce no captured result or wake, feedback after retries captures and wakes normally, exhaustion captures and wakes at the documented bound, and an unrelated SERVER_ERROR completes immediately; updated process-event-sources/SKILL.md with a pointer to the adapter-owned retry policy.

Risk Assessment

✅ Low: Well-bounded, thoroughly tested adapter-local change that satisfies every required intent constraint, leaves the generic runner untouched, and has a verified-correct retry/exhaustion/exact-match algorithm.

Testing

Ran the targeted tests/fm-procevent.test.sh behavior suite (public adapter + runner interface with a fake lavish-axi); all tests pass including the four intent scenarios — retried interrupts produce no captured result and no check wake, feedback after retries captures and wakes normally, exhaustion captures the final interrupt and wakes at the documented 12-retry bound, and unrelated SERVER_ERROR completes immediately. Supplemented with a manual CLI demonstration of the poll command showing retry-then-feedback and immediate non-interrupt exit, plus the documented retry policy in --help. Worktree left clean; no linters run per scope.

Evidence: Intent-scenario test transcript

Source: Intent-scenario test transcript

ok - exact poll interrupts are retried without wakes before real feedback ok - exact poll interrupt retries are bounded and exhaustion stays visible ok - arbitrary SERVER_ERROR results are never retried all procevent tests passed

ok - one Send & End yields exactly one captured result, automatic retirement, and no recurring poll
ok - exact poll interrupts are retried without wakes before real feedback
ok - exact poll interrupt retries are bounded and exhaustion stays visible
ok - arbitrary SERVER_ERROR results are never retried
ok - the published interfaces state the loss limitation and claim no lossless delivery
all procevent tests passed
Evidence: Manual poll CLI demo (retry vs immediate)
=== exact interrupt retried twice (delay=0), then real feedback ===
session:
status: feedback
feedback[1]{text}:
looks great
exit=0 ; total lavish-axi calls=3

=== arbitrary SERVER_ERROR returns immediately, no retry ===
error: Lavish Editor server failed differently
code: SERVER_ERROR
exit=1 ; total lavish-axi calls=1
Evidence: Adapter --help retry policy

Source: Adapter --help retry policy

poll: exact two-line "poll response was interrupted" SERVER_ERROR retried up to 12 times, waiting five seconds between attempts; every other result returns immediately; final exact interrupt returns after exhaustion.

=== adapter --help: retry policy documented ===
poll       Run the registered blocking listen. The exact two-line
           "poll response was interrupted" SERVER_ERROR is retried up to 12
           times, waiting five seconds between attempts. Every other result
           returns immediately, and the final exact interrupt returns after
           exhaustion so the runner captures and announces it. The wait may
           be set to a nonnegative integer with
           FM_PROCEVENT_LAVISH_RETRY_DELAY_SECONDS for deterministic tests.

This adapter is deliberately thin. It owns only what is specific to Lavish:

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-procevent.test.sh — full adapter/runner behavior suite, all pass
  • ok - exact poll interrupts are retried without wakes before real feedback (no captured result, no check wake during retries; feedback captured + procevent lavish <id> 1 wake after)
  • ok - exact poll interrupt retries are bounded and exhaustion stays visible (stops at 13 total poll attempts, final interrupt captured + wake)
  • ok - arbitrary SERVER_ERROR results are never retried (single poll call, captured + wake immediately)
  • --help assertions: poll response was interrupted and up to 12 present in operator-facing help
  • Manual CLI: fm-procevent-lavish.sh poll <artifact> with fake lavish-axi — exact interrupt retried twice then real feedback (3 calls, exit 0); arbitrary SERVER_ERROR returned immediately (1 call, exit 1)
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 127)
✅ **Push** - passed

✅ No issues found.

@withally
withally merged commit 3a16740 into main Aug 22, 2026
13 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