Skip to content

Simplify cross-launch media process recovery #68

Description

@thsnkhn

Objective

Simplify media process recovery by supervising yt-dlp during the current Harbor session only.

Complete #65 before this work.

Current problem

MediaDownloadService persists PID, process-group, executable, command, start-signature, and recovery-directory ownership. Startup scans the process table, validates exact identities, terminates verified orphan groups, preserves unverifiable markers, and recovers child completion receipts.

This protects rare app-crash windows but adds a large cross-launch process-management subsystem.

Proposed design

  • Keep ManagedChildProcess supervision while Harbor is running.
  • Terminate active media processes during normal pause, cancel, removal, and shutdown.
  • Keep a simple per-attempt media recovery manifest and output receipt.
  • On startup, recover completed output when evidence is valid.
  • Treat old active attempt directories as interrupted.
  • Use best-effort cleanup instead of inspecting or killing processes from an earlier Harbor process.

Remove:

  • cross-launch PID and PGID ownership manifests
  • process-table enumeration
  • executable and start-signature validation
  • orphan process-group termination
  • marker quarantine and stale-owner barriers
  • child monitor machinery used only for cross-launch ownership guarantees

Accepted edge cases

  • After Harbor crashes, yt-dlp or a converter can continue until it exits.
  • A relaunch does not kill a process started by the previous Harbor instance.
  • A retry can require manual cleanup if the old process still owns the output.
  • Multiple Harbor instances are not supported.

Safeguards to retain

  • Supervision and cancellation during a normal Harbor session.
  • Attempt identifiers for stale events.
  • Destination containment and regular-file validation.
  • Media partial-file resume when the recovery directory is usable.
  • Normal shutdown cleanup.

Acceptance criteria

  • Normal media start, progress, pause, resume, cancel, completion, and shutdown work.
  • Valid completed output can still be recovered after relaunch.
  • Harbor never kills an unverified external process.
  • Cross-launch process ownership code is removed.
  • Production code decreases by approximately 400 to 700 lines.
  • Focused media runtime and recovery tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions