Summary
Hermes Gate currently rewrites remote tmux settings during attach in order to reserve Ctrl+B for detach/back behavior and to inject a custom status bar.
This is a release-blocking interaction bug because it mutates the user's existing tmux session state, and the restore path is only a best-effort reset to assumed defaults rather than a true restoration of prior values.
Current behavior
During _enter_viewer(), the app calls _configure_tmux_for_attach() before attaching and _restore_tmux_after_detach() afterwards.
The attach-time configuration currently does all of the following on the remote session:
- changes the session prefix from
C-b to C-a
- binds
C-b in the root table to detach-client
- forces status bar settings, styling, left text, and right text
The detach-time restore path then attempts to revert some settings by writing hard-coded values or unsetting a subset of options.
Why this matters
This breaks a core user expectation for terminal tooling: attaching to an existing tmux session should not silently rewrite their interactive environment.
Real-world failure modes include:
- a user with a custom tmux prefix loses expected keybindings
- a user with custom root-table bindings gets behavior changed underneath them
- custom status bar theming or plugins are overwritten during attach
- if Hermes Gate crashes, loses connection, or is interrupted before restoration, the remote session remains mutated
- the restore path may revert to an assumed default that is not the user's original state
Evidence
Observed in:
hermes_gate/app.py:576-678
Relevant behavior:
_enter_viewer() calls _configure_tmux_for_attach() before subprocess.call(cmd)
_restore_tmux_after_detach() is only attempted after the attach returns
_configure_tmux_for_attach() executes commands like:
tmux set-option -t <session> prefix C-a
tmux bind-key -T root C-b detach-client
- multiple
status-* mutations
_restore_tmux_after_detach() resets to assumptions like prefix C-b rather than restoring a captured prior value
Expected behavior
Attaching through Hermes Gate should avoid destructive mutation of remote tmux configuration.
Preferred outcomes, in order:
- do not mutate persistent tmux session settings at all
- if temporary mutation is absolutely required, capture the exact prior state and restore it reliably
- if restoration cannot be guaranteed across interrupts/crashes, do not ship the mutation-based design as the default attach flow
Suggested direction
A robust fix should be designed around preserving user state rather than overwriting it.
Potential approaches include:
- a non-mutating attach UX that does not depend on changing prefix/root bindings
- a wrapper/session-local mechanism that does not touch existing persistent tmux state
- if mutation is temporarily unavoidable, explicit state snapshot + restoration with crash-safe cleanup, not hard-coded defaults
Acceptance criteria
Testing requirements
This issue requires real interaction validation, not just unit coverage.
Automated tests
- regression tests covering attach helper command generation
- tests proving user-specific tmux options are not clobbered by the new design
- tests for any state-capture / state-restore helper if one is introduced
Manual / integration validation
Validate against at least these scenarios on a real tmux server:
- session with default tmux config
- session with custom prefix
- session with custom status bar
- session with custom root-table bindings
- interrupted attach flow (client disconnect, process kill, abrupt exit)
For each scenario, verify:
- attach works
- detach/back works
- the original tmux configuration is intact afterwards
- no stale status bar or keybinding mutation remains
Non-goals
- merely catching more exceptions around the current mutation logic
- restoring to guessed defaults instead of actual previous state
- updating docs only while preserving the current destructive behavior
Summary
Hermes Gate currently rewrites remote tmux settings during attach in order to reserve
Ctrl+Bfor detach/back behavior and to inject a custom status bar.This is a release-blocking interaction bug because it mutates the user's existing tmux session state, and the restore path is only a best-effort reset to assumed defaults rather than a true restoration of prior values.
Current behavior
During
_enter_viewer(), the app calls_configure_tmux_for_attach()before attaching and_restore_tmux_after_detach()afterwards.The attach-time configuration currently does all of the following on the remote session:
C-btoC-aC-bin the root table todetach-clientThe detach-time restore path then attempts to revert some settings by writing hard-coded values or unsetting a subset of options.
Why this matters
This breaks a core user expectation for terminal tooling: attaching to an existing tmux session should not silently rewrite their interactive environment.
Real-world failure modes include:
Evidence
Observed in:
hermes_gate/app.py:576-678Relevant behavior:
_enter_viewer()calls_configure_tmux_for_attach()beforesubprocess.call(cmd)_restore_tmux_after_detach()is only attempted after the attach returns_configure_tmux_for_attach()executes commands like:tmux set-option -t <session> prefix C-atmux bind-key -T root C-b detach-clientstatus-*mutations_restore_tmux_after_detach()resets to assumptions likeprefix C-brather than restoring a captured prior valueExpected behavior
Attaching through Hermes Gate should avoid destructive mutation of remote tmux configuration.
Preferred outcomes, in order:
Suggested direction
A robust fix should be designed around preserving user state rather than overwriting it.
Potential approaches include:
Acceptance criteria
C-bTesting requirements
This issue requires real interaction validation, not just unit coverage.
Automated tests
Manual / integration validation
Validate against at least these scenarios on a real tmux server:
For each scenario, verify:
Non-goals