docs(codex): correct two inaccurate comments on the pane input gate

Both were added by this PR onto the gate whose false positives silently kill a
pane's keyboard, so a wrong mental model here is expensive.

`tab.ptyId` does not name the pane that bound last: `updateTabPtyId` keeps the
first binder (`currentTabPtyId ?? nextPtyIds[0]`, "later split-pane spawns must
not steal it") and only `clearTabPtyId` demotes it to the last survivor. And a
keystroke on an unbound pane does not arm recovery against `tab.ptyId` —
`requestTerminalPaneRecovery` targets `ptyIdsByTabId[tabId][0]`, which diverges
from `tab.ptyId` in split tabs.

The reasoning the fixes rest on is unchanged: `tab.ptyId` holds *some sibling's*
id rather than this pane's, which is what makes it wrong to gate a bound pane on.
Comments only — no behavior change.
This commit is contained in:
Brennan Benson
2026-07-26 17:58:23 -07:00
parent e576362f58
commit 841c7882a8
@@ -828,16 +828,17 @@ function isCodexPaneStale(args: {
return false
}
// Why: a bound pane's own record is the last word — its ptyId is exactly the
// shell its keystrokes reach. `tab.ptyId` names whichever pane bound last, so
// in a split tab consulting it would kill this pane's keyboard over a
// sibling's notice, with no prompt on screen once that sibling is answered.
// shell its keystrokes reach. `tab.ptyId` holds one sibling's id, not this
// pane's, so in a split tab consulting it would kill this pane's keyboard over
// that sibling's notice, with no prompt on screen once the sibling is answered.
if (args.panePtyId) {
return blocksCodexPaneInput(codexRestartNoticeByPtyId[args.panePtyId])
}
// Why: only an unbound pane needs the tab's persisted id. Both transports
// refuse writes while their pty binding is null, so a keystroke here arms
// recovery, which reattaches to that id — the shell this pane is about to own.
// recovery — a coarser signal than a bound pane's own record, but the tab's id
// is the only evidence available of which shell this pane is about to own.
const tab = (state.tabsByWorktree[args.worktreeId] ?? []).find((entry) => entry.id === args.tabId)
if (tab?.ptyId && blocksCodexPaneInput(codexRestartNoticeByPtyId[tab.ptyId])) {
return true