Repository navigation
fix: derive Lavish polling route from board session - #5334
Merged
Merged
Conversation
RajeshRajendiran
added a commit
to RajeshRajendiran/firstmate
that referenced
this pull request
Sep 23, 2026
…store entry Found the actual root cause behind "Behavior portable serial 5" repeatedly failing on tests/fm-bearings-board-render.test.sh with "source ... is not listening after reconcile (observed owner: none)". The prior round's fix (widening await_source_owner's poll budget from 5s to 10s) treated this as generic scheduler flakiness, but the poll budget was never the bottleneck. The upstream-synced commit that reworked fm-procevent-lavish.sh's host resolution (kunchenguid#5334) made cmd_poll resolve its server address from Lavish's own session store (LAVISH_AXI_STATE_DIR/state.json) before it can do anything else. This render test's fake lavish-axi never wrote that store, so every armed listener now dies instantly instead of reaching the stub's blocking `poll` case - collapsing what used to be a long, stable "live" claim into a race decided by whether await_source_owner's poll happened to land inside a millisecond-scale window. Under CI's scheduler this essentially never won; locally it was fast enough to usually win, which is why it never reproduced there. Fixed by having the fake lavish-axi write a matching session-store entry when it "opens" a board, the same way tests/fm-bearings-board.test.sh already does for the same reason. The listener now reaches its intended blocking poll and stays live, so reverted the unrelated poll-budget widening back to its original 50 iterations.
BohnBawerick
added a commit
to BohnBawerick/firstmate
that referenced
this pull request
Sep 23, 2026
Intent
A worker-hosted Lavish board showed Working while the worker was not working, and the agent reply did not appear until a manual refresh. Fix that durably. The live board is http://127.0.0.1:4387/session/63f385f41cd6a0bf. Do not answer it, do not send marks, and do not end that session.
After eight review fix rounds each adding guards around a stored-and-guarded session URL, the choice was B: stop and step back. Have the worker look for a simpler design, for example have the poll always derive the server from the board's own session instead of storing and guarding an address. Then revalidate from scratch.
What Changed
Risk Assessment
✅ Low: The change is well-bounded, derives each poll endpoint from validated board-session state, preserves staged replies on routing failure, and adds behavior-level regression coverage for direct, retried, and recovered polling paths.
Testing
Targeted process-event and Bearings tests passed; real Lavish/Chrome validation showed a worker reply immediately on the saved board session despite conflicting ambient and configured endpoints, returned browser feedback to the worker inbox, and failed safely when session evidence was missing. The first live Bearings run exposed a teardown race, which was fixed and passed on rerun. The protected user session at port 4387 was not touched.
recovered-worker-routing-transcript.txt: saved endpoint was 127.0.0.1:14387 while arm, start, and config named three different endpoints.recovered-worker-session-routing.pngvisibly shows the reply in Conversation with no Working status.recovered-worker-routing-transcript.txtrecords feedback status, message, andworker_inbox=delivered.missing-session-refusal.txtrecords exit 1 and the unchanged staged reply.bearings-live-transcript.txtshows the captain-ended session detection and successful real-session reopen on lavish-axi 0.1.77.Evidence: Worker routing and round-trip transcript
Source: Worker routing and round-trip transcript
Evidence: Missing-session fail-closed transcript
Source: Missing-session fail-closed transcript
Evidence: Real Lavish Bearings lifecycle transcript
Source: Real Lavish Bearings lifecycle transcript
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.
recovered-worker-routing-transcript.txt: saved endpoint was 127.0.0.1:14387 while arm, start, and config named three different endpoints.recovered-worker-session-routing.pngvisibly shows the reply in Conversation with no Working status.recovered-worker-routing-transcript.txtrecords feedback status, message, andworker_inbox=delivered.missing-session-refusal.txtrecords exit 1 and the unchanged staged reply.bearings-live-transcript.txtshows the captain-ended session detection and successful real-session reopen on lavish-axi 0.1.77.bin/fm-test-run.sh tests/fm-procevent.test.shbin/fm-test-run.sh tests/fm-bearings-board.test.shHOME="$PWD/.test-live-home" FM_BEARINGS_LAVISH_LIVE=1 bin/fm-test-run.sh tests/fm-bearings-board-lavish-live-e2e.test.shOpened an isolated real Lavish 0.1.77 board on port 14387, armed a worker-owned source under conflicting configuration, started it underrecovery.invalid:34387, and drove feedback through ChromeRanbin/fm-procevent-lavish.sh pollwith a missing isolated session store and confirmed it refused before consuming the staged replyEnded both isolated Lavish sessions, swept the worker source, stopped the isolated server/browser, and removed transient worktree data✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.