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.

test(pane): close two mutation survivors

enesd7364eb0c5fb
diff --git a/src/core/agents/pane-owner.ts b/src/core/agents/pane-owner.ts
index 5865ce653..1119cafb6 100644
--- a/src/core/agents/pane-owner.ts
+++ b/src/core/agents/pane-owner.ts
@@ -187,8 +187,10 @@ export function paneOwnerFrom(
): PaneOwner | null {
if (!identity) return null
const pgid = foregroundPgid(psStdout)
- if (pgid === null) return null
- const argv = parseForegroundArgv(psStdout, pgid)
+ const argv = pgid === null ? [] : parseForegroundArgv(psStdout, pgid)
+ // The ONE null-vs-owner decision, deliberately not two: "no foreground group marked" and "no rows
+ // in it" are the same fact — we could not see who owns the pane — and a second guard for the
+ // second phrasing would be a line no test can reach.
if (argv.length === 0) return null
return { ...identity, argv }
}
diff --git a/src/shared/agents/pane-owner-predicate.test.ts b/src/shared/agents/pane-owner-predicate.test.ts
index 350185e06..175f001bb 100644
--- a/src/shared/agents/pane-owner-predicate.test.ts
+++ b/src/shared/agents/pane-owner-predicate.test.ts
@@ -64,6 +64,10 @@ describe('isAgentPane', () => {
expect(isAgentPane(owner(['node /home/u/.local/share/npm/bin/claude']), 'claude')).toBe('agent')
expect(isAgentPane(owner(['bun /opt/bin/codex mcp']), 'codex')).toBe('agent')
expect(isAgentPane(owner(['node --inspect claude']), 'claude')).toBe('not-agent')
+ // An OPTION that reads like the agent once the login-shell dash is stripped. This is the case
+ // the "next token must not start with -" rule exists for: without it, `-claude` basenames to
+ // `claude` and an interpreter flag is mistaken for the script it is not.
+ expect(isAgentPane(owner(['node -claude']), 'claude')).toBe('not-agent')
})
it('answers unknown for a custom agent whose binary nothing can name', () => {