Skip to content

fix: tolerate deleted cwd in terminal config - #33517

Closed
nodar wants to merge 1 commit into
NousResearch:mainfrom
nodar:fix/terminal-deleted-cwd
Closed

fix: tolerate deleted cwd in terminal config#33517
nodar wants to merge 1 commit into
NousResearch:mainfrom
nodar:fix/terminal-deleted-cwd

Conversation

@nodar

@nodar nodar commented May 27, 2026

Copy link
Copy Markdown

Summary

  • prevent terminal tool config resolution from crashing when the Hermes process cwd/worktree has been deleted
  • add safe cwd/path resolution for local terminal backend and Docker cwd passthrough
  • cover local, Docker default mount, and relative TERMINAL_CWD Docker mount regression cases

Test Plan

  • uv run --with pytest python -m pytest tests/tools/test_terminal_tool.py -o 'addopts=' -q
  • uv run python -m compileall -q tools/terminal_tool.py tests/tools/test_terminal_tool.py
  • independent review pass

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/terminal Terminal execution and process management backend/local Local shell execution labels May 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix with #33377 (and its duplicate #33407) — both guard os.getcwd() in terminal_tool.py _get_env_config() against FileNotFoundError when CWD is deleted. Complementary to #4982/#10233 (cli.py getcwd guard, different call site).

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused deleted-CWD handling and regression cases. This is an automated hermes-sweeper review; current main already provides this guarantee.

  • ad69d3edc7359310233fa789b300bfcc5a5c3f7a (fix(terminal): guard os.getcwd() against a deleted CWD) added _safe_getcwd().
  • tools/terminal_tool.py:1293 uses it for the local default CWD, and tools/terminal_tool.py:1309 uses it for Docker cwd passthrough.
  • tests/tools/test_terminal_task_cwd.py:231 and :240 cover deleted-CWD fallbacks to TERMINAL_CWD and home.
  • The fix is contained in release tag v2026.6.5.

The member comment correctly identified this as competing with the same terminal-tool guard; the later mainline implementation also covers the sibling debug-config call site.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/local Local shell execution P2 Medium — degraded but workaround exists sweeper:implemented-on-main Sweeper: behavior already present on current main tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants