(remote): forward the CLI's title through tmux on attach so an attached remote row is not mute - #293
Merged
Merged
Conversation
…ed remote row is not mute Since the row-ownership rule (#273) an attached remote row is driven by the OSC title only, and tmux forwards it to the outer terminal only with set-titles on; the default is off and the default format wraps the pane title, so the classifier never saw the glyph. The attach command now sets set-titles on and set-titles-string '#T' in solo and shared mode alike, the probe records the previous values and the solo detach restores them. Closes #290.
…k its own quoted token Shared attaches also set the two title options, so they are restored on a shared detach too (the other three stay solo-only), which removes the baseline ratchet after a first shared attach. set-titles-string is kept as the raw token tmux prints and restored inside shell single quotes only, letting tmux re-parse its own quoting.
…oken back tmux never re-parses an argv value, so the printed token cannot be handed back as-is; the parser now reverses the escapes tmux 3.6 actually emits (outer quote pair, \n, \t, backslash-any), pinned by a table of twenty values measured on the host.
…nt remains Two clients attached to the same tmux session would otherwise switch title forwarding off under each other. Detach probes the live client count and keeps the title options when another client is still there; the base options keep the solo rule. Three more measured quoting rows in the table.
…nt rule holds The detach-time client count ran after the local ssh client was killed and on a fresh connection, so our own client had usually vanished and a single remaining peer read as 'nobody but us'. The probe now runs first, bounded by a dedicated 5 s timeout, then the kill, then the restore.
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.
Closes #290.
Overnight trace on v0.0.79 (
.work-files/switchboard/trace-2026-09-13-nuit.md, measure 1): two remote sessions attached for 9 h 20 emitted zeroosc.titleand zero busy mutation while their transcripts kept growing. Since the row-ownership rule (#273) an attached remote row is driven by the local-pty path, i.e. by the CLI's OSC title — and tmux forwards that title to the outer terminal only whenset-titlesis on. Measured on the host: tmux 3.6,set-titles* off,set-titles-string* "#S:#I:#W - \"#T\" #{session_alerts}"(inherited defaults).buildAttachCommandprefixesset -t <target> set-titles on \; set -t <target> set-titles-string '#T' \;in solo and shared mode alike. These are session options, so while a Switchboard client is attached every other client of that session sees the CLI title as its outer-terminal title — the one deliberate exception to the (remote): make a solo tmux attach look and behave like a local terminal #253 rule, stated in the context doc; a mute row was judged the worse defect.#Tis single-quoted so the remote shell does not read#as a comment.null. The two title options are restored on every detach (shared included, so a first shared attach does not become the new baseline);status/mouse/window-sizestay solo-only. tmux prints option values in its own escaped form and never re-parses an argv value, so the parser reverses the escapes tmux 3.6 emits (outer quote pair,,, backslash-any), pinned by a table of twenty values measured live on the host; the restore passes the plain value shell-single-quoted.main.jsunchanged: the OSC extraction is already shared between local and attached PTYs.Live check on a throwaway tmux server on the same host (not the production session): a pane whose title is
⠋ helloattached with these two options overssh -ttdelivers\e]0;⠋ hello\ato the outer terminal — the pane title unwrapped, glyph first, exactly whatclassifyTitleActivitykeys on. The production session's options were not touched (set-titles* offstill).Tests:
test/remote-attach.test.js(+14): probe parsing incl. the quoted-string wire form, exact attach commands in both modes, restore segments and round trips, attach/detach integration offsets, and a pin that the#Ttitle classifies as busy through the same regexwireSessionPtyuses. Rationale in.ai/contexts/session-cache.md("Remote hosts — tmux attach", set-titles).