Restore session cwd on resume#21427
Conversation
0438b98 to
de07055
Compare
|
Rebased this on the latest main and resolved the merge conflict with the new handoff session metadata. Since main is already at schema version 12, this now bumps the session schema to 13 while preserving both the handoff fields and the workspace/cwd fields.\n\nRe-ran the focused checks after the rebase:\n\n- |
de07055 to
f475931
Compare
|
Rebased again on latest main and resolved the new conflict in run_agent.py by preserving both the upstream file-mutation verifier bookkeeping and the session cwd persistence update.\n\nFocused checks after this rebase:\n\n- |
Hi! This is a follow-up to #19154 with the missing consumer added.
In the previous PR, the schema/storage plumbing for session workspace context was clean, but it only wrote
workspace_path/last_cwdand nothing read them. This version keeps the same narrow scope, but wires the stored cwd into core resume behavior so the schema bump has an immediate reader.Summary
workspace_pathandlast_cwdcolumns to the session store.TERMINAL_CWD/ process cwd when CLI and agent sessions are created.last_cwdafter terminal tool calls by reading the active terminal environment cwd.last_cwdintoTERMINAL_CWDduring resume flows:--resumepreload_init_agent()fallback resume/resume <session>This means dashboards and remote clients can now rely on persisted workspace context, while the CLI itself also consumes that metadata when resuming a session.
Tests
python3 -m py_compile session_workspace.py hermes_state.py cli.py run_agent.py.venv/bin/python -m pytest tests/test_hermes_state.py tests/cli/test_resume_display.py -q254 passedI also attempted the broader local suite with the canonical pytest settings. The run reached
20212 passed, but this local environment is missing optional/full extras used by unrelated tests (acp,fastapi,numpy, etc.), so that full run was not green locally.