fix(daemon): retain cleanup locks and preserve healed snapshots

TH
26m ago
+374-90

Summary

  • Retain session/device execution locks through binding and claim cleanup on every outcome (ADR 0019).
  • Preserve authored snapshots and repair-time --record snapshots in healed scripts; exclude foreground composite captures (ADR 0012). Explicit recording uses existing action flags; only authored provenance needs separate storage.
  • Both fixes close implementation gaps found in the same ADR-conformance audit (#3744): cleanup must stay serialized, and publication must preserve authored intent.
  • Eleven files; scope expands to foreground composition only. No ADR edits. Binding disposal remains unbounded by the daemon; existing disposers acquire no execution locks.

Validation

  • Tested SHA: eb304913e7daf7e4d5280a8783828b09d131689b.
  • pnpm format; five focused suites: 104 passed. Parser accepts snapshot --record but discards the flag; publication round-trips the retained snapshot without it.
  • Affected gate receipt: pnpm check:affected --run --head HEAD passed (run-XYy1Xj, exactCommit=true, checkoutChanged=false): seven checks, 2,302 tests; seven parked/GitHub-owned skips.
  • Same router test command (pnpm exec vitest run --project unit-core packages/daemon/src/core/__tests__/request-runtime-binding-router.test.ts --maxWorkers=1): merge-base 4c1c786968 6 failed/2 passed, head 8 passed. Only the test was copied; base execution scope stayed unchanged. Queue insertion replaces the timing tick. Disposable checkout removed.
  • Original iOS failure: screenshot shows unanswered launch confirmation; runner reports APP_NOT_RUNNING / wait_capture_stalled. Independent failure has identical symptoms and merge-base execution-scope code. The single original-job rerun was cancelled while queued after the follow-up push; new-head CI is pending.
  • Self-reviewed. New-head integration, coverage and device CI remain required; no local device run.