Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(terminal): recycle banner lands after the joiner's alt-screen switch
enescd83267f985d
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex 8e9897c3d..677d65ca2 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -3289,13 +3289,6 @@ export function TerminalNode({}))}- // A restart we did not ask for: say why once, before the new session's output lands. (We- // JOIN the replacement session, so tmux — which already has a client — does not redraw for- // us; the first thing on this screen is whatever the new shell prints next.)- if (wasRecycled)- term.write(- '\r\n\x1b[90m── session restarted by another user (moved to a new folder) ──\x1b[0m\r\n'- )// Flow control: track xterm's unprocessed write backlog (bytes handed to// term.write but not yet parsed, plus anything still queued in the gate below). Past a// high watermark we pause the source so a flood can't grow this buffer without bound;@@ -3430,6 +3423,15 @@ export function TerminalNode({// wheel-scroll tmux history. Enable it (see CO_ATTACH_MOUSE_SEQ). Only ever set on a join,// so this never fires on the solo spawn / warm-reattach-with-own-tmux-client path.if (coAttachMouse) term.write(CO_ATTACH_MOUSE_SEQ)+ // A restart we did not ask for: say why once, before the new session's output lands (the+ // gate below is still shut). We JOIN the replacement session, so tmux — which already has+ // a client — does not redraw for us. AFTER the seed, never before it: a joiner enters the+ // alternate buffer above (coAttachAltScreen), and a banner written earlier would sit in+ // the normal buffer the user no longer sees — or be cleared by the switch.+ if (wasRecycled)+ term.write(+ '\r\n\x1b[90m── session restarted by another user (moved to a new folder) ──\x1b[0m\r\n'+ )} catch (err) {// Never let a seed failure freeze the terminal: the live stream matters more than the// history. `finally` still opens the gate below.diff --git a/src/renderer/terminal/co-attach-alt-screen.test.ts b/src/renderer/terminal/co-attach-alt-screen.test.tsindex 035c8a0bc..dcdb005cb 100644--- a/src/renderer/terminal/co-attach-alt-screen.test.ts+++ b/src/renderer/terminal/co-attach-alt-screen.test.ts@@ -23,4 +23,20 @@ describe('co-attach joiner alternate screen', () => {expect(alt).toBeLessThan(paint)})}++ // The recycle banner ("session restarted by another user") is written on a JOIN of the+ // replacement session — exactly when the alt switch fires. Written before the switch it lands+ // in the normal buffer the user no longer sees (and the paint would overwrite it anyway).+ it('TerminalNode writes the recycle banner after the alt switch and the joiner paint', () => {+ const s = src('nodes/TerminalNode.tsx')+ const alt = s.indexOf('term.write(CO_ATTACH_ALT_SCREEN_SEQ)')+ const paint = s.indexOf('toXtermText(stripTrailingNewline(')+ const banner = s.indexOf('session restarted by another user (moved to a new folder)')+ const gateOpen = s.indexOf('gate.open()', paint)+ expect(banner).toBeGreaterThan(-1)+ expect(banner).toBeGreaterThan(alt)+ expect(banner).toBeGreaterThan(paint)+ // …but still before the gate releases the new session's output.+ expect(banner).toBeLessThan(gateOpen)+ })})