Revert "Preserve OpenCode session across command completion, control SessionS…" (#14943)

This reverts commit 1da1bdc01c.
This commit is contained in:
Jinjing
2026-08-16 12:33:28 -07:00
committed by GitHub
parent bf6dc6fcba
commit ef1224c4f7
10 changed files with 20 additions and 411 deletions
+2 -32
View File
@@ -10325,7 +10325,7 @@ export class OrcaRuntimeService {
this.recordTerminalSideEffectFact(ptyId, { kind: 'bell' })
return
case 'command-finished':
this.retirePtyAgentLaunchAuthorityAfterCommandFinished(ptyId)
this.retirePtyAgentLaunchAuthority(ptyId)
this.recordTerminalSideEffectFact(ptyId, {
kind: 'command-finished',
exitCode: fact.exitCode
@@ -10614,7 +10614,7 @@ export class OrcaRuntimeService {
this.confirmPtyAgentExit(ptyId)
},
onCommandFinished: (exitCode: number | null) => {
this.retirePtyAgentLaunchAuthorityAfterCommandFinished(ptyId)
this.retirePtyAgentLaunchAuthority(ptyId)
this.recordTerminalSideEffectFact(ptyId, { kind: 'command-finished', exitCode })
},
onBell: () => {
@@ -12742,36 +12742,6 @@ export class OrcaRuntimeService {
}
}
private retirePtyAgentLaunchAuthorityAfterCommandFinished(ptyId: string): void {
const pty = this.ptysById.get(ptyId)
if (pty?.launchAgent !== 'opencode') {
this.retirePtyAgentLaunchAuthority(ptyId)
return
}
const titleObservedAt = pty.lastOscTitleAt ?? null
const foregroundRead = this.readPtyForegroundProcessFromController(ptyId, titleObservedAt ?? 0)
if (!foregroundRead) {
this.retirePtyAgentLaunchAuthority(ptyId)
return
}
const incarnationId = pty.incarnationId
void foregroundRead.then((result) => {
const current = this.ptysById.get(ptyId)
if (
current !== pty ||
current.incarnationId !== incarnationId ||
current.lastOscTitleAt !== titleObservedAt ||
result.controller !== this.ptyController
) {
return
}
if (result.available && recognizeAgentProcess(result.process)?.agent === 'opencode') {
return
}
this.retirePtyAgentLaunchAuthority(ptyId)
})
}
async resolveTerminalCwd(handle: string): Promise<string | null> {
const ptyId = this.resolveLeafForHandle(handle)?.ptyId
if (!ptyId) {