fix(cookbook): stop local Windows download orphans that deadlock HF retries#5720
Open
ZakrepaShe wants to merge 2 commits into
Open
fix(cookbook): stop local Windows download orphans that deadlock HF retries#5720ZakrepaShe wants to merge 2 commits into
ZakrepaShe wants to merge 2 commits into
Conversation
…etries Client-side tree-kill alone could leave hf/python children holding cache locks after Stop. Centralize stop in /api/cookbook/stop-session with verified local Windows kills, orphan scans, stop markers, and a same-repo live-download guard so retries reattach or refuse instead of deadlocking. Co-authored-by: Cursor <cursoragent@cursor.com>
Current dev annotates agent_loop helpers with dict[str, Any] but never imports Any, so launch-windows.ps1 / uvicorn crashes on import. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On native Windows, Cookbook Stop could kill only the outer session wrapper and leave
hf.exe/python.exechildren holding HuggingFace cache locks. Retrying the same repo then hung forever onStill waiting to acquire lock…while the UI no longer tracked the orphan. This PR centralizes stop inPOST /api/cookbook/stop-sessionfor local Windows, verifies process-tree kills (and session/orphan scans), preserves recovery artifacts when stop fails, writes stop markers only after success, and refuses/reattaches when a same-repo local downloader is already live.This is the narrow local-Windows stop/orphan/deadlock slice from the closed #3996 effort, rebased onto current
devwithout remote-Windows, agent-platform, or progress-parser follow-ups.Target branch
dev, notmain.Linked Issue
Fixes #3995
Related: #2998 (same cancel-leaves-python-running symptom), #5220 / closed #5219 (narrower related slice that did not merge), supersedes the local-Windows portion of closed #3996.
Type of Change
Checklist
devHow to Test
hf.exe/python.exechildren for that repo.Still waiting to acquire lock….pytest tests/test_cookbook_local_windows_stop.py tests/test_cookbook_download_restart_js.py -qOut of scope (follow-ups)
sshPortregistration ("Platform" property of remote servers is never set #3619 adjacent)hf_download.pyPipeTqdm (mentioned in Bug: stopping a local Windows cookbook download leaves orphaned hf/python processes that deadlock every retry on the HF cache locks #3995; related closed fix(cookbook): Windows local download + serve fixes (bash routing, progress, CUDA llama-server, busy-endpoint watchdog) #3100)Visual / UI changes
Stop failure now surfaces a toast and rolls the live card back instead of falsely marking stopped. No new colors, spacing, fonts, or component patterns.