fix(runtime): settle authority on unlisted shells and drop the SSH generation entry

The command-finished guard required a shell in SHELL_NAMES, so a user on
ksh/dash/tcsh/csh/ash/elvish/xonsh could never settle launched-agent hook
authority until the pty itself exited. Those are bare shells for every
consumer of the predicate, so widening the set is the correct scope.

The settle-generation Map also kept one entry per abnormally-exited SSH pty:
that branch preserves launch authority by design (unverifiable, not exited),
but the counter is bookkeeping for a check that can no longer land.
This commit is contained in:
Brennan Benson
2026-08-23 17:51:44 -07:00
parent 2ddfa13fe2
commit 0867358f37
3 changed files with 15 additions and 1 deletions
@@ -27,4 +27,12 @@ describe('shouldRetireLaunchAuthorityOnCommandFinished', () => {
expect(shouldRetireLaunchAuthorityOnCommandFinished('node')).toBe(false)
expect(shouldRetireLaunchAuthorityOnCommandFinished('python3')).toBe(false)
})
// Why: the guard requires a *known* shell, so a user on ksh/dash/tcsh could
// never settle launched-agent authority until the pty itself exited.
it.each(['ksh', 'dash', 'tcsh', 'csh', 'ash', 'mksh', 'elvish', 'xonsh'])(
'settles launch authority when the foreground shell is %s',
(shell) => {
expect(shouldRetireLaunchAuthorityOnCommandFinished(shell)).toBe(true)
}
)
})
+4
View File
@@ -15273,6 +15273,10 @@ export class OrcaRuntimeService {
this.markPtyLivenessUnverifiable(ptyId, SSH_EXIT_UNCONFIRMED_REASON)
}
this.restoredOrchestrationAuthorityByPtyId.delete(ptyId)
// Why: launch authority is deliberately preserved here (unverifiable, not
// exited), but the settle-generation counter is bookkeeping for an
// in-flight command-finished check that can no longer land.
this.launchAuthorityCommandFinishedGenerationByPtyId.delete(ptyId)
} else {
this.retirePtyAgentLaunchAuthority(ptyId)
}
+3 -1
View File
@@ -2,7 +2,9 @@
// renderer (agent-ready-wait, new-workspace). A bare shell is the negative
// signal for "is an agent running" because it garbles injected preambles.
const SHELL_NAMES = new Set(
'|bash|zsh|sh|fish|cmd|cmd.exe|powershell|powershell.exe|pwsh|pwsh.exe|nu'.split('|')
'|bash|zsh|sh|fish|cmd|cmd.exe|powershell|powershell.exe|pwsh|pwsh.exe|nu|ksh|mksh|dash|ash|tcsh|csh|elvish|xonsh'.split(
'|'
)
)
const WINDOWS_PROCESS_EXTENSION_RE = /\.(?:exe|cmd|bat|ps1)$/i