Skip to content

fix(live-suite): stop Firefox leaks, harden prune precondition, fix daemon-parity flake - #186

Merged
ractive merged 1 commit into
mainfrom
iter-146/live-suite-reliability
Aug 12, 2026
Merged

fix(live-suite): stop Firefox leaks, harden prune precondition, fix daemon-parity flake#186
ractive merged 1 commit into
mainfrom
iter-146/live-suite-reliability

Conversation

@ractive

@ractive ractive commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Theme A (leak): live_96_profile_cleanup.rs's launch_headless() launched Firefox via a bare Command with no RAII guard, relying entirely on daemon stop succeeding to reap the process. Switched to LiveFirefox so its Drop is a reliable belt-and-suspenders fallback on any failure or panic between launch and stop — this was the root cause of the 4 orphaned Firefox instances found after a full sequential live sweep.
  • Theme B (order-dependence): live_profiles_prune_removes_all_when_no_firefox_running's precondition only checked daemon status, which stays blind to a directly-launched (non-daemon) Firefox — exactly the gap Theme A's leak exercised. Replaced with live_owned_profile_dirs(), an explicit scan of ff-rdp-profile-* owner-PID markers that names offending (dir, pid) pairs on violation instead of an opaque left: 1 / right: 0.
  • Theme C (daemon-parity flake): root-caused live — not a daemon restart (uptime_seconds stayed continuous across a failing session). Two real bugs in daemon/server.rs combined to strand target_count/live_target_count at 0 or 1 forever: (1) establish_watcher's synchronous watchTargets handshake had no RdpTransport event sink installed, so a target-available-form catch-up event racing ahead of its RPC reply was silently dropped — fixed with an early mpsc sink installed before both the startup and background-retry handshakes, replayed into the real event channel in wire order; (2) a freshly-launched profile's placeholder about:blank target gets torn down microseconds after being subscribed to, orphaning the watcher for the rest of the session — fixed with a one-time WATCHER_SETTLE_DELAY (350ms) before the first subscribe attempt.
  • New live_146_suite_reliability.rs pins all three fixes: zero-orphan-after-sequential-launches, teardown-survives-a-panic, and 5-consecutive-stable-daemon-parity-runs.

Test plan

  • cargo fmt / cargo clippy --workspace --all-targets -- -D warnings / cargo test --workspace -q all green

  • cargo run -p xtask -- check-iteration-ready --plan kb/iterations/iteration-146-live-suite-reliability.md --base origin/main — 11/11 PASS

  • Live suite: FF_RDP_LIVE_TESTS=1 cargo test -p ff-rdp-cli -- --include-ignored --test-threads=1 — verify zero firefox.*ff-rdp-profile processes and zero pinned ff-rdp-profile-* dirs remain after the run (dogfood_path in the iteration plan; requires a local Firefox binary, not run in this environment)## Claims vs code
    <generated 2026-08-12T11:29:57Z by ralph-loop>

  • WATCHER_SETTLE_DELAY → ✅ matched in diff## Claims vs code
    <generated 2026-08-12T11:37:47Z by ralph-loop>

  • WATCHER_SETTLE_DELAY → ✅ matched in diff

…aemon-parity flake

iter-146: three independent live-suite reliability defects found in a
post-batch sweep after iter-142/iter-145 merged.

- Theme A: live_96_profile_cleanup.rs's launch_headless() launched Firefox
  with a bare Command and no RAII guard, relying solely on `daemon stop`
  to reap it. Switched to LiveFirefox so its Drop is a reliable fallback
  on any failure or panic between launch and stop.
- Theme B: live_profiles_prune_removes_all_when_no_firefox_running's
  precondition only checked `daemon status`, which stays blind to a
  directly-launched (non-daemon) Firefox. Replaced with an explicit scan
  of ff-rdp-profile-* owner-PID markers that names offending (dir, pid)
  pairs on violation.
- Theme C: root-caused the iter-137 daemon-parity flake live — not a
  daemon restart. Two bugs in daemon/server.rs combined to strand
  target_count at 0/1 forever: a dropped catch-up event when no
  RdpTransport event sink was installed during the watchTargets
  handshake, and a placeholder about:blank target that gets destroyed
  microseconds after being subscribed to. Fixed with an early event sink
  (buffered + replayed in wire order) and a one-time WATCHER_SETTLE_DELAY
  before the first subscribe attempt.

New live_146_suite_reliability.rs pins all three fixes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ractive
ractive merged commit 4e5dfcc into main Aug 12, 2026
10 checks passed
@ractive
ractive deleted the iter-146/live-suite-reliability branch August 12, 2026 11:43
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