mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-19 15:18:03 +00:00
fix(tools): catch mkdtemp OSError in tirith install to prevent unbounded retry and temp-dir leak (#51826)
When tempfile.mkdtemp() raises OSError (e.g. disk full), the exception propagated past the try/finally block, so _mark_install_failed() was never called. The 24h backoff marker never engaged, causing unbounded retry on every command -- each attempt leaked a tirith-install-* temp directory, eventually filling /tmp completely. Fix: wrap mkdtemp in its own try/except OSError, returning (None, "no_space") so the caller's normal failure path (including _mark_install_failed) executes. Salvaged from #51831 by @liuhao1024. Closes #51826
This commit is contained in:
parent
77d2b50751
commit
dbf0797335
2 changed files with 55 additions and 1 deletions
|
|
@ -372,7 +372,11 @@ def _install_tirith(*, log_failures: bool = True) -> tuple[str | None, str]:
|
|||
archive_name = f"tirith-{target}.tar.gz"
|
||||
base_url = f"https://github.com/{_REPO}/releases/latest/download"
|
||||
|
||||
tmpdir = tempfile.mkdtemp(prefix="tirith-install-")
|
||||
try:
|
||||
tmpdir = tempfile.mkdtemp(prefix="tirith-install-")
|
||||
except OSError as exc:
|
||||
log("tirith install failed: cannot create temp dir: %s", exc)
|
||||
return None, "no_space"
|
||||
try:
|
||||
archive_path = os.path.join(tmpdir, archive_name)
|
||||
checksums_path = os.path.join(tmpdir, "checksums.txt")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue