From b1b0f12ba7ef6927e5355d2beaa4baa39608df0b Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Sun, 20 Sep 2026 23:39:43 -0400 Subject: [PATCH] refactor(terminal): say in code that a split reveal only throws on a mint A rowless adopted owner already threw one branch earlier, so the split guard was testing a condition it could not see. --- .../src/lib/terminal-reveal-tab-adoption.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/lib/terminal-reveal-tab-adoption.ts b/src/renderer/src/lib/terminal-reveal-tab-adoption.ts index 797f0467d7c..c626c3da28b 100644 --- a/src/renderer/src/lib/terminal-reveal-tab-adoption.ts +++ b/src/renderer/src/lib/terminal-reveal-tab-adoption.ts @@ -96,12 +96,15 @@ export function resolveTerminalRevealTarget( // Why: minting instead would re-bind a leaf id the orphan layout still holds. throw new Error(`terminal_reveal_owner_row_missing: tab ${adoptedTabId}`) } - const isSplitReveal = Boolean( - request.ptyId && request.tabId && request.leafId && request.splitFromLeafId - ) - // Why no lookup of its own: the hinted parent is adopted as the pty's owner across every - // worktree key, so a split never needs one — a null row here means the hint names no row at all. - if (isSplitReveal && !adoptedRow) { + // Why null and not a rowless owner, which already threw above: a split names its parent by id + // and that hint is adopted across every worktree key, so a mint means it names no row at all. + if ( + adoptedTabId === null && + request.ptyId && + request.tabId && + request.leafId && + request.splitFromLeafId + ) { throw new Error(`Terminal tab ${request.tabId} not found`) } return adoptedRow