Skip to content

Edit-job lifecycle: inconsistent timeouts, no cancellation for analysis passes, and shutdown leaves .partial files #237

Closed

Description

@TMHSDigital

Why it matters

Long recordings are where agents use these tools most. Today some passes time out on legitimate inputs, a cancelled request can leave ffmpeg decoding for minutes to hours, and a server shutdown mid-edit leaves invalid .partial files behind. This is a follow-up to #81 (closed), which fixed the main runEditJob path only.

Evidence

  • src/tools/sampleFrames.ts:172: fps mode uses a fixed 5-minute timeout while decoding the whole input.
  • src/tools/speed.ts:39, src/tools/cutIdle.ts:83 and the pipeline size timeouts from the output duration, not the input that must be decoded (e.g. speed ×20 on a 2 h video).
  • No signal is passed for the transcribe whisper pass, the normalize measure passes, the denoise and cut_idle scans, the zoom analysis or the scene scan.
  • src/index.ts:170 calls process.exit(0) while a runEditJob (src/utils/jobs.ts) may be running, so its rmSync(partial) cleanup never runs. Repro left a 48-byte invalid out.partial.mp4.

Suggested approach

  • Use jobTimeoutMs(inputDurationSec) everywhere ffmpeg decodes the input.
  • Thread extra.signal through runCapture and runFfmpegBuffer.
  • Track active edit jobs in a registry; on shutdown abort them, await exit briefly and delete partials.

Done when

Every ffmpeg spawn site takes a signal and an input-scaled timeout (a lint-style test can assert this). A shutdown test with a running edit job leaves no .partial file.

Activity

  1. added
    bug
    priority: low
    effort: medium
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugeffort: mediumpriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions