mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
fix(cookbook): don't mark successful dependency installs as crashed (#1315)
Pip dependency installs are tracked as download tasks but finish with the runner's "=== Process exited with code 0 ===" sentinel and pip's "Successfully installed" line — never the HuggingFace download markers (DONE / 100% / /snapshots/ / DOWNLOAD_OK) the download heuristics look for. Once the tmux pane is gone, the backend's only completion check is the HF cache lookup, which a pip package (e.g. llama-cpp-python[server], no "/") never matches, so it reports "stopped" — and the frontend maps a stopped download to "crashed". The reconnect loop's session-gone heuristic had the same gap. Result: a clean install (exit 0) showed "crashed" in the Running tab while the Dependencies tab correctly showed it installed. Add a shared _depInstallSucceeded() helper that keys off the exit-0 sentinel (falling back to pip's success line, rejecting ERROR/Traceback) and wire it into both the session-gone heuristic and the background status reconciler, gated on payload._dep so real model downloads are unaffected. Also fixes the pre-existing test_background_status_poll_reconciles_into_local_tasks assertion that no longer matched the evolved reconciler, and adds regression coverage for both paths.
This commit is contained in:
@@ -37,6 +37,42 @@ def test_local_windows_session_commands_use_local_powershell_log_dir():
|
||||
assert ": `powershell -Command \"${ps}\"`;" in source
|
||||
|
||||
|
||||
def test_dep_install_success_recognized_from_exit_sentinel():
|
||||
"""A pip dependency install reports success via the runner's exit-0
|
||||
sentinel / pip's "Successfully installed" line, not the HuggingFace
|
||||
download markers. The shared helper must key off those, so an install
|
||||
whose tmux pane is gone isn't misread as crashed."""
|
||||
source = _read("static/js/cookbookRunning.js")
|
||||
|
||||
assert "function _depInstallSucceeded(output) {" in source
|
||||
assert "=== Process exited with code" in source
|
||||
assert "Successfully installed" in source
|
||||
|
||||
|
||||
def test_session_gone_heuristic_honors_dep_install_success():
|
||||
"""The reconnect loop's session-gone branch (download tasks need an HF
|
||||
marker to look successful) must also accept a finished dependency install,
|
||||
otherwise a clean pip install with no HF markers is marked crashed."""
|
||||
source = _read("static/js/cookbookRunning.js")
|
||||
|
||||
assert "const depInstallSucceeded = !!task.payload?._dep && _depInstallSucceeded(lastOutput);" in source
|
||||
assert (
|
||||
"const looksSuccessful = depInstallSucceeded "
|
||||
"|| (task.type === 'download' ? downloadLooksSuccessful : serveLooksReady);"
|
||||
) in source
|
||||
|
||||
|
||||
def test_background_poll_recovers_done_for_stopped_dependency_install():
|
||||
"""When the backend reports a finished dependency install as "stopped"
|
||||
(its pip package is never in the HF cache the dead-session check inspects),
|
||||
the reconciler must recover "done" from the retained output instead of
|
||||
downgrading the card to crashed."""
|
||||
source = _read("static/js/cookbookRunning.js")
|
||||
|
||||
assert "const depDone = !!task.payload?._dep && _depInstallSucceeded(task.output);" in source
|
||||
assert "depDone ? 'done' : (task.type === 'download' ? 'crashed' : 'stopped')" in source
|
||||
|
||||
|
||||
def test_dependency_install_payload_keeps_env_path_for_refresh():
|
||||
source = _read("static/js/cookbook.js")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user