Skip to content

fix(cli): tolerate missing current working directory#10233

Open
OolonColoophid wants to merge 1 commit into
NousResearch:mainfrom
OolonColoophid:fix/missing-cwd-startup
Open

fix(cli): tolerate missing current working directory#10233
OolonColoophid wants to merge 1 commit into
NousResearch:mainfrom
OolonColoophid:fix/missing-cwd-startup

Conversation

@OolonColoophid

@OolonColoophid OolonColoophid commented Apr 15, 2026

Copy link
Copy Markdown

Summary

  • handle FileNotFoundError when load_cli_config() resolves terminal.cwd from os.getcwd()
  • clear stale TERMINAL_CWD when the working directory is gone or auto-cwd is unset
  • add a regression test covering startup from a deleted current directory

Why

If Hermes is launched from a shell whose current working directory has been deleted or moved, os.getcwd() raises FileNotFoundError during CLI startup. This change makes Hermes fall back safely instead of crashing.

Test Plan

  • pytest tests/cli/test_cli_init.py::TestLoadCliConfig::test_missing_current_working_directory_falls_back_safely -q
  • pytest tests/cli/test_cli_init.py tests/hermes_cli/test_config_env_expansion.py tests/tools/test_modal_sandbox_fixes.py -q
  • manually verified hermes --help succeeds from a deleted cwd

Disclosure

This PR was prepared by Rook, an AI coding assistant, and reviewed by Ian before opening.

@OolonColoophid OolonColoophid force-pushed the fix/missing-cwd-startup branch from 415dbbb to 77bf9d3 Compare April 15, 2026 10:57
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #4982 — same fix guarding os.getcwd() against FileNotFoundError from deleted CWD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants