Skip to content

fix(bin): clear supervisor paths from worker launches - #75

Merged
peterOC26 merged 7 commits into
mainfrom
fm/fm-worker-env-wake-queue-leak-l1-v2
Nov 19, 2026
Merged

peterOC26 merged 7 commits into
mainfrom
fm/fm-worker-env-wake-queue-leak-l1-v2

Conversation

@peterOC26

@peterOC26 peterOC26 commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Replaces #74

Intent

Q2249 B (2026-11-18, Jobs page): "Q2249 b" - use the leftover Claude allowance on, among other things, the small fix that stops worker test runs leaking fake notifications into this home's real wake queue.
Seen twice on 2026-11-18: a worker's test drain read /root/firstmate/state/.wake-queue because the worker shell inherited FM_WAKE_QUEUE; later four fake procevent wakes (example-file, flow-source, order-source, remote-source) landed in the real queue.

What Changed

  • Clear inherited FM_WAKE_QUEUE, FM_WAKE_QUEUE_LOCK, FM_ROOT_OVERRIDE, and FM_STATE_OVERRIDE from pane-backed worker launches so workers do not use the supervising home’s queue or state paths.
  • Document the launch behavior and add regression coverage for ship and secondmate launches under a synthetic supervisor environment.

Risk Assessment

✅ Low: This is a small, bounded change: one export at the start of every pane-backed launch, using empty values that every consumer's :- default treats as unset, plus a test that runs the emitted launch under a supervisor-like pane environment (sh, and fish when installed). The only gap is that the T3 Code worker path and the test-runner unset lists don't apply the same scrub.

Testing

  • ⏭️ Test - skipped

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 warning
  • ⚠️ bin/fm-spawn.sh:7806 - The scrub is only added to the pane-backed LAUNCH text, so the same leak can still happen through other paths. fm-wake-lib.sh:10 resolves FM_WAKE_QUEUE=${FM_WAKE_QUEUE:-$STATE/.wake-queue}, so any inherited non-empty FM_WAKE_QUEUE beats a test's own FM_HOME/STATE. That is exactly the reported sequence: tests/fm-extension-binding.test.sh:2604 runs FM_HOME=$H_EXAMPLE fm-procevent start example-file, and the wake is appended to the supervisor's queue. Paths still exposed:
    (1) T3 Code ship/scout workers. The backend=t3code branch builds T3CODE_ENV (bin/fm-spawn.sh:7866-7868). It clears FM_ROOT_OVERRIDE/FM_STATE_OVERRIDE only for secondmates (7873-7877) and never clears FM_WAKE_QUEUE/FM_WAKE_QUEUE_LOCK. A T3 provider starts from the server's environment, so a T3 server that inherited the supervisor's FM_WAKE_QUEUE passes it to the worker, and that worker's test drain hits the live queue. This is the same 'backend server inherited it' premise the pane fix relies on.
    (2) The test-run boundary. tests/lib.sh:79-81 and bin/fm-test-run.sh:2852 already unset FM_HOME, FM_ROOT_OVERRIDE and FM_STATE_OVERRIDE so suites start from the environment CI gives them. They leave FM_WAKE_QUEUE and FM_WAKE_QUEUE_LOCK set, so any shell carrying them still leaks: a T3 worker, a worker pane spawned before this fix and not yet relaunched, or the supervisor running a suite directly.
    Remedy: add FM_WAKE_QUEUE= FM_WAKE_QUEUE_LOCK= FM_ROOT_OVERRIDE= FM_STATE_OVERRIDE= to T3CODE_ENV for ship/scout, and add FM_WAKE_QUEUE and FM_WAKE_QUEUE_LOCK to the unset lists in tests/lib.sh:79-81 and bin/fm-test-run.sh:2852. The test-side unset is the earliest shared boundary that protects every test run, however the variable arrived.
⏭️ **Test** - skipped

Step was skipped.

✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@peterOC26
peterOC26 merged commit c549eb7 into main Nov 19, 2026
29 of 31 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