Skip to content

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.

fix(core): anchor the no-server discriminator to tmux's own connect message

enesb0a89770ee93
diff --git a/src/core/session-memory.test.ts b/src/core/session-memory.test.ts
index 2b784a5b5..357174f57 100644
--- a/src/core/session-memory.test.ts
+++ b/src/core/session-memory.test.ts
@@ -160,6 +160,19 @@ describe('collectSessionMemory', () => {
// A socket dir we may not read says nothing about whether sessions exist there.
expect(isNoServerError('error connecting to /tmp/x (Permission denied)')).toBe(false)
expect(isNoServerError('killed: timeout')).toBe(false)
+ // The regression the anchor exists for: stderr that merely CONTAINS the errno phrase. A tmux
+ // client that cannot load a library fails this way on EVERY socket — same binary — so counting
+ // it as an answer would print "no sessions" while the already-running server holds live ones.
+ expect(
+ isNoServerError(
+ 'Command failed: tmux -L node-terminal list-panes\ntmux: error while loading shared ' +
+ 'libraries: libtinfo.so.6: cannot open shared object file: No such file or directory'
+ )
+ ).toBe(false)
+ // Same shape one layer out: a dead ssh ControlMaster, which this sweep may later run over.
+ expect(isNoServerError('Control socket connect(/tmp/cm.sock): No such file or directory')).toBe(
+ false
+ )
})
it('reports ok:false when NO socket answered', async () => {
diff --git a/src/core/session-memory.ts b/src/core/session-memory.ts
index b91a8b0ce..9d21b4a74 100644
--- a/src/core/session-memory.ts
+++ b/src/core/session-memory.ts
@@ -230,9 +230,18 @@ export function defaultProcessTableReader(): ProcEntry[] | null {
* denied)") or a timeout against a hung server is a real failure, and laundering it into "no
* sessions here" is exactly the mistake `ok:false` exists to prevent: it would print an empty
* panel over 20 live sessions. Only the two phrasings that positively assert absence count.
+ *
+ * The second alternative is ANCHORED to tmux's own connect message rather than matching a bare
+ * `no such file or directory`. `promisify(execFile)` folds stderr into `err.message`, so an
+ * unanchored errno string matches any failure that merely contains it — a tmux client missing a
+ * shared library exits 127 with "cannot open shared object file: No such file or directory" on
+ * EVERY socket (same binary), which would report "no sessions" while the server started before the
+ * breakage still runs live ones. The same string is how a dead ssh ControlMaster fails
+ * ("Control socket connect(…): No such file or directory"), which matters the moment this sweep is
+ * routed over one. tmux ships no gettext (its messages are C literals), so anchoring is safe.
*/
export function isNoServerError(message: string): boolean {
- return /no server running|no such file or directory/i.test(message)
+ return /no server running|error connecting to [^\n]*\(no such file or directory\)/i.test(message)
}
/**