Files
SubMiner/backlog/tasks/task-316 - Fix-macOS-launcher-playback-exit-with-background-stats-daemon.md
T
sudacode 6607b06437 Fix managed playback exit and tokenizer grammar splits
- Ignore background stats daemons during regular app startup
- Split standalone grammar endings before applying annotations
- Clear helper-span annotations for auxiliary-only tokens
2026-05-04 00:06:27 -07:00

3.9 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, priority
id title status assignee created_date updated_date labels dependencies priority
TASK-316 Fix macOS launcher playback exit with background stats daemon Done
@Codex
2026-05-03 00:32 2026-05-03 00:36
bug
macos
mpv
stats
runtime
high

Description

Launching a video on macOS when SubMiner is not already running should not leave the regular SubMiner app/tray alive after mpv closes. A separately running background stats daemon must remain non-blocking and must not be used as a foreground app dependency during playback startup/shutdown.

Acceptance Criteria

  • #1 Closing a launcher/plugin-managed mpv session exits the launcher-started regular SubMiner app/tray after mpv closes.
  • #2 Explicit background/no-argument app launches still remain alive as before.
  • #3 A live background stats daemon is ignored by normal in-app stats server routing during regular app startup/playback, so the regular app never depends on or connects to that background daemon.
  • #4 Regression coverage demonstrates the managed playback shutdown and stats-daemon isolation behavior.

Implementation Plan

  1. Add failing regressions first: stats routing should ignore a live foreign background daemon for normal app URL/server startup, and managed playback disconnect should request app quit directly without reconnecting or depending on overlay/youtube disconnect guards.
  2. Implement the narrow runtime changes in src/main/runtime/stats-server-routing.ts and, if needed, mpv disconnect plumbing in src/core/services/mpv.ts / event deps.
  3. Preserve explicit persistent background/no-arg behavior by keeping --managed-playback as the only playback-exit marker.
  4. Run focused tests (stats-server-routing, mpv client/protocol/event tests), then typecheck if focused checks pass.
  5. Update changelog and task acceptance/final notes.

Implementation Notes

Implemented regular app stats routing isolation from live background daemon state and explicit managed-playback quit-on-disconnect wiring in main mpv event deps. Existing MpvIpcClient socket-close managed playback quit path remains covered.

bun run test:fast was attempted after focused verification. It failed in the broad test:core:src lane with Bun/node:test nested-test runner errors across many unrelated files and one transient subsync renderer API failure; rerunning the concrete subsync failure alone passed. Focused runtime tests, typecheck, and changelog lint remain green.

Final Summary

Summary:

  • Regular app stats server routing no longer returns or depends on a live background daemon URL; it validates/cleans state, then uses the local app stats server path.
  • Managed playback is now explicitly treated as a quit-on-disconnect launch mode in main mpv event deps, in addition to the existing mpv socket-close quit request.
  • Added regressions for background daemon isolation and managed playback quit-on-disconnect classification.
  • Added changelog fragment changes/316-macos-playback-stats-daemon.md.

Verification:

  • bun test src/main/runtime/stats-server-routing.test.ts src/core/services/mpv.test.ts src/core/services/mpv-protocol.test.ts src/main/runtime/mpv-client-event-bindings.test.ts src/main/runtime/mpv-main-event-bindings.test.ts src/main/runtime/mpv-main-event-main-deps.test.ts
  • bun run typecheck
  • bun run changelog:lint
  • bun test src/core/services/subsync.test.ts --test-name-pattern "deterministic _retimed"

Blocked broader gate:

  • bun run test:fast failed in test:core:src with Bun/node:test nested-test runner errors across unrelated files; the concrete subsync failure from that run passed when isolated.