feat(tui): include session name in the terminal titlebar#43188
Merged
Conversation
The terminal/console titlebar was composed from status marker + model + cwd only; the session's (auto-)title never appeared, even though the TUI already knows it. Change the format to `<marker> <session name> · <model> · <cwd>`, with the session name and cwd each omitted when absent so single-segment titles stay clean. The current session's live title is pulled from the existing session.active_list poll (which already carries each session's current flag and title), so there's no extra round-trip; UiState gains a sessionTitle field updated only when it actually changes, preserving the existing idle-flicker guard. Extract the join logic into a pure composeTabTitle() helper in domain/paths and cover its edge cases (name omitted, cwd omitted, whitespace-only name, marker-only fallback, truncation, boundary length) in paths.test.ts.
Contributor
🔎 Lint report:
|
wachoo
pushed a commit
to wachoo/hermes-agent
that referenced
this pull request
Jun 10, 2026
…h#43188) The terminal/console titlebar was composed from status marker + model + cwd only; the session's (auto-)title never appeared, even though the TUI already knows it. Change the format to `<marker> <session name> · <model> · <cwd>`, with the session name and cwd each omitted when absent so single-segment titles stay clean. The current session's live title is pulled from the existing session.active_list poll (which already carries each session's current flag and title), so there's no extra round-trip; UiState gains a sessionTitle field updated only when it actually changes, preserving the existing idle-flicker guard. Extract the join logic into a pure composeTabTitle() helper in domain/paths and cover its edge cases (name omitted, cwd omitted, whitespace-only name, marker-only fallback, truncation, boundary length) in paths.test.ts.
34 tasks
changman
pushed a commit
to changman/hermes-agent
that referenced
this pull request
Jun 10, 2026
…h#43188) The terminal/console titlebar was composed from status marker + model + cwd only; the session's (auto-)title never appeared, even though the TUI already knows it. Change the format to `<marker> <session name> · <model> · <cwd>`, with the session name and cwd each omitted when absent so single-segment titles stay clean. The current session's live title is pulled from the existing session.active_list poll (which already carries each session's current flag and title), so there's no extra round-trip; UiState gains a sessionTitle field updated only when it actually changes, preserving the existing idle-flicker guard. Extract the join logic into a pure composeTabTitle() helper in domain/paths and cover its edge cases (name omitted, cwd omitted, whitespace-only name, marker-only fallback, truncation, boundary length) in paths.test.ts.
alt-glitch
pushed a commit
that referenced
this pull request
Jun 14, 2026
The terminal/console titlebar was composed from status marker + model + cwd only; the session's (auto-)title never appeared, even though the TUI already knows it. Change the format to `<marker> <session name> · <model> · <cwd>`, with the session name and cwd each omitted when absent so single-segment titles stay clean. The current session's live title is pulled from the existing session.active_list poll (which already carries each session's current flag and title), so there's no extra round-trip; UiState gains a sessionTitle field updated only when it actually changes, preserving the existing idle-flicker guard. Extract the join logic into a pure composeTabTitle() helper in domain/paths and cover its edge cases (name omitted, cwd omitted, whitespace-only name, marker-only fallback, truncation, boundary length) in paths.test.ts.
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
The TUI sets the terminal/console titlebar via OSC 0 (
useTerminalTitle), but until now it was composed from status marker + model + cwd only — the session's name never appeared, even though the TUI already knows it (you set it with/title, or auto-title generation produces one after the first response).This changes the format to:
⚠(waiting on approval/sudo/secret/clarify),⏳(busy),✓(idle)When there's no session name yet (e.g. a brand-new session before auto-title lands), the titlebar is exactly the old
<marker> <model> · <cwd>, so behavior is unchanged in that case.How it works
The current session's title is read from the existing
session.active_listpoll thatuseMainAppalready runs every 1.5s — each item already carries acurrentflag and its livetitle(server-side_session_live_item→_session_live_title→ DB lookup, so auto-titles are included). No new RPC / round-trip.UiStategains asessionTitlefield, patched only when it actually changes, preserving the existing idle-flicker guard.The string-composition logic is extracted into a pure
composeTabTitle()helper indomain/paths.ts(alongsideshortCwd/fmtCwdBranch) so it's unit-testable.Impact
Small UX nicety: when you run several Hermes sessions in different terminal tabs/windows, the OS tab/window title now disambiguates them by their session name instead of showing the same
model · cwdfor every tab. No effect on functionality.Test plan
npm run type-check— cleaneslinton touched files — 0 errors (remaining warnings are pre-existing, in unrelated hooks)composeTabTitlecovered inpaths.test.ts: ordering, name-omitted (== old format), whitespace-only name, cwd-omitted, marker-only fallback, truncation, boundary length — 8 new cases, all greenvitest run— green except one pre-existing failure invirtualHeights.test.ts("compound user prompt width"), confirmed to fail identically on cleanorigin/main(verified by stash) and unrelated to this change