fix: recover from invalid default workspace paths (closes #366) - #372
Merged
Merged
Conversation
(cherry picked from commit 789d7537a325d1c7d3aa03c387918dddd2d0897d)
#366) - tests/test_default_workspace_fallback.py: 5 additional tests (dedup, RuntimeError, env var priority, mkdir on missing dir, unwritable path) - CHANGELOG.md: v0.50.18 entry; 922 tests (up from 915)
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
Merges PR #366 by @Jordan-SkyLF. Rebased onto current master (was 2 releases behind). 5 additional tests added.
What the PR does
Hardens workspace path resolution in
api/config.py. Previously, ifdefault_workspacepointed to a non-existent or unwritable path (deleted directory, bad environment variable, stale settings), the server would either crash at startup or silently carry an unusable workspace. Now:_workspace_candidates()builds a priority-ordered list of fallback paths_ensure_workspace_dir()validates + creates each candidateresolve_default_workspace()returns the first usable path or raisesRuntimeErrorwith a clear messagesave_settings()validates the workspace before persisting itTests
7 tests total in
tests/test_default_workspace_fallback.py(2 original + 5 added):~/workwhen primary path unusablesave_settingsrewrites bad workspace to fallback~/workspacecreated when nothing else existsRuntimeErrorraised when all candidates fail~/workspaceappears at most once in candidates listHERMES_WEBUI_DEFAULT_WORKSPACEtakes priority overNoneraw arg_ensure_workspace_dirreturnsFalsefor unwritable pathsTest results: 922/922