Set host terminal title for agent sessions and dashboard#14
Merged
Conversation
The host terminal/tab title (iTerm2 etc.) was never set when running `agentbox claude`/`codex`/`opencode`/`attach` or `dashboard`: the inner agent's OSC title is swallowed by tmux (set-titles off) and by @xterm/headless in the dashboard, so it never reaches the host. Add a small TTY-guarded helper (OSC 0 set-title + XTPUSHTITLE/XTPOPTITLE save/restore) and drive it from the already-polled status.json title: - attach paths (docker + cloud) show just `<title>` (agent session title, falling back to the box name), resolved per active agent so codex/opencode work too; - the dashboard shows `AgentBox: <selected box title|name>`, updated on box switch and restored on exit.
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
agentbox claude/codex/opencode/attachordashboard. The inner agent's OSC title is swallowed by tmux (set-titlesoff) and by@xterm/headlessin the dashboard, so it never reaches the host.apps/cli/src/terminal/title.ts: OSC 0 set-title plus XTPUSHTITLE/XTPOPTITLE to save/restore the user's original title.runWrappedAttachsite) now show just<title>— the live session title fromstatus.json, resolved per active agent so codex/opencode work too, falling back to the box name until the agent sets one.AgentBox: <selected box title|name>, updated on box switch and restored on exit.set-titleschange (host stays the sole title writer).Test plan
pnpm build,pnpm typecheck,pnpm lintcleanpnpm test(335 passed, incl. newterminal-title.test.ts)dashboardunder a real PTY: emits\x1b[22;2t(push),\x1b]0;AgentBox\x07(title),\x1b[23;2t(pop on quit)agentbox claudetab shows box name then the agent's session title, restored on exitagentbox dashboardtab showsAgentBox: <selected>, updates onCtrl+Option+↑/↓, restored on quitNote
Low Risk
Terminal UX only (OSC sequences, title sanitization); no auth, data, or infrastructure changes beyond existing status polling.
Overview
Adds a TTY-safe
terminal/titlehelper (OSC 0 set-title, push/pop title stack) so the host tab/window title updates even when tmux or the dashboard headless PTY swallow inner OSC sequences.Attach (
runWrappedAttach): saves the user’s title, seeds the tab with the box name, then mirrors the live session title from polledstatus.jsonfor Claude/Codex/OpenCode (not shell), with deduped writes; restores the prior title on exit.Dashboard: on entry pushes the saved title and sets
AgentBox: <session title|box name>(orAgentBoxfor “+ New box”), refreshed when selection/chrome redraws; restores on quit.stripTitleGlyphis exported for shared title cleanup.Includes
terminal-title.test.tsfor OSC/CSI output and sanitization.Reviewed by Cursor Bugbot for commit 940844e. Configure here.