fix(cli): restore session cwd on mid-chat /resume and /sessions (supersedes #38614) - #67287
Merged
Conversation
Dusk1e's fix wired _restore_session_cwd into _handle_resume_command, but that handler was extracted from cli.py into hermes_cli/cli_commands_mixin.py (094aa85) after the PR's base, so the original cli.py hunk no longer applied (a naive cherry-pick fuzzily misplaced it inside new_session(), where session_meta is undefined). Transplanted the call to the end of the handler in its current home; /sessions <id> delegates here so both command forms are covered. Dusk1e's regression tests carry over unchanged. Co-authored-by: Dusk1e <yusufalweshdemir@gmail.com>
OutThisLife
enabled auto-merge
July 19, 2026 03:22
Collaborator
Related to #38614: it has the same intended repair but its live patch edits the retired |
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…614-resume-cwd fix(cli): restore session cwd on mid-chat /resume and /sessions (supersedes NousResearch#38614)
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
Salvages #38614 (@Dusk1e) — rebased onto current
main. Startuphermes -c/--resumerestores a session's original directory (#38562), but interactive/resumeand/sessions <id>did not: they loaded the transcript while leaving the process +TERMINAL_CWDin whatever dir the user hadcd'd into, soterminal/execute_code/relative paths ran against the wrong project. The handler now calls_restore_session_cwd(session_meta)after load (idempotent; no-op when the session recorded no cwd; dim warning if the dir is gone).Why supersede
#38614 was stale: the slash-command handlers were extracted from
cli.pyintohermes_cli/cli_commands_mixin.py(094aa85) after the PR's base, so the originalcli.pyhunk no longer applied. A naive cherry-pick fuzzily misplaced the call insidenew_session(), wheresession_metais undefined (NameError + semantically wrong). Transplanted it to the end of_handle_resume_commandin its current home;/sessions <id>delegates there, so one placement covers both forms — exactly as teknium's sweeper review noted. Dusk1e's regression tests carry over unchanged (authorship preserved via cherry-pick).Test plan
scripts/run_tests.sh tests/cli/test_cli_resume_command.py tests/cli/test_cwd_env_respect.py tests/cli/test_resume_display.py— 72 pass (incl. the 3 newTestCliResumeRestoresCwd: recorded-cwd restore, no-op without cwd,/sessionsdelegation)Closes #38562.