Skip to content

fix(knowledge): clean up video-digest temp dirs when a watch is interrupted by a signal #6920

Closed

Description

@kyle-sexton

Summary

run-watch.js removes a failed watch's temp directories in a finally block, which does not run when the process is killed by SIGINT or SIGTERM before bootstrap finishes. Raised in review of #6853 (P2, #6853 (comment)) and deferred as beyond that PR's fix.

Failure scenario

  1. Start run-watch.js on a long video.
  2. Press Ctrl+C during download.

Expected: the temp video and frame directories are removed.
Actual: they remain in the OS temp directory.

Suggested fix

Register SIGINT and SIGTERM handlers that run the same cleanup, then exit with the conventional signal code; cover with a test that sends the signal to a child run.

Related

🤖 Generated with Claude Code

Activity

  1. added
    needs-triage
    on Oct 11, 2026
  2. github-actions commented on Oct 11, 2026

    @github-actions
    Contributor

    Thanks for the report. I understand the issue: run-watch.js creates temp directories for the video, frames, and sheets via mkdtemp, and the cleanup that removes them runs in a finally block that never executes if the process is killed by SIGINT/SIGTERM before bootstrap finishes (e.g. Ctrl+C during download), leaving the temp directories behind. The suggested fix of adding SIGINT/SIGTERM handlers that run the same cleanup before exiting, with a test that signals a child run, sounds reasonable. I didn't find any existing open issue tracking this specifically; it looks related to the review discussion on #6853 and to #6833 as you noted. No further information is needed from you to act on this.

    Automated triage. A maintainer reviews it.

  3. added
    help wanted
    on Oct 11, 2026
  4. removed
    needs-triage
    on Oct 12, 2026
  5. added theissue type on Oct 12, 2026
  6. kyle-sexton commented on Oct 13, 2026

    @kyle-sexton
    MemberAuthor

    Owner batch-ratified this admission in an attended session on 2026-10-12: work-class: scoped. Rule: class C1-C3, no trust surface, the independent check confirmed the recorded decision, and no owner step remains.

  7. added
    agent-ready
    and removed
    agent-ready
    on Oct 13, 2026
  8. kyle-sexton commented on Oct 18, 2026

    @kyle-sexton
    MemberAuthor

    Agent Brief

    Type: Bug
    Summary: Remove a video-digest watch's temp directories when the run is interrupted by SIGINT or SIGTERM.

    Current behavior:
    The watch runner removes its temp video, frame and sheet directories in a finally block, which does not run when the process is killed by a signal before bootstrap finishes, so the directories stay in the OS temp directory.

    Desired behavior:
    On SIGINT or SIGTERM the runner runs the same cleanup, then exits with the conventional signal exit code (130 for SIGINT, 143 for SIGTERM). Cleanup runs once even if the finally path also fires. Handlers are removed once the run finishes normally.

    Key interfaces:

    • The watch runner's temp-directory cleanup: callable from both the finally path and the signal handlers.

    Acceptance criteria:

    • A test starts a child run, sends it SIGTERM before it finishes, and finds its temp directories removed and its exit code 143.
    • A normal run's cleanup behavior is unchanged.
    • scripts/run-test-file.sh passes on the test file.
    • scripts/check-changelog-fragments.sh passes.

    Out of scope:


    This was generated by AI during backlog shaping. The owner approved this in an attended backlog-shaping session on 2026-10-17.

  9. added
    agent-ready
    on Oct 18, 2026
  10. melodic-automation-lanes commented on Oct 18, 2026

    @melodic-automation-lanes
    Contributor

    The work-resolve-issue run that agent-ready started failed before it reported, or the token broker refused it because its workflow files differ from main's. work-unblock removed and added agent-ready back to start a fresh run on main's workflow files. It does this once per version of those files, so if this run fails the same way, a person looks at it.

  11. added
    agent-ready
    and removed
    agent-ready
    on Oct 18, 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

    agent-readyhelp wanted

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions