Bug Description
When switching between profiles in Hermes Desktop, the terminal.cwd configured in the target profile is ignored. Instead, the terminal session inherits the cwd from a previously-used profile.
Environment
- Hermes version: 0.16.0
- OS: Windows 10
- Desktop App: Hermes Desktop (native Electron app)
Steps to Reproduce
- Have two profiles with different
terminal.cwd:
- Profile A (
mahjong): terminal.cwd: D:\Cursor project\Mahjong
- Profile B (
ef-design): terminal.cwd: D:\P4-ProjectEF\Design\策划文档md
- Use Profile A in Desktop first (works correctly).
- Switch to Profile B in Desktop.
- Start a new session (
/reset).
- Ask the agent: "What is the current working directory?"
- Run
pwd in terminal.
Expected Behavior
Profile B's terminal session uses D:\P4-ProjectEF\Design\策划文档md as configured.
Actual Behavior
The terminal session uses Profile A's cwd (D:\Cursor project\mahjong). Earlier sessions (before persistent_shell was configured) fell back to the default profile's cwd (C:\Users\shenlihang).
Evidence from agent.log
Profile B's agent.log shows correct .env loading but wrong cwd:
13:44:03 Loaded environment variables from ...\profiles\ef-design\.env
13:47:09 Session snapshot created (session=e984f874882b, cwd=D:\Cursor project\mahjong)
The cwd D:\Cursor project\mahjong belongs to Profile A.
For comparison, Profile A's agent.log correctly uses its own cwd:
13:24:48 Session snapshot created (session=ab83d9e087ea, cwd=D:\Cursor project\mahjong)
Verified Config
Profile B's config.yaml terminal section is identical to Profile A's (except cwd), and hermes config show --profile ef-design reports the correct Working dir: D:\P4-ProjectEF\Design\策划文档md. The active_profile file also correctly points to ef-design.
Workaround
Setting terminal.shell_init_files to a script that does cd on init works as a temporary fix, but the root cause should be addressed.
Bug Description
When switching between profiles in Hermes Desktop, the
terminal.cwdconfigured in the target profile is ignored. Instead, the terminal session inherits the cwd from a previously-used profile.Environment
Steps to Reproduce
terminal.cwd:mahjong):terminal.cwd: D:\Cursor project\Mahjongef-design):terminal.cwd: D:\P4-ProjectEF\Design\策划文档md/reset).pwdin terminal.Expected Behavior
Profile B's terminal session uses
D:\P4-ProjectEF\Design\策划文档mdas configured.Actual Behavior
The terminal session uses Profile A's cwd (
D:\Cursor project\mahjong). Earlier sessions (beforepersistent_shellwas configured) fell back to the default profile's cwd (C:\Users\shenlihang).Evidence from agent.log
Profile B's agent.log shows correct
.envloading but wrong cwd:The cwd
D:\Cursor project\mahjongbelongs to Profile A.For comparison, Profile A's agent.log correctly uses its own cwd:
Verified Config
Profile B's
config.yamlterminal section is identical to Profile A's (except cwd), andhermes config show --profile ef-designreports the correctWorking dir: D:\P4-ProjectEF\Design\策划文档md. The active_profile file also correctly points toef-design.Workaround
Setting
terminal.shell_init_filesto a script that doescdon init works as a temporary fix, but the root cause should be addressed.