Skip to content

fix: recover from invalid default workspace paths - #366

Closed
Jordan-SkyLF wants to merge 1 commit into
nesquena:masterfrom
Jordan-SkyLF:pr/workspace-fallback
Closed

fix: recover from invalid default workspace paths#366
Jordan-SkyLF wants to merge 1 commit into
nesquena:masterfrom
Jordan-SkyLF:pr/workspace-fallback

Conversation

@Jordan-SkyLF

@Jordan-SkyLF Jordan-SkyLF commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix default workspace fallback so sessions do not retain a broken workspace path when the configured default is invalid or unavailable.

What this changes

  • harden default workspace resolution in api/config.py
  • add regression coverage for fallback behavior in tests/test_default_workspace_fallback.py

Why

When the default workspace cannot be used, the Web UI should recover to a safe fallback instead of carrying forward an unusable path.

Test plan

  • python -m pytest tests/test_default_workspace_fallback.py -q
    • 2 passed

(cherry picked from commit 789d7537a325d1c7d3aa03c387918dddd2d0897d)
@Jordan-SkyLF Jordan-SkyLF changed the title fix: recover from bad default workspace paths fix: recover from invalid default workspace paths Apr 13, 2026
@Jordan-SkyLF
Jordan-SkyLF marked this pull request as ready for review April 13, 2026 19:30
@nesquena-hermes

Copy link
Copy Markdown
Collaborator

PR Review: fix: recover from invalid default workspace paths

Thanks for this fix!

What this does

  • Hardens the default workspace resolution logic in api/config.py so that when the configured default workspace path is invalid or unavailable, the Web UI falls back to a safe alternative
  • Adds regression coverage in tests/test_default_workspace_fallback.py (2 passing tests)

Why this matters

Without this fix, users who have a stale or broken default workspace path would end up in a broken state where sessions inherit the unusable path. This is particularly impactful for users who have moved, deleted, or renamed their workspace directories.

Code quality notes

  • The fix is minimal and well-targeted — hardening api/config.py is exactly the right place for this
  • The test file name test_default_workspace_fallback.py is descriptive and the 2 tests confirm both the fallback trigger and the recovery behavior
  • The cherry-pick commit history is clean

Summary

✅ Looks good to merge. The fallback behavior prevents a class of silent breakage where sessions silently carry forward an unusable workspace path.

nesquena-hermes pushed a commit that referenced this pull request Apr 13, 2026
#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)
nesquena-hermes added a commit that referenced this pull request Apr 13, 2026
* fix: recover from bad default workspace paths

(cherry picked from commit 789d7537a325d1c7d3aa03c387918dddd2d0897d)

* fix: recover from invalid default workspace paths — 7 tests, CHANGELOG (#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)

---------

Co-authored-by: Jordan SkyLF <jordan@skylinkfiber.net>
Co-authored-by: Nathan Esquenazi <nesquena@gmail.com>
@nesquena-hermes

Copy link
Copy Markdown
Collaborator

Merged into v0.50.18 ✅

Thanks @Jordan-SkyLF — this is a clean, well-scoped fix for a real pain point. The three-function refactor (_workspace_candidates, _ensure_workspace_dir, resolve_default_workspace) is easy to follow and the fallback priority order is sensible.

What was added before merging:

  • Rebased onto current master (v0.50.17)
  • 5 additional tests: ~/workspace creation when missing, RuntimeError when all candidates fail, dedup check on candidate list, env var priority, unwritable path returning False
  • CHANGELOG entry

Now live in v0.50.18. Docker users and anyone with a stale workspace path in their settings will self-heal on next server start. 🎉

@Jordan-SkyLF
Jordan-SkyLF deleted the pr/workspace-fallback branch April 13, 2026 22:23
@nesquena

Copy link
Copy Markdown
Owner

Thanks @Jordan-SkyLF for the contribution!

After pulling the latest master and comparing line-by-line, every change in this PR is already merged:

  • _workspace_candidates() — identical on master
  • _ensure_workspace_dir() — identical on master
  • resolve_default_workspace() — identical on master
  • _discover_default_workspace() updated docstring — identical on master
  • save_settings() workspace rewrite logic — identical on master
  • Startup settings workspace fallback + settings.json rewrite — identical on master
  • test_default_workspace_fallback.py — identical tests on master (plus additional tests)

This was merged as part of a prior sprint that addressed the same issue (#357). Closing as superseded — thanks for the effort!

JKJameson pushed a commit to JKJameson/hermes-webui that referenced this pull request Apr 25, 2026
* fix: recover from bad default workspace paths

(cherry picked from commit 789d7537a325d1c7d3aa03c387918dddd2d0897d)

* fix: recover from invalid default workspace paths — 7 tests, CHANGELOG (nesquena#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)

---------

Co-authored-by: Jordan SkyLF <jordan@skylinkfiber.net>
Co-authored-by: Nathan Esquenazi <nesquena@gmail.com>
SysAdminDoc pushed a commit to SysAdminDoc/hermes-webui that referenced this pull request Jun 26, 2026
* fix: recover from bad default workspace paths

(cherry picked from commit 789d7537a325d1c7d3aa03c387918dddd2d0897d)

* fix: recover from invalid default workspace paths — 7 tests, CHANGELOG (nesquena#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)

---------

Co-authored-by: Jordan SkyLF <jordan@skylinkfiber.net>
Co-authored-by: Nathan Esquenazi <nesquena@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants