Skip to content

feat: route Lavish feedback directly to owning workers - #5099

Merged
kunchenguid merged 14 commits into
mainfrom
fm/fm-crew-hosted-lavish-shipB-r1
Sep 21, 2026
Merged

kunchenguid merged 14 commits into
mainfrom
fm/fm-crew-hosted-lavish-shipB-r1

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Rebuild the worker-owned Lavish listener - the second half of the crew-hosted-Lavish fix, after Ship A landed the clean parts (merged as #5060, on main at c443d8c) - on the SIMPLER mechanism the grind assessment settled: "a round stays open until the worker acknowledges it." The original per-round claim-handoff mechanism is abandoned (it was a concurrency tangle and was never prototyped). Firstmate no-mistakes, yolo off, hold the green PR for the captain's merge.

Requirements (authoritative design: the scout report data/fm-crew-hosted-lavish-poll-fix-s1/report.md "Revised design after round 2" plus its Ship B rules, and the grind assessment data/fm-crew-hosted-lavish-layer1-grind-assess-s1/report.md "Ship B" section):

  • The worker owns and re-arms its own board via the arm path; captured feedback goes STRAIGHT to the owning worker's steering inbox and does NOT wake firstmate for the words (captain's intent verbatim: "what i meant as 'worker hosts' is that if i send feedback on the lavish board, it will go straight to the worker").
  • A round stays open until the worker ACKNOWLEDGES it, reusing the runner's EXISTING handled marker - re-arm is an acknowledgement, NOT a claim handoff; never touch the claim at re-arm. This is the specific shape that avoids the per-round handoff race that sank the first attempt.
  • NO second ownership (.owner) record; do NOT carry the .owner record, retire-task-over-.owner, or busy-record list code from the abandoned attempt.
  • Register refuses a second armer (naming the holder); terminal outcomes (session_ended, empty End, missing) route to the owner with an explicit stop/conclude and never auto-re-arm; honest presence follows from the acknowledge-round model.
  • Rider 2 accepted: the cross-home-between-rounds residual is acceptable until lavish-axi's exclusive listener (S1) lands - do not build machinery to close it now.
  • Replace Ship A's interim brief sentence with the arm-your-board contract.

PROTOTYPE FIRST: prototype the full multi-round loop end-to-end (arm -> captain feedback reaches the worker inbox -> worker acknowledges and re-arms with its reply -> next round -> session_ended stop) BEFORE entering no-mistakes review. The original's cost was underestimated precisely because it was never prototyped; do not skip this.

What Changed

  • Add task-owned Lavish board registration that delivers captured rounds directly to the worker steering inbox and refuses competing armers or premature retirement.
  • Keep each round open until the worker acknowledges it: nonterminal re-arm acknowledges the prior round and stages a reply, while terminal outcomes require explicit conclusion without re-arming.
  • Update worker guidance and documentation, with multi-round and failure-path regression coverage.

Risk Assessment

✅ Low: The worker-owned multi-round flow, terminal conclusion recovery, direct inbox routing, and reply staging are coherently implemented and covered by behavior-level regression tests, with no new material defect found.

Testing

The targeted process-event regression suite passed, including rollback, crash-recovery, redelivery, endpoint, ownership, reply-consumption, and terminal-round cases. Live product validation covered feedback routing, worker acknowledgement and re-arm, ownership refusal, and terminal acknowledgement without restart. Recovery and endpoint/redelivery behavior lacked live-product evidence, so the overall result is inconclusive.

  • Live validation: ⚠️ inconclusive - 4 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Captain submits Lavish feedback and it reaches the owning worker directly without waking firstmate ✅ pass live live-round1-routing.txt shows the real feedback in worker-live.inbox, the complete captured message, and an absent firstmate wake queue.
Worker acknowledges the open round by re-arming with a reply and receives the next round ✅ pass live live-board-round2.png visibly shows the captain message and worker reply; live-rearm-state.txt records round one handled while the source remains registered.
A second armer cannot take a worker-owned board and the refusal names its holder ✅ pass live live-second-armer-refusal.txt records nonzero status and names worker-live as the owner.
Send & End routes an explicit terminal stop to the worker, does not auto-rearm, and retires only after acknowledgement ✅ pass live live-terminal-open.txt, live-board-ended.png, and live-terminal-final-state.txt show the terminal instruction, zero starts while open, retirement on handled acknowledgement, and zero starts afte…
Interrupted or failed acknowledgement preserves ownership and the prior executable registration for recovery ⏸️ untested no The prior payload supplied only a regression-test transcript, not evidence from driving this scenario against the live product. Live validation must interrupt or fail acknowledgement in an isolated ru…
Worker ownership requires a valid endpoint and an open inbox note is redelivered rather than silently consumed ⏸️ untested no The prior payload supplied only a regression-test transcript, not evidence from driving this scenario against the live product. Live validation must exercise missing-endpoint refusal and open-inbox re…

Live Lavish conversation after worker acknowledgement and re-arm

Evidence: Round-one direct worker routing and absent firstmate wake

Source: Round-one direct worker routing and absent firstmate wake

=== worker inbox ===
schema=fm-task-inbox.v1
at=2026-09-21T03:34:03Z
--
Lavish review feedback is captured for task worker-live at ~/.no-mistakes/evidence/01M30G6BW5H1R6GPJDGE0VACGA/live-home/state/procevent-inbox/lavish-b00b4ff70941981a.1.result. Read it with bin/fm-procevent-lavish.sh read ~/.no-mistakes/evidence/01M30G6BW5H1R6GPJDGE0VACGA/live-home/state/procevent-inbox/lavish-b00b4ff70941981a.1.result, apply the round, and re-arm the board with the reply.=== captured Lavish result ===
CAPTAIN MESSAGE
| Round one: tighten the direct worker routing proof.
END CAPTAIN MESSAGE

declared_items: 1
presented_items: 1
malformed_items: 0
complete: yes
lifecycle: feedback
session_ended: (unset)
annotation_count: 0
session_ending_message_count: 1

ANNOTATIONS: (none)
END LAVISH RESULT (1 of 1)
=== firstmate wake queue ===
<absent>
Evidence: Open terminal round ownership and no-auto-rearm state

Source: Open terminal round ownership and no-auto-rearm state

=== terminal worker inbox ===
schema=fm-task-inbox.v1
at=2026-09-21T03:34:47Z
--
Lavish review result lavish-b00b4ff70941981a sequence 2 is terminal at ~/.no-mistakes/evidence/01M30G6BW5H1R6GPJDGE0VACGA/live-home/state/procevent-inbox/lavish-b00b4ff70941981a.2.result. Read it with bin/fm-procevent-lavish.sh read ~/.no-mistakes/evidence/01M30G6BW5H1R6GPJDGE0VACGA/live-home/state/procevent-inbox/lavish-b00b4ff70941981a.2.result, stop and conclude the review, and do not re-arm the board. The board stays yours until you acknowledge this round with bin/fm-procevent.sh handled lavish-b00b4ff70941981a 2, which retires it.
=== terminal result ===
SESSION-ENDING MESSAGE
| Terminal round: conclude this review now.
END SESSION-ENDING MESSAGE

declared_items: 1
presented_items: 1
malformed_items: 0
complete: yes
lifecycle: feedback
session_ended: true
annotation_count: 0
session_ending_message_count: 1

ANNOTATIONS: (none)
END LAVISH RESULT (1 of 1)
=== registration before acknowledgement ===
SOURCE                       ADAPTER      OWNER      PENDING
lavish-b00b4ff70941981a      lavish       task:worker-live/round-open 1
=== reconcile while terminal round open ===
reconciled: published=1 started=0 stopped=0 uncertain=0 failed=0
Evidence: Competing armer refusal naming the worker owner

Source: Competing armer refusal naming the worker owner

status=1
stdout:
stderr:
error: cannot arm task-owned Lavish source lavish-b00b4ff70941981a owned by task worker-live; steer that task to re-arm its board
Evidence: Terminal acknowledgement and final non-restart state

Source: Terminal acknowledgement and final non-restart state

registration_after_ack=absent
handled_round2=yes
reconcile_after_ack:
reconciled: published=0 started=0 stopped=0 uncertain=0 failed=0
Evidence: Targeted process-event regression transcript

Source: Targeted process-event regression transcript

ok - no configured source means no generated state and no process
ok - one blocking completion yields exactly one bounded normalized event
ok - a home reached through a symlinked ancestor runs its sources normally
not-autohandled: direct-src (left for the handler; still unacknowledged)
ok - public start owns the process group recorded by its claim
ok - public start never claims an inherited caller process group
ok - an unhandled result survives restart and repeat drains, and only explicit acknowledgement stops its re-announcement
ok - publication cannot race a handled acknowledgement
ok - handled acknowledgement creation is private and fails safely
ok - automatic application waits for durable publication and failed publication remains recoverable
ok - a self-announcing adapter applies quietly and still publishes what it could not apply
not-autohandled: ends-src (left for the handler; still unacknowledged)
ok - an adapter-classified terminal result is captured once, announced, and retires its source automatically
not-autohandled: open-src (left for the handler; still unacknowledged)
ok - a source stays armed unless its own adapter classifies the result terminal
not-autohandled: replace-src (left for the handler; still unacknowledged)
ok - terminal retirement preserves and releases a concurrently replaced registration
ok - failed terminal retirement is fail-closed and idempotently recoverable
ok - one Send & End yields exactly one captured result, automatic retirement, and no recurring poll
ok - an empty board close is captured and recorded handled without ever waking the captain
ok - worker-owned Lavish rounds deliver to the worker, acknowledge on re-arm, and stop at session end
ok - a capture interrupted before its result commit does not wedge its source
ok - an orphaned capture is not acknowledged by a worker it never reached
ok - a worker-owned board is only armed for an owner its feedback can reach
ok - an open worker-owned round is re-delivered after its note was filed away
ok - acknowledging a terminal round concludes that round only
ok - an interrupted conclude leaves the ended board unpollable and finishes on retry
ok - a re-arm that cannot acknowledge its round leaves the running generation alone
ok - a worker-owned board is armed once and re-armed only to acknowledge an open round
ok - a board close carrying the captain's real answer is still announced
ok - the shipped poll governor bounds an instantly returning source
ok - a transient Lavish poll interruption is retried quietly and never announced
not-autohandled: lavish-f007100d28385d5c (left for the handler; still unacknowledged)
ok - a staged worker reply is handed to the board once across quiet poll retries
ok - a listener whose staged reply is gone polls the board without one
ok - a listener that refuses its own setup leaves the staged reply for the next one
ok - a listener whose artifact vanished leaves the staged reply for the next one
not-autohandled: lavish-b96491edb27ade09 (left for the handler; still unacknowledged)
ok - an interruption that outlives the bounded retries is captured and announced
not-autohandled: lavish-2e81e99cf3af0f47 (left for the handler; still unacknowledged)
ok - only the exact interruption is retried; an unrelated SERVER_ERROR still surfaces
not-autohandled: lavish-0f504373164fc2bb (left for the handler; still unacknowledged)
ok - only the literal two-line interruption enters the quiet retry policy
ok - arm rejects malformed and out-of-range retry delays before registration
ok - poll cleanup safely handles an apostrophe-containing TMPDIR
ok - Lavish classification staging stays bounded while nonmatches stream
ok - a drained-but-unhandled result survives a replacement session and is retired only by explicit handling, never twice
ok - pending results preserve numeric order and distinct wake identity
ok - one owner per canonical source across homes
ok - retiring a never-completing source stops its runner and its blocked child
ok - reconcile reaps a runner whose source registration is gone
not-autohandled: stale-src (left for the handler; still unacknowledged)
ok - stale-owner recovery removes abandoned output without displacing a live owner
not-autohandled: cross-home-src (left for the handler; still unacknowledged)
ok - cross-home stale recovery removes abandoned output from the old state directory
not-autohandled: race-src (left for the handler; still unacknowledged)
not-autohandled: race-src (left for the handler; still unacknowledged)
ok - concurrent stale-claim replacement starts exactly one runner
ok - an ambiguous leaderless group is preserved without replacement
ok - a truly dead generation with no surviving group is still safely reclaimed
ok - reconcile reclaims a dead generation whose state-root identity no longer matches
ok - retire releases a dead generation's claim instead of refusing forever
ok - a live generation is never reclaimed, drifted state root or not
ok - a reused pid never makes its surviving process group reclaimable
ok - start reclaims a reused-pid claim whose leftovers can still be tidied
ok - a launch that cannot confirm is announced once per failure episode
ok - a 64-char source id keeps the launch-failed key within the watcher's marker bound
ok - reconcile reports a launch it could not confirm instead of counting it as a start
ok - a launch that finished before confirmation looked is still reported as started
ok - a zero-padded launch confirm window is honored as base 10
ok - an unusable launch confirm window is refused by name instead of blamed on the sources
ok - a dead generation whose leftovers cannot be tidied never keeps owning its source
ok - claim replacement cannot produce a torn ownership snapshot
ok - retirement and start share one serialized lifecycle boundary
ok - detected PID reuse is refused before signalling
ok - transient identity failure preserves the live source for retry
ok - bounded home sweep preflights then retires every locally owned source
ok - home sweep leaves foreign-home claims and runners untouched
ok - home sweep refuses safely until runner identity is readable
ok - healthy runtime behavior remains registration-only
ok - registration rejects unrepresentable newline arguments
ok - nonzero exit with no output stays armed and silent
ok - oversized output is bounded rather than published whole or dropped
ok - live output stays bounded and retirement reaps the whole source group
ok - stop mismatch evidence preserves the proved-stop boundary
ok - stop unreadable evidence preserves the proved-stop boundary
ok - stop unreadable-pgid evidence preserves the proved-stop boundary
ok - stop nonleader evidence preserves the proved-stop boundary
ok - invalid output bounds fail closed
ok - the adapter derives physical identity without newline path corruption
ok - source-only homes trigger the general supervision guard
ok - the adapter classifies published poll output safely
ok - Lavish poll uses the configured per-machine board address
ok - Lavish poll restores its original host when configuration disappears
ok - Lavish poll fails closed when host configuration cannot be inspected
ok - the adapter owns which Lavish results end a source, and payload text cannot forge one
ok - the adapter owns which Lavish results are silent, and fails closed on everything else
ok - read distinguishes a live captain message from a session-ending message
ok - read presents every annotation and a distinct session-ending message
ok - read never certifies rows missing declared fields as complete
ok - read keeps every annotation when the session-ending message is absent
ok - read surfaces a typed comment on an annotated element
ok - read still surfaces a typed comment that matches the element text
ok - read still presents a pure annotation with no comment
ok - read does not present choice context as a comment
ok - read still presents a pure message with no selector
ok - read distinguishes a feedback capture from an ended-with-nothing close
ok - an adapter with no silence verdict keeps announcing every result
ok - the published interfaces state the loss limitation and claim no lossless delivery
registered: floor-src (lavish)
ok - an orphaned source command obeys the launch floor during its grace window
ok - a replacement registration starts with one fresh launch floor
ok - a superseded sleeping runner cannot recreate stale pacing state
ok - post-commit pacing cleanup cannot veto registration publication
ok - a pre-reboot monotonic stamp is treated as expired
ok - an expired owner lease stops a self-relaunching source generation
ok - a recreated state path does not preserve the old runner
registered: guard-fail-src (lavish)
ok - a runner fails closed when its owner guard cannot initialize
registered: attached-src (lavish)
ok - a foreground start refreshes its lease while its caller remains attached
ok - wall-clock corrections do not alter owner lease age
registered: detached-attached-src (lavish)
ok - an attached-start keeper stops refreshing after its parent exits
ok - a detected ambiguous reused-PID group is not signalled
ok - a detached listener starts reparented, with a live descendant tree under it
ok - a listener whose owning session is gone stops itself and its whole process group
ok - reaping the listener stops the process churn under it
ok - an identical listener in a home whose session is still there is untouched
ok - retiring a source reaps its reparented listener and every descendant under it
ok - a stop the guard cannot prove is retried until the expired runner is reaped
ok - retirement escalates after TERM leaves a surviving child (absent leader)
ok - retirement escalates after TERM leaves a surviving child (zombie leader)
ok - an expired runner's guard escalates past a signal-proof child
guard phase: fresh read 6.414-6.426s, expiry 8s, two full intervals could not finish before 18.414s (deadline 17s)
guard bound: lease=7s check=6s reaped 13.2s after the last owner activity, documented bound 15s
ok - an orphaned runner is reaped within the lease plus ONE check interval
decimal interval: 08 halves to 4s and its listener started
decimal interval: 010 halves to 5s and its listener started
ok - a zero-prefixed decimal interval starts its listener and halves as decimal
ok - one unreadable read does not end a live runner
ordinary stop: start status=143 retirement=507ms sampled windows=4760/4708ms
ok - a runner exits on the ordinary stop signal instead of outliving it
ok - a group whose leader died to something else is still refused, not signalled

all procevent tests passed
Evidence: Guarded Herdr lab teardown confirmation

Source: Guarded Herdr lab teardown confirmation

teardown: fm-lab-lavish-live-56223-23765 removed with default-session tripwire intact
- Outcome: ⚠️ 1 warning across 1 run (9m22s)

Pipeline

Updates from git push no-mistakes

... (19 earlier update rounds omitted to keep the PR body within GitHub's 65536-char limit; full history is in the run log.)

🔧 **Review** - 3 issues found → auto-fixed (12) ✅

🔧 Fix applied.
15 issues (12 errors, 3 warnings) still open:

  • ⚠️ bin/fm-procevent.sh:740 - The immediate inbox doorbell passes task ID worker-1 as the expected endpoint label, but task endpoints use fm-worker-1 (as derived by fm_backend_expected_label_of_selector and window_label). Identity-checking backends such as Zellij reject the mismatched label, so feedback is durably queued but the worker is not notified until the watcher's delayed re-ring. Derive and pass the canonical expected label here.
  • 🚨 bin/fm-procevent.sh:549 - A failed re-arm can corrupt the still-valid prior registration. For example, after an arm stages id.reply but before its runner starts, retrying with a nonexistent reply path deletes id.reply at line 549 and then fails validation at line 562; the unchanged source still references that deleted file, so every launch exits without polling and captain feedback is no longer collected. The same invariant is violated when line 570 replaces the prior reply before registration publication can fail at line 576. Stage the new reply under a generation-specific path and only clean the prior reply after the new source record commits, so every failed re-arm leaves the previous registration executable.
  • 🚨 bin/fm-procevent.sh:492 - Intent contradiction: the requirement says “Register refuses a second armer (naming the holder)” and firstmate must never arm a worker-hosted board, but ownership checks consult only the live .source. After a worker-owned terminal capture, retire_owned_terminal_source removes that record while the unhandled .owner-task evidence remains; a subsequent ordinary Lavish arm sees no source_kind, publishes a firstmate registration at line 501, and reconcile polls the ended worker board. The sibling task path also checks pending results only for terminality at lines 529-536: after explicit retirement of an open nonterminal round, another task can register and lines 581-588 acknowledge the original owner’s capture. Registration must honor immutable pending owner evidence even when the source record is absent.
  • 🚨 bin/fm-procevent.sh:711 - Terminal worker rounds have no completion path. The terminal message says only to stop, while re-arm is prohibited at lines 529-535 and re-arm is the only new path that writes handled markers at lines 581-588. Consequently session_ended, empty End, and missing captures remain pending forever and every reconcile republishes/rings them. The new test at tests/fm-procevent.test.sh:794-799 confirms only sequences 1 and 2 are handled and leaves terminal sequence 3 open. Instruct the worker to acknowledge the terminal sequence with the existing handled command after processing it, and verify that terminal pending state clears.
  • 🚨 bin/fm-procevent.sh:569 - The latest fix round left the second half of the failed-rearm corruption sequence intact. A prior registration can still reference $id.reply; re-arm overwrites that shared file at line 569 before publication at line 575, so a publication failure makes the prior registration send the new reply even though re-arm reported failure. If publication succeeds but handled-marker creation fails at line 584, the failed command likewise leaves the replacement registration installed. Keep the prior registration and reply generation intact until registration publication and acknowledgement commit, rolling back on either failure; use generation-specific reply paths rather than the shared destination.
  • 🚨 bin/fm-procevent.sh:1829 - Intent contradiction: the requirement says the owning source remains authoritative until acknowledgement, but explicit retire still removes a task-owned source with an open round. Concrete path: worker-1 captures nonterminal feedback, retire removes its source, then worker-2 registers at lines 533-551 and lines 585-592 mark worker-1's capture handled because only terminality—not captured owner—is checked. Ordinary registration can likewise replace the retired owner at lines 496-504. Round 3's ownership fix left this explicit-retirement sibling path behind, and the new test at tests/fm-procevent.test.sh:800 never executes the required retire/re-register sequence. Refuse retirement while a task-owned capture is unacknowledged, and only let re-arm acknowledge captures whose immutable owner matches the registering task.
  • 🚨 bin/fm-procevent.sh:731 - Repeat delivery breaks after the worker consumes the first inbox notification. fm_task_inbox_write_idempotent can return the matching record under inbox/handled/; line 740 then rings using that path, and fm_task_inbox_doorbell_line derives inbox/handled as the inbox and instructs the worker to move the record into nonexistent handled/handled/. If the worker moved the notification before crashing or re-arming, every reconcile repeats this malformed doorbell and no active inbox record restores the still-open round. When the matching record is already handled but the process result remains unacknowledged, create or reference a valid active inbox delivery rather than ringing the handled pathname.
  • ⚠️ bin/fm-procevent.sh:1814 - Terminal acknowledgement ignores failure to remove the source and still prints retired. If removal fails, the handled marker already suppresses the terminal result, while reconcile sees a task-owned source with no pending round and launches another poll, producing duplicate terminal captures. Check removal and roll back the newly created handled marker on failure so the source remains owned and round-open.
  • ⚠️ bin/fm-procevent.sh:1826 - The new task-terminal path retires the source when handled succeeds, but the public command help at line 85 still states that marking a result handled does not retire its registration or claim. Document the task-owned terminal exception so callers do not rely on a guarantee this change invalidates.
  • 🚨 bin/fm-procevent.sh:1832 - Terminal acknowledgement is not crash-recoverable. If the process dies after creating the handled marker here but before removing the source at line 1836, source_pending permanently hides that terminal result. A repeated handled call therefore does not set conclude, register-task's terminal check at lines 554-561 permits re-arm, and reconcile's pending guard at lines 1561-1565 permits another poll of the ended board. Round 5's r11 fix handles an ordinary removal error but left this crash sibling reachable. Detect and finish a handled terminal conclusion at the shared task-source boundaries before either re-arm or reconcile can launch it again.
  • 🚨 bin/fm-procevent.sh:589 - The selected r7 failed-rearm invariant remains unresolved. The replacement registration commits here and stale reply generations are deleted at lines 594-598 before the existing round is acknowledged at lines 601-608. If handled-marker creation fails, the command reports failure but leaves the replacement registration and reply installed rather than preserving the prior executable registration. Keep the prior registration generation until acknowledgement commits, and restore it plus its reply on acknowledgement failure.
  • 🚨 bin/fm-procevent.sh:554 - Task registration treats every unhandled result sharing the source ID as the registering worker's round, without checking its immutable owner sidecar. Concrete path: firstmate captures nonterminal feedback, explicitly retires that source before handling it, then a worker arms the same artifact. Lines 554-561 accept the legacy result and lines 601-608 silently mark it handled even though it was never routed to that worker. Filter both terminal validation and acknowledgement to captures whose .owner-task equals the registering task, and refuse unmatched pending captures rather than consuming them.
  • 🚨 bin/fm-procevent.sh:532 - register-task validates only the task-id syntax, not that it identifies a current task endpoint. A worker typo such as --for worker-10 is accepted, persisted as the capture owner at bin/fm-procevent-lib.sh:1062, and later causes publish_result to create an ownerless worker-10.inbox at bin/fm-procevent.sh:756 while suppressing the firstmate wake; lines 760-767 find no metadata and ring nobody, so captain feedback remains stranded indefinitely. Validate the task’s regular, identity-matching endpoint metadata before publishing a task-owned registration.
  • 🚨 bin/fm-procevent.sh:545 - Intent contradiction: “re-arm is an acknowledgement” requires an open captured round, but the same task may re-arm while no round is pending. Concrete sequence: worker-1 arms with reply A; while that listener still owns the claim, a repeated arm stages reply B and replaces the registration at bin/fm-procevent.sh:613; the acknowledgement loop at bin/fm-procevent.sh:621 is empty; after the old listener captures feedback, the proper next re-arm replaces the registration again and stale cleanup at bin/fm-procevent.sh:632 deletes reply B without ever posting it. Remove this extra acceptance path by refusing same-owner replacement unless an unacknowledged nonterminal round exists; initial arm remains the source-absent path.
  • 🚨 bin/fm-procevent.sh:1868 - The half-finished-conclude recovery path can retire a later board generation. Concrete sequence: acknowledge terminal sequence 1, arm a new Lavish session using the same artifact/source ID, then repeat the idempotent handled &lt;id&gt; 1 call. Because lines 1868-1883 inspect the old terminal result but never check whether it is already handled or belongs to the current registration, they delete the new registration before fm_procevent_mark_handled reports already-handled. The same unsupported fallback is asserted at tests/fm-procevent.test.sh:1050 and documented at docs/configuration.md:893. No authoritative intent requirement requires recovering the legacy marker-before-retirement state, and safely retaining that behavior would require new generation binding; remove this extra recovery path and only retire for a currently unhandled terminal round.

🔧 Fix applied.
16 issues (13 errors, 3 warnings) still open:

  • ⚠️ bin/fm-procevent.sh:740 - The immediate inbox doorbell passes task ID worker-1 as the expected endpoint label, but task endpoints use fm-worker-1 (as derived by fm_backend_expected_label_of_selector and window_label). Identity-checking backends such as Zellij reject the mismatched label, so feedback is durably queued but the worker is not notified until the watcher's delayed re-ring. Derive and pass the canonical expected label here.
  • 🚨 bin/fm-procevent.sh:549 - A failed re-arm can corrupt the still-valid prior registration. For example, after an arm stages id.reply but before its runner starts, retrying with a nonexistent reply path deletes id.reply at line 549 and then fails validation at line 562; the unchanged source still references that deleted file, so every launch exits without polling and captain feedback is no longer collected. The same invariant is violated when line 570 replaces the prior reply before registration publication can fail at line 576. Stage the new reply under a generation-specific path and only clean the prior reply after the new source record commits, so every failed re-arm leaves the previous registration executable.
  • 🚨 bin/fm-procevent.sh:492 - Intent contradiction: the requirement says “Register refuses a second armer (naming the holder)” and firstmate must never arm a worker-hosted board, but ownership checks consult only the live .source. After a worker-owned terminal capture, retire_owned_terminal_source removes that record while the unhandled .owner-task evidence remains; a subsequent ordinary Lavish arm sees no source_kind, publishes a firstmate registration at line 501, and reconcile polls the ended worker board. The sibling task path also checks pending results only for terminality at lines 529-536: after explicit retirement of an open nonterminal round, another task can register and lines 581-588 acknowledge the original owner’s capture. Registration must honor immutable pending owner evidence even when the source record is absent.
  • 🚨 bin/fm-procevent.sh:711 - Terminal worker rounds have no completion path. The terminal message says only to stop, while re-arm is prohibited at lines 529-535 and re-arm is the only new path that writes handled markers at lines 581-588. Consequently session_ended, empty End, and missing captures remain pending forever and every reconcile republishes/rings them. The new test at tests/fm-procevent.test.sh:794-799 confirms only sequences 1 and 2 are handled and leaves terminal sequence 3 open. Instruct the worker to acknowledge the terminal sequence with the existing handled command after processing it, and verify that terminal pending state clears.
  • 🚨 bin/fm-procevent.sh:569 - The latest fix round left the second half of the failed-rearm corruption sequence intact. A prior registration can still reference $id.reply; re-arm overwrites that shared file at line 569 before publication at line 575, so a publication failure makes the prior registration send the new reply even though re-arm reported failure. If publication succeeds but handled-marker creation fails at line 584, the failed command likewise leaves the replacement registration installed. Keep the prior registration and reply generation intact until registration publication and acknowledgement commit, rolling back on either failure; use generation-specific reply paths rather than the shared destination.
  • 🚨 bin/fm-procevent.sh:1829 - Intent contradiction: the requirement says the owning source remains authoritative until acknowledgement, but explicit retire still removes a task-owned source with an open round. Concrete path: worker-1 captures nonterminal feedback, retire removes its source, then worker-2 registers at lines 533-551 and lines 585-592 mark worker-1's capture handled because only terminality—not captured owner—is checked. Ordinary registration can likewise replace the retired owner at lines 496-504. Round 3's ownership fix left this explicit-retirement sibling path behind, and the new test at tests/fm-procevent.test.sh:800 never executes the required retire/re-register sequence. Refuse retirement while a task-owned capture is unacknowledged, and only let re-arm acknowledge captures whose immutable owner matches the registering task.
  • 🚨 bin/fm-procevent.sh:731 - Repeat delivery breaks after the worker consumes the first inbox notification. fm_task_inbox_write_idempotent can return the matching record under inbox/handled/; line 740 then rings using that path, and fm_task_inbox_doorbell_line derives inbox/handled as the inbox and instructs the worker to move the record into nonexistent handled/handled/. If the worker moved the notification before crashing or re-arming, every reconcile repeats this malformed doorbell and no active inbox record restores the still-open round. When the matching record is already handled but the process result remains unacknowledged, create or reference a valid active inbox delivery rather than ringing the handled pathname.
  • ⚠️ bin/fm-procevent.sh:1814 - Terminal acknowledgement ignores failure to remove the source and still prints retired. If removal fails, the handled marker already suppresses the terminal result, while reconcile sees a task-owned source with no pending round and launches another poll, producing duplicate terminal captures. Check removal and roll back the newly created handled marker on failure so the source remains owned and round-open.
  • ⚠️ bin/fm-procevent.sh:1826 - The new task-terminal path retires the source when handled succeeds, but the public command help at line 85 still states that marking a result handled does not retire its registration or claim. Document the task-owned terminal exception so callers do not rely on a guarantee this change invalidates.
  • 🚨 bin/fm-procevent.sh:1832 - Terminal acknowledgement is not crash-recoverable. If the process dies after creating the handled marker here but before removing the source at line 1836, source_pending permanently hides that terminal result. A repeated handled call therefore does not set conclude, register-task's terminal check at lines 554-561 permits re-arm, and reconcile's pending guard at lines 1561-1565 permits another poll of the ended board. Round 5's r11 fix handles an ordinary removal error but left this crash sibling reachable. Detect and finish a handled terminal conclusion at the shared task-source boundaries before either re-arm or reconcile can launch it again.
  • 🚨 bin/fm-procevent.sh:589 - The selected r7 failed-rearm invariant remains unresolved. The replacement registration commits here and stale reply generations are deleted at lines 594-598 before the existing round is acknowledged at lines 601-608. If handled-marker creation fails, the command reports failure but leaves the replacement registration and reply installed rather than preserving the prior executable registration. Keep the prior registration generation until acknowledgement commits, and restore it plus its reply on acknowledgement failure.
  • 🚨 bin/fm-procevent.sh:554 - Task registration treats every unhandled result sharing the source ID as the registering worker's round, without checking its immutable owner sidecar. Concrete path: firstmate captures nonterminal feedback, explicitly retires that source before handling it, then a worker arms the same artifact. Lines 554-561 accept the legacy result and lines 601-608 silently mark it handled even though it was never routed to that worker. Filter both terminal validation and acknowledgement to captures whose .owner-task equals the registering task, and refuse unmatched pending captures rather than consuming them.
  • 🚨 bin/fm-procevent.sh:532 - register-task validates only the task-id syntax, not that it identifies a current task endpoint. A worker typo such as --for worker-10 is accepted, persisted as the capture owner at bin/fm-procevent-lib.sh:1062, and later causes publish_result to create an ownerless worker-10.inbox at bin/fm-procevent.sh:756 while suppressing the firstmate wake; lines 760-767 find no metadata and ring nobody, so captain feedback remains stranded indefinitely. Validate the task’s regular, identity-matching endpoint metadata before publishing a task-owned registration.
  • 🚨 bin/fm-procevent.sh:545 - Intent contradiction: “re-arm is an acknowledgement” requires an open captured round, but the same task may re-arm while no round is pending. Concrete sequence: worker-1 arms with reply A; while that listener still owns the claim, a repeated arm stages reply B and replaces the registration at bin/fm-procevent.sh:613; the acknowledgement loop at bin/fm-procevent.sh:621 is empty; after the old listener captures feedback, the proper next re-arm replaces the registration again and stale cleanup at bin/fm-procevent.sh:632 deletes reply B without ever posting it. Remove this extra acceptance path by refusing same-owner replacement unless an unacknowledged nonterminal round exists; initial arm remains the source-absent path.
  • 🚨 bin/fm-procevent.sh:1868 - The half-finished-conclude recovery path can retire a later board generation. Concrete sequence: acknowledge terminal sequence 1, arm a new Lavish session using the same artifact/source ID, then repeat the idempotent handled &lt;id&gt; 1 call. Because lines 1868-1883 inspect the old terminal result but never check whether it is already handled or belongs to the current registration, they delete the new registration before fm_procevent_mark_handled reports already-handled. The same unsupported fallback is asserted at tests/fm-procevent.test.sh:1050 and documented at docs/configuration.md:893. No authoritative intent requirement requires recovering the legacy marker-before-retirement state, and safely retaining that behavior would require new generation binding; remove this extra recovery path and only retire for a currently unhandled terminal round.
  • 🚨 bin/fm-procevent.sh:1877 - Terminal acknowledgement removes the board registration before proving the handled marker can be written. Concrete path: the source directory is writable but state/procevent-inbox cannot allocate a marker (for example, permissions or inode exhaustion); line 1877 successfully removes the source, line 1883 fails, and the command reports an error while leaving the terminal round open and its only ownership record gone. A subsequent ordinary arm at line 506 can then replace the still-unacknowledged worker board, while worker re-adoption remains blocked by the terminal check at line 569. Round 10's selected r24 fix correctly prevents a repeated acknowledgement from retiring a newer generation, but left this ordinary failure sibling behind. Preserve the current registration before removal and restore it if fm_procevent_mark_handled fails, while retaining the new open-round check and without adding generation-binding machinery.

🔧 Fix applied.
18 issues (14 errors, 4 warnings) still open:

  • ⚠️ bin/fm-procevent.sh:740 - The immediate inbox doorbell passes task ID worker-1 as the expected endpoint label, but task endpoints use fm-worker-1 (as derived by fm_backend_expected_label_of_selector and window_label). Identity-checking backends such as Zellij reject the mismatched label, so feedback is durably queued but the worker is not notified until the watcher's delayed re-ring. Derive and pass the canonical expected label here.
  • 🚨 bin/fm-procevent.sh:549 - A failed re-arm can corrupt the still-valid prior registration. For example, after an arm stages id.reply but before its runner starts, retrying with a nonexistent reply path deletes id.reply at line 549 and then fails validation at line 562; the unchanged source still references that deleted file, so every launch exits without polling and captain feedback is no longer collected. The same invariant is violated when line 570 replaces the prior reply before registration publication can fail at line 576. Stage the new reply under a generation-specific path and only clean the prior reply after the new source record commits, so every failed re-arm leaves the previous registration executable.
  • 🚨 bin/fm-procevent.sh:492 - Intent contradiction: the requirement says “Register refuses a second armer (naming the holder)” and firstmate must never arm a worker-hosted board, but ownership checks consult only the live .source. After a worker-owned terminal capture, retire_owned_terminal_source removes that record while the unhandled .owner-task evidence remains; a subsequent ordinary Lavish arm sees no source_kind, publishes a firstmate registration at line 501, and reconcile polls the ended worker board. The sibling task path also checks pending results only for terminality at lines 529-536: after explicit retirement of an open nonterminal round, another task can register and lines 581-588 acknowledge the original owner’s capture. Registration must honor immutable pending owner evidence even when the source record is absent.
  • 🚨 bin/fm-procevent.sh:711 - Terminal worker rounds have no completion path. The terminal message says only to stop, while re-arm is prohibited at lines 529-535 and re-arm is the only new path that writes handled markers at lines 581-588. Consequently session_ended, empty End, and missing captures remain pending forever and every reconcile republishes/rings them. The new test at tests/fm-procevent.test.sh:794-799 confirms only sequences 1 and 2 are handled and leaves terminal sequence 3 open. Instruct the worker to acknowledge the terminal sequence with the existing handled command after processing it, and verify that terminal pending state clears.
  • 🚨 bin/fm-procevent.sh:569 - The latest fix round left the second half of the failed-rearm corruption sequence intact. A prior registration can still reference $id.reply; re-arm overwrites that shared file at line 569 before publication at line 575, so a publication failure makes the prior registration send the new reply even though re-arm reported failure. If publication succeeds but handled-marker creation fails at line 584, the failed command likewise leaves the replacement registration installed. Keep the prior registration and reply generation intact until registration publication and acknowledgement commit, rolling back on either failure; use generation-specific reply paths rather than the shared destination.
  • 🚨 bin/fm-procevent.sh:1829 - Intent contradiction: the requirement says the owning source remains authoritative until acknowledgement, but explicit retire still removes a task-owned source with an open round. Concrete path: worker-1 captures nonterminal feedback, retire removes its source, then worker-2 registers at lines 533-551 and lines 585-592 mark worker-1's capture handled because only terminality—not captured owner—is checked. Ordinary registration can likewise replace the retired owner at lines 496-504. Round 3's ownership fix left this explicit-retirement sibling path behind, and the new test at tests/fm-procevent.test.sh:800 never executes the required retire/re-register sequence. Refuse retirement while a task-owned capture is unacknowledged, and only let re-arm acknowledge captures whose immutable owner matches the registering task.
  • 🚨 bin/fm-procevent.sh:731 - Repeat delivery breaks after the worker consumes the first inbox notification. fm_task_inbox_write_idempotent can return the matching record under inbox/handled/; line 740 then rings using that path, and fm_task_inbox_doorbell_line derives inbox/handled as the inbox and instructs the worker to move the record into nonexistent handled/handled/. If the worker moved the notification before crashing or re-arming, every reconcile repeats this malformed doorbell and no active inbox record restores the still-open round. When the matching record is already handled but the process result remains unacknowledged, create or reference a valid active inbox delivery rather than ringing the handled pathname.
  • ⚠️ bin/fm-procevent.sh:1814 - Terminal acknowledgement ignores failure to remove the source and still prints retired. If removal fails, the handled marker already suppresses the terminal result, while reconcile sees a task-owned source with no pending round and launches another poll, producing duplicate terminal captures. Check removal and roll back the newly created handled marker on failure so the source remains owned and round-open.
  • ⚠️ bin/fm-procevent.sh:1826 - The new task-terminal path retires the source when handled succeeds, but the public command help at line 85 still states that marking a result handled does not retire its registration or claim. Document the task-owned terminal exception so callers do not rely on a guarantee this change invalidates.
  • 🚨 bin/fm-procevent.sh:1832 - Terminal acknowledgement is not crash-recoverable. If the process dies after creating the handled marker here but before removing the source at line 1836, source_pending permanently hides that terminal result. A repeated handled call therefore does not set conclude, register-task's terminal check at lines 554-561 permits re-arm, and reconcile's pending guard at lines 1561-1565 permits another poll of the ended board. Round 5's r11 fix handles an ordinary removal error but left this crash sibling reachable. Detect and finish a handled terminal conclusion at the shared task-source boundaries before either re-arm or reconcile can launch it again.
  • 🚨 bin/fm-procevent.sh:589 - The selected r7 failed-rearm invariant remains unresolved. The replacement registration commits here and stale reply generations are deleted at lines 594-598 before the existing round is acknowledged at lines 601-608. If handled-marker creation fails, the command reports failure but leaves the replacement registration and reply installed rather than preserving the prior executable registration. Keep the prior registration generation until acknowledgement commits, and restore it plus its reply on acknowledgement failure.
  • 🚨 bin/fm-procevent.sh:554 - Task registration treats every unhandled result sharing the source ID as the registering worker's round, without checking its immutable owner sidecar. Concrete path: firstmate captures nonterminal feedback, explicitly retires that source before handling it, then a worker arms the same artifact. Lines 554-561 accept the legacy result and lines 601-608 silently mark it handled even though it was never routed to that worker. Filter both terminal validation and acknowledgement to captures whose .owner-task equals the registering task, and refuse unmatched pending captures rather than consuming them.
  • 🚨 bin/fm-procevent.sh:532 - register-task validates only the task-id syntax, not that it identifies a current task endpoint. A worker typo such as --for worker-10 is accepted, persisted as the capture owner at bin/fm-procevent-lib.sh:1062, and later causes publish_result to create an ownerless worker-10.inbox at bin/fm-procevent.sh:756 while suppressing the firstmate wake; lines 760-767 find no metadata and ring nobody, so captain feedback remains stranded indefinitely. Validate the task’s regular, identity-matching endpoint metadata before publishing a task-owned registration.
  • 🚨 bin/fm-procevent.sh:545 - Intent contradiction: “re-arm is an acknowledgement” requires an open captured round, but the same task may re-arm while no round is pending. Concrete sequence: worker-1 arms with reply A; while that listener still owns the claim, a repeated arm stages reply B and replaces the registration at bin/fm-procevent.sh:613; the acknowledgement loop at bin/fm-procevent.sh:621 is empty; after the old listener captures feedback, the proper next re-arm replaces the registration again and stale cleanup at bin/fm-procevent.sh:632 deletes reply B without ever posting it. Remove this extra acceptance path by refusing same-owner replacement unless an unacknowledged nonterminal round exists; initial arm remains the source-absent path.
  • 🚨 bin/fm-procevent.sh:1868 - The half-finished-conclude recovery path can retire a later board generation. Concrete sequence: acknowledge terminal sequence 1, arm a new Lavish session using the same artifact/source ID, then repeat the idempotent handled &lt;id&gt; 1 call. Because lines 1868-1883 inspect the old terminal result but never check whether it is already handled or belongs to the current registration, they delete the new registration before fm_procevent_mark_handled reports already-handled. The same unsupported fallback is asserted at tests/fm-procevent.test.sh:1050 and documented at docs/configuration.md:893. No authoritative intent requirement requires recovering the legacy marker-before-retirement state, and safely retaining that behavior would require new generation binding; remove this extra recovery path and only retire for a currently unhandled terminal round.
  • 🚨 bin/fm-procevent.sh:1877 - Terminal acknowledgement removes the board registration before proving the handled marker can be written. Concrete path: the source directory is writable but state/procevent-inbox cannot allocate a marker (for example, permissions or inode exhaustion); line 1877 successfully removes the source, line 1883 fails, and the command reports an error while leaving the terminal round open and its only ownership record gone. A subsequent ordinary arm at line 506 can then replace the still-unacknowledged worker board, while worker re-adoption remains blocked by the terminal check at line 569. Round 10's selected r24 fix correctly prevents a repeated acknowledgement from retiring a newer generation, but left this ordinary failure sibling behind. Preserve the current registration before removal and restore it if fm_procevent_mark_handled fails, while retaining the new open-round check and without adding generation-binding machinery.
  • 🚨 bin/fm-procevent.sh:1876 - Round 11's selected r15 crash-recovery fix remains unresolved. A crash after fm_procevent_mark_handled creates the marker but before line 1880 removes the task-owned registration leaves a terminal board registered with no pending round. Repeating handled cannot conclude it because line 1869 searches only unhandled results; start at line 951 and reconcile at line 1606 then see no pending result and poll the ended board again, violating the required never-auto-rearm terminal invariant. Persist enough conclusion state to finish this exact interrupted transition at the shared start/reconcile boundaries without allowing an old acknowledgement to retire a later registration generation.
  • ⚠️ .agents/skills/process-event-sources/SKILL.md:125 - The operational skill still universally says a terminal adapter result has already retired its source, contradicting the newly documented task-owned exception at line 39 where the source remains registered until handled. The same universal description remains in docs/configuration.md:928. Round 11's r13 documentation fix updated the command help but left these sibling instructions behind; qualify both generic statements so agents do not skip the terminal acknowledgement that actually retires a worker-owned board.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (4 of 6 scenarios were driven live against the product); untested: Interrupted or failed acknowledgement preserves ownership and the prior executable registration for recovery, Worker ownership requires a valid endpoint and an open inbox note is redelivered rather than silently consumed
  • Live validation: ⚠️ inconclusive - 4 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Captain submits Lavish feedback and it reaches the owning worker directly without waking firstmate ✅ pass live live-round1-routing.txt shows the real feedback in worker-live.inbox, the complete captured message, and an absent firstmate wake queue.
Worker acknowledges the open round by re-arming with a reply and receives the next round ✅ pass live live-board-round2.png visibly shows the captain message and worker reply; live-rearm-state.txt records round one handled while the source remains registered.
A second armer cannot take a worker-owned board and the refusal names its holder ✅ pass live live-second-armer-refusal.txt records nonzero status and names worker-live as the owner.
Send & End routes an explicit terminal stop to the worker, does not auto-rearm, and retires only after acknowledgement ✅ pass live live-terminal-open.txt, live-board-ended.png, and live-terminal-final-state.txt show the terminal instruction, zero starts while open, retirement on handled acknowledgement, and zero starts afte…
Interrupted or failed acknowledgement preserves ownership and the prior executable registration for recovery ⏸️ untested no The prior payload supplied only a regression-test transcript, not evidence from driving this scenario against the live product. Live validation must interrupt or fail acknowledgement in an isolated ru…
Worker ownership requires a valid endpoint and an open inbox note is redelivered rather than silently consumed ⏸️ untested no The prior payload supplied only a regression-test transcript, not evidence from driving this scenario against the live product. Live validation must exercise missing-endpoint refusal and open-inbox re…
  • tests/fm-procevent.test.sh
  • Provisioned and operated isolated Herdr session fm-lab-lavish-live-56223-23765 exclusively through bin/fm-herdr-lab.sh, then verified guarded teardown.
  • Armed the real Lavish board with FM_HOME=&lt;isolated-home&gt; bin/fm-procevent-lavish.sh arm &lt;board&gt; --for worker-live, launched it through bin/fm-procevent.sh reconcile, and submitted browser feedback using chrome-devtools-axi.
  • Re-armed the board with --agent-reply-file, verified round-one acknowledgement and the rendered agent reply, then submitted a real Send &amp; End terminal round.
  • Attempted a competing firstmate arm while the terminal round remained open, acknowledged the terminal result with bin/fm-procevent.sh handled &lt;source&gt; 2, and reconciled again to verify no restart.
  • Confirmed git status --short remained clean after testing.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid
kunchenguid merged commit bd65e4a into main Sep 21, 2026
36 of 37 checks passed
@kunchenguid
kunchenguid deleted the fm/fm-crew-hosted-lavish-shipB-r1 branch September 21, 2026 04:43
haris-siddiqui-1 pushed a commit to haris-siddiqui-1/firstmate that referenced this pull request Sep 21, 2026
)

* feat(procevent): route worker-owned Lavish rounds

* no-mistakes(review): drop duplicate artifact field from task-owned registration

* no-mistakes(review): post worker reply once, fix ring label, keep re-arm atomic

* no-mistakes(review): keep worker board owned until terminal round acknowledged

* no-mistakes(review): refuse every retirement of an open worker-owned round

* no-mistakes(review): use real lavish reply flag, isolate reply generations

* no-mistakes(review): drop .posted marker for best-effort reply posting

* no-mistakes(review): consume staged reply after listener setup, refuse orphaned captures

* no-mistakes(review): require a reachable owner, redeliver open rounds, roll back failed re-arms

* no-mistakes(review): re-arm only to acknowledge an open round

* no-mistakes(review): conclude only a still-open terminal round

* no-mistakes(review): record the acknowledgement before retiring the board

* no-mistakes(review): retain the registration across a conclude, qualify terminal docs

* no-mistakes(document): Document worker-owned Lavish round lifecycle
dscott98 pushed a commit to Simplifying-Cloud/firstmate that referenced this pull request Sep 21, 2026
)

* feat(procevent): route worker-owned Lavish rounds

* no-mistakes(review): drop duplicate artifact field from task-owned registration

* no-mistakes(review): post worker reply once, fix ring label, keep re-arm atomic

* no-mistakes(review): keep worker board owned until terminal round acknowledged

* no-mistakes(review): refuse every retirement of an open worker-owned round

* no-mistakes(review): use real lavish reply flag, isolate reply generations

* no-mistakes(review): drop .posted marker for best-effort reply posting

* no-mistakes(review): consume staged reply after listener setup, refuse orphaned captures

* no-mistakes(review): require a reachable owner, redeliver open rounds, roll back failed re-arms

* no-mistakes(review): re-arm only to acknowledge an open round

* no-mistakes(review): conclude only a still-open terminal round

* no-mistakes(review): record the acknowledgement before retiring the board

* no-mistakes(review): retain the registration across a conclude, qualify terminal docs

* no-mistakes(document): Document worker-owned Lavish round lifecycle
dscott98 added a commit to Simplifying-Cloud/firstmate that referenced this pull request Sep 21, 2026