Repository navigation
Conversation
The finally stop sent SIGTERM and then waited with no bound. The signal handler passes over a second Ctrl-C, so a script ignoring SIGTERM held the helper, its fetched tree, and the re-raised signal forever. The stop now waits STOP_TIMEOUT seconds and then kills, per CODESTYLE.md "Interrupts in Python". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uv Alone The honoring case shared the ignoring case's half-second bound, so a slow runner could kill a child that was exiting on SIGTERM. The stop's docstring and the end-to-end case now name what the kill reaches, which is `uv run` rather than the script it started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
A recorded local strict-review pass covers head |
|
Parked on #4523, a design decision: should the bounded stop's kill also reach the script |
There was a problem hiding this comment.
🟡 Changes recommended
A critical active bug remains in signal-timeout cleanup: killing only the uv launcher can leave the script running against a deleted temporary tree, and the orphan-process case is unaddressed.
1 open issue
What changed in this PR
This PR bounds interrupt cleanup for hub_fetch_run.py so an interrupted run cannot wait indefinitely for its uv child, while the launcher-only kill can still leave a descendant script running.
Changes:
- Adds a 10-second stop timeout followed by forced termination.
- Centralizes subprocess cleanup in
stop(). - Adds end-to-end and in-process tests for graceful termination, timeout handling, signal behavior, and temporary-tree cleanup.
| File | Description |
|---|---|
| tests/test_hub_fetch_run.py | Adds end-to-end and in-process tests covering graceful child termination, timeout-based killing, signal handling, and temporary-tree cleanup. |
| catalog/snippets/hub_fetch_run.py | Adds bounded subprocess cleanup through stop() with a 10-second timeout and forced termination fallback. |
Review effort: Lite
|
|
||
| The handler passes over a second Ctrl-C. | ||
| So a child ignoring SIGTERM would otherwise hold this process and its fetched tree forever. | ||
| The kill reaches `child` alone, which is `uv run` rather than the script it started. |

Summary
catalog/snippets/hub_fetch_run.pystopped itsuv runchild in afinallywithterminate()and then await()with no bound. The signal handler passes over a second Ctrl-C. So a script that ignores or outlasts SIGTERM held the hook or VS Code task forever. The fetched tree stayed, and the recorded signal was never re-raised.The stop is now one
stop()function, perCODESTYLE.md"Interrupts in Python". It callsterminate(), thenwait(timeout=STOP_TIMEOUT)with a 10 second bound. Onsubprocess.TimeoutExpiredit callskill(), thenwait().Tests
tests/test_hub_fetch_run.pygains three cases.uvignores SIGTERM and sleeps past the test's 30 second timeout. The helper dies by SIGTERM, leaves no fetched tree, and leaves no process in its group. Run against the old snippet, the case fails on that 30 second timeout.stop()with a short patched bound. A child that honors SIGTERM ends by it. A child ignoring SIGTERM ends by SIGKILL after the bound.Each case starts its child in a session of its own and kills that group in a
finally.Scope
No spec entry records the snippet's bytes or digest, so nothing in
spec/changes. Re-carrying the snippet into the repositories that hold it is resync work in each of them, and is not done here.Open question
The local review pass found that the bound's
kill()reachesuv runalone. A script that outlasts SIGTERM past the bound is left running after the helper ends. The rule prescribes that exact form, so whether the stop should also reach the script is a design decision for the maintainer, filed as #4523. This pull request waits on it.Pre-existing findings, not filed
scripts/secrets_sync.py, thefinallyaround itsopchild:terminate()then an unboundedwait(), a correctness finding againstCODESTYLE.md"Interrupts in Python". That rule says an existing script takes it when next edited, and not in an edit for the rule alone.Owed actions
main, so hub_fetch_run.py Waits Unbounded for Its Child After terminate() #4494 stays open past this pull request.🤖 Generated with Claude Code