fix(limrun): give one lease one owner for its instance and its teardown

Merged
TH
9h ago
+4190-447

Summary

Fix Limrun lease ownership and release races (SM-4). One owner is published before the first await and carries every resource. take() is the sole freeing route; uncertain pending creation schedules normal disposal after settlement, using idempotent deletion and memoized local cleanup.

A confirmed disposal can precede creation settlement safely: its only rented instance is already deleted, and observed local cleanup awaits the eventual session. A new runtime test proves one rent, one delete, and one late disconnect.

Capture write failures now retain a simultaneous close failure and preserve the original error as cause. The late-create/local-failure test also observes unhandled rejections.

Scope: 19 files; this round changes five (three production, two tests), with no resource-disposal behavior change.

Validation

Head acd4c1026c6a623afaef3f50fb90be618a48879b; this round's base 9043233d01a3b1bb28797124c615bb50ecc40176.

  • Double-failure regression failed before the fix; 22 focused tests pass after it.
  • pnpm check:affected --run --head HEAD: passed at head; receipt run-mRc75q, exactCommit=true, checkoutChanged=false; 312 related tests pass and 16,794 unit tests pass (one skipped).
  • Eager closure: 30 modules. Cold self-review completed.
  • Live release evidence remains at 9043233d: Settings, reverse cleanup, second-session isolation, HAR, disconnect, daemon stop; all 16 owned instances terminated, zero running. This diagnostics-only round requires no repeat live run.
  • All 100 inline threads replied to and resolved.

CI at new head is queued/running; hosted lanes remain authoritative. No merge or label changes.