Repository navigation
Description
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
- Profile A (
- 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
pwdin 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.
Activity
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
test(tui_gateway): cover per-profile cwd resolution (NousResearch#40334)
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
Omnichannel-nz commentedon Jun 30, 2026
We reproduced a shared-dashboard/shared-remote-backend profile-switch bug where the selected profile changes but the execution workspace does not. In our environment, the dashboard switched to marketing, but the embedded session still executed with cwd /home/oc/.hermes/profiles/infrastructure/workspace and loaded the infrastructure workspace AGENTS.md. A controlled CLI test also confirmed that Hermes correctly keeps SOUL.md profile-scoped while AGENTS.md remains cwd-scoped, so the observed failure mode is a mixed-context session: marketing identity plus infrastructure workspace.
Further source inspection shows that the upstream tui_gateway fix for honoring the target profile's terminal.cwd on desktop profile switch is already present in the installed build. That suggests the remaining issue is likely in Desktop-side profile-switch cwd reseeding or stale client state rather than the old backend fallback alone. The client appears able to create a new session with a stale explicit cwd from the previously active profile, which then overrides the backend's corrected fallback logic. This appears consistent with issue #40334, with related UI/workspace-pane symptoms matching #49291 / #49293.
Reproduce steps: Hermes Desktop with Remote Gateway, or Hermes Dashboard, using a shared backend with multiple profiles. After switching profiles, a new session can retain a stale workspace/cwd from the previously active profile. In the reproduced case, the selected profile was marketing, but the reported working directory remained /home/oc/.hermes/profiles/infrastructure/workspace.
This demonstrates a mixed-context session where the active profile changes but the workspace/cwd remains from the previous profile.
P.S. Apologies if this is not the place for it. Noob git-user, not familiar with protocol/workflow.
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…
fix(tui_gateway): compare the composer effort echo against the TARGET…
fix(tui_gateway): honor target profile's terminal.cwd on desktop prof…