Skip to content

fix: prevent watcher outages from hiding worker outcomes - #6

Open
akrcdev wants to merge 6 commits into
mainfrom
fm/firstmate-missed-blocker-notification-own-project
Open

akrcdev wants to merge 6 commits into
mainfrom
fm/firstmate-missed-blocker-notification-own-project

Conversation

@akrcdev

@akrcdev akrcdev commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Intent

Investigate and explain why I was not notified when the Reviva shipping-confirmation check could not access the authenticated Shopify browser, and how to make sure that does not happen again. The authorized deliverable was initially an investigation of the monitoring fault and a plan to test that a worker's blocker reliably reaches me.

again the workers finished but you srent doig anything -leade fix theres something wrong

no im not comitting to kun chen repo wtf hes a proper software engineer ex l8 at meta im just some random doing digital marketing. my own project please

Approval of cancelling only the old review attempt, preserving all work, and restarting the fix's review against the own project:
yes

ok now stow once youre done with that as i am going to sleep

What Changed

  • Defer contended process-event source locks during reconciliation so worker blocker and completion notifications can proceed while captured results remain available for retry.
  • Add idle Pi watcher health checks that request a drain on monitoring failure and subsequent worker status changes; verify existing watcher health on explicit arm calls.
  • Surface unread completions and failures even when the wake queue is empty, with regression coverage and documented Pi SDK notification verification.

Risk Assessment

✅ Low: The changes are bounded, preserve source-lock ownership and durable results, and add notification recovery without introducing a substantiated material defect.

Testing

Baseline reproduced the lost outcome; focused shell tests and five real-SDK scenarios passed after test-fixture fixes and retries. Captured transcripts and persisted sessions demonstrate delivery and acknowledgement. No screenshot was captured because verification used the SDK interface, not a rendered TUI; deterministic provider behavior does not establish live-model judgment or actual Shopify access.

Evidence: Notification transcripts: completion, blocker, contention, stalled watcher, startup failure
Real Pi 0.84.1 SDK notification transcripts after fixing acknowledgement test
Local deterministic provider; real extension, drain, acknowledgement and persisted SDK session.
Delivery and record-consumption proof; no live-model judgment or physical TUI rendering.

=== done ===
+0ms producer: done
+2050ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: watcher: FAILED - cycle health unconfirmed (beacon 2s); a slow cycle may still recover
Inspect current open decisions and unread status even if the queue is empty; notify the user of finished work and blockers. Do not infer recovery from arm-child occupancy.

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+2087ms assistant: 
+3132ms toolResult: 1791124175	2	signal	fixture.status	signal: /home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-done/home/state/fixture.status
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 1827918.1791124175.If4yOE
wake annotation: latest wake-EVENT observed at drain, not current state: fixture.status: done: SYNTHETIC_DONE check complete
UNREAD STATUS (new since last drain, not re-printed after this presentation):
fixture done: SYNTHETIC_DONE check complete
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

+3135ms assistant: 
+3326ms toolResult: (no output)
+3328ms assistant: Synthetic check completed; the result is ready for review.
+3328ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: signal: /home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-done/home/state/fixture.status

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+3330ms assistant: 
+4184ms toolResult: (no output)
+4186ms assistant: Monitoring unavailable; current worker records checked.
Queue empty after handling; no tool errors.

=== blocked ===
+0ms producer: blocked
+2142ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: watcher: FAILED - cycle health unconfirmed (beacon 2s); a slow cycle may still recover
Inspect current open decisions and unread status even if the queue is empty; notify the user of finished work and blockers. Do not infer recovery from arm-child occupancy.

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+2178ms assistant: 
+3215ms toolResult: 1791124181	2	signal	fixture.status	signal: /home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-blocked/home/state/fixture.status
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 1834044.1791124181.Rt9pfC
wake annotation: latest wake-EVENT observed at drain, not current state: fixture.status: blocked: [key=access] SYNTHETIC_ACCESS authenticated browser unavailable
OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
fixture [key=access] blocked: SYNTHETIC_ACCESS authenticated browser unavailable
OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

+3218ms assistant: 
+3414ms toolResult: (no output)
+3416ms assistant: Synthetic check blocked: authenticated browser unavailable; live settings remain unverified. Reconnect the authenticated browser.
+3416ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: signal: /home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-blocked/home/state/fixture.status

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+3418ms assistant: 
+4278ms toolResult: OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
fixture [key=access] blocked: SYNTHETIC_ACCESS authenticated browser unavailable
OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'

+4280ms assistant: Synthetic check blocked: authenticated browser unavailable; live settings remain unverified. Reconnect the authenticated browser.
Queue empty after handling; no tool errors.

=== contended ===
+0ms producer: blocked
+2150ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: watcher: FAILED - cycle health unconfirmed (beacon 2s); a slow cycle may still recover
Inspect current open decisions and unread status even if the queue is empty; notify the user of finished work and blockers. Do not infer recovery from arm-child occupancy.

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+2185ms assistant: 
+3234ms toolResult: 1791124187	2	signal	fixture.status	signal: /home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-contended/home/state/fixture.status
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 1839565.1791124186.882Wxl
wake annotation: latest wake-EVENT observed at drain, not current state: fixture.status: blocked: [key=access] SYNTHETIC_ACCESS authenticated browser unavailable
OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
fixture [key=access] blocked: SYNTHETIC_ACCESS authenticated browser unavailable
OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

+3237ms assistant: 
+3439ms toolResult: (no output)
+3441ms assistant: Synthetic check blocked: authenticated browser unavailable; live settings remain unverified. Reconnect the authenticated browser.
+3441ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: signal: /home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-contended/home/state/fixture.status

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+3442ms assistant: 
+4305ms toolResult: OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
fixture [key=access] blocked: SYNTHETIC_ACCESS authenticated browser unavailable
OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'

+4306ms assistant: Synthetic check blocked: authenticated browser unavailable; live settings remain unverified. Reconnect the authenticated browser.
Queue empty after handling; no tool errors.

=== hang ===
+0ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: watcher: FAILED - cycle health unconfirmed (beacon 6s); a slow cycle may still recover
Inspect current open decisions and unread status even if the queue is empty; notify the user of finished work and blockers. Do not infer recovery from arm-child occupancy.

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+37ms assistant: 
+1165ms toolResult: ●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: 6s ago, grace 6s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  repair missing watcher supervision according to the session-start block for this harness; do not use shell &.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

+1168ms assistant: Monitoring unavailable; current worker records checked.
+1182ms producer: blocked
+1265ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: watcher: FAILED - cycle health unconfirmed (beacon 7s); a slow cycle may still recover
Worker status changed during the monitoring outage.
Inspect current open decisions and unread status even if the queue is empty; notify the user of finished work and blockers. Do not infer recovery from arm-child occupancy.

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+1267ms assistant: 
+2187ms toolResult: OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
fixture [key=access] blocked: SYNTHETIC_ACCESS authenticated browser unavailable
OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'
WARNING: watcher still down (same stale episode; last beat: 7s ago, grace 6s) - full banner already printed this episode.

+2189ms assistant: Synthetic check blocked: authenticated browser unavailable; live settings remain unverified. Reconnect the authenticated browser.
Queue empty after handling; no tool errors.

=== cannot-start ===
+0ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: watcher: FAILED - Pi extension could not restore watcher continuity after 1 retries
watcher: FAILED - synthetic cannot-start

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+34ms assistant: 
+1381ms toolResult: UNREAD STATUS (new since last drain, not re-printed after this presentation):
early done: SYNTHETIC_DONE finished before monitoring started
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 6s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  repair missing watcher supervision according to the session-start block for this harness; do not use shell &.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

+1383ms assistant: Synthetic check completed; the result is ready for review.
+1438ms producer: blocked
+1519ms user: ⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: watcher: FAILED - Pi extension has no confirmed ready watcher cycle
Worker status changed during the monitoring outage.
Inspect current open decisions and unread status even if the queue is empty; notify the user of finished work and blockers. Do not infer recovery from arm-child occupancy.

Run bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned.
+1520ms assistant: 
+2434ms toolResult: OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
fixture [key=access] blocked: SYNTHETIC_ACCESS authenticated browser unavailable
OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'
WARNING: watcher still down (same stale episode; last beat: never, grace 6s) - full banner already printed this episode.

+2436ms assistant: Synthetic check blocked: authenticated browser unavailable; live settings remain unverified. Reconnect the authenticated browser.
Queue empty after handling; no tool errors.
Evidence: Persisted Pi browser-access blocker session
{"type":"session","version":3,"id":"01a10752-074f-77ad-991d-eca6e69d4405","timestamp":"2026-10-04T14:29:38.767Z","cwd":"/home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-blocked/code"}
{"type":"model_change","id":"0ff8b80b","parentId":null,"timestamp":"2026-10-04T14:29:38.768Z","provider":"fm-health","modelId":"synthetic"}
{"type":"thinking_level_change","id":"9739667a","parentId":"0ff8b80b","timestamp":"2026-10-04T14:29:38.768Z","thinkingLevel":"off"}
{"type":"message","id":"157f2345","parentId":"9739667a","timestamp":"2026-10-04T14:29:41.519Z","message":{"role":"user","content":[{"type":"text","text":"⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: watcher: FAILED - cycle health unconfirmed (beacon 2s); a slow cycle may still recover\nInspect current open decisions and unread status even if the queue is empty; notify the user of finished work and blockers. Do not infer recovery from arm-child occupancy.\n\nRun bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned."}],"timestamp":1791124181518}}
{"type":"message","id":"517c816d","parentId":"157f2345","timestamp":"2026-10-04T14:29:41.555Z","message":{"role":"assistant","content":[{"type":"toolCall","id":"drain-1","name":"bash","arguments":{"command":"bash '/home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-blocked/code/bin/fm-wake-drain.sh'"}}],"api":"openai-completions","provider":"fm-health","model":"synthetic","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"toolUse","timestamp":1791124181547,"responseId":"health-fixture","rawStopReason":"tool_calls"}}
{"type":"message","id":"8dd440cb","parentId":"517c816d","timestamp":"2026-10-04T14:29:42.592Z","message":{"role":"toolResult","toolCallId":"drain-1","toolName":"bash","content":[{"type":"text","text":"1791124181\t2\tsignal\tfixture.status\tsignal: /home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-blocked/home/state/fixture.status\nWAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 1834044.1791124181.Rt9pfC\nwake annotation: latest wake-EVENT observed at drain, not current state: fixture.status: blocked: [key=access] SYNTHETIC_ACCESS authenticated browser unavailable\nOPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):\nfixture [key=access] blocked: SYNTHETIC_ACCESS authenticated browser unavailable\nOPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'\nWARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.\n"}],"isError":false,"timestamp":1791124182592}}
{"type":"message","id":"838443ab","parentId":"8dd440cb","timestamp":"2026-10-04T14:29:42.595Z","message":{"role":"assistant","content":[{"type":"toolCall","id":"ack-2","name":"bash","arguments":{"command":"bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 1834044.1791124181.Rt9pfC"}}],"api":"openai-completions","provider":"fm-health","model":"synthetic","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"toolUse","timestamp":1791124182593,"responseId":"health-fixture","rawStopReason":"tool_calls"}}
{"type":"message","id":"135891ee","parentId":"838443ab","timestamp":"2026-10-04T14:29:42.791Z","message":{"role":"toolResult","toolCallId":"ack-2","toolName":"bash","content":[{"type":"text","text":"(no output)"}],"isError":false,"timestamp":1791124182791}}
{"type":"message","id":"e0198c2a","parentId":"135891ee","timestamp":"2026-10-04T14:29:42.793Z","message":{"role":"assistant","content":[{"type":"text","text":"Synthetic check blocked: authenticated browser unavailable; live settings remain unverified. Reconnect the authenticated browser."}],"api":"openai-completions","provider":"fm-health","model":"synthetic","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"stop","timestamp":1791124182792,"responseId":"health-fixture","rawStopReason":"stop"}}
{"type":"message","id":"33b7f426","parentId":"e0198c2a","timestamp":"2026-10-04T14:29:42.793Z","message":{"role":"user","content":[{"type":"text","text":"⁣FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: signal: /home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-blocked/home/state/fixture.status\n\nRun bin/fm-wake-drain.sh first and handle the queued wake. Watcher continuity is extension-owned."}],"timestamp":1791124182381}}
{"type":"message","id":"1cd6e5dc","parentId":"33b7f426","timestamp":"2026-10-04T14:29:42.795Z","message":{"role":"assistant","content":[{"type":"toolCall","id":"drain-3","name":"bash","arguments":{"command":"bash '/home/adam/.no-mistakes/worktrees/16e474e97918/01M43MXTRS1PEEN3J72VEDXM68/.test-notification-evidence/fixed-blocked/code/bin/fm-wake-drain.sh'"}}],"api":"openai-completions","provider":"fm-health","model":"synthetic","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"toolUse","timestamp":1791124182794,"responseId":"health-fixture","rawStopReason":"tool_calls"}}
{"type":"message","id":"7b792a85","parentId":"1cd6e5dc","timestamp":"2026-10-04T14:29:43.655Z","message":{"role":"toolResult","toolCallId":"drain-3","toolName":"bash","content":[{"type":"text","text":"OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):\nfixture [key=access] blocked: SYNTHETIC_ACCESS authenticated browser unavailable\nOPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'\n"}],"isError":false,"timestamp":1791124183655}}
{"type":"message","id":"f46d523f","parentId":"7b792a85","timestamp":"2026-10-04T14:29:43.657Z","message":{"role":"assistant","content":[{"type":"text","text":"Synthetic check blocked: authenticated browser unavailable; live settings remain unverified. Reconnect the authenticated browser."}],"api":"openai-completions","provider":"fm-health","model":"synthetic","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"stop","timestamp":1791124183656,"responseId":"health-fixture","rawStopReason":"stop"}}

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 bin/fm-test-run.sh tests/fm-procevent.test.sh tests/fm-wake-drain-unread-status.test.sh tests/fm-watch-triage.test.sh tests/fm-pi-watch-extension.test.sh
  • Ran the current unread-status regression against isolated base-commit scripts: reproduced failure, buried done outcome was lost without a queued signal.
  • Ran tests/fixtures/pi-watch-health-live.mjs against installed Pi SDK 0.84.1 for done, blocked, contended, hang, and cannot-start, before and after fixing acknowledgement verification.
  • Re-executed test_pi_idle_health stalled and test_pi_idle_health cannot-start after fixing fixture setup.
  • bash bin/fm-test-run.sh tests/fm-pi-watch-extension.test.sh passed on a clean retry; editing the executing script had disrupted the initial invocation.
  • Inspected generated transcripts and persisted SDK sessions; verified successful tool execution, substantive notifications without user queries, and empty wake queues after handling.
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)

🔧 Fix: Executor lint rerun requires task-scoped PATH configuration
1 warning still open:

  • ⚠️ linter found issues (exit code 1)

🔧 Fix: Verify full lint passes with command-scoped PATH
1 warning still open:

  • ⚠️ linter found issues (exit code 1)

🔧 Fix: Record exact-head lint success with command-scoped PATH
1 warning still open:

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

✅ No issues found.

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