From 06ee32a8b991d23da38ebed2bcceaed037b522d2 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Mon, 9 Nov 2026 22:07:33 -0500 Subject: [PATCH] perf(daemon): stop scanning launched agents' output for command-finished (#40599) --- .../daemon/sessions/session-launch-note.ts | 25 +++---------------- src/main/daemon/sessions/session.ts | 1 - 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/main/daemon/sessions/session-launch-note.ts b/src/main/daemon/sessions/session-launch-note.ts index c8be96ad8df..9ed81b8cb47 100644 --- a/src/main/daemon/sessions/session-launch-note.ts +++ b/src/main/daemon/sessions/session-launch-note.ts @@ -1,37 +1,20 @@ -import { - createOsc133CommandFinishedScanner, - type Osc133CommandFinishedScanner -} from '../../../shared/terminal/output/terminal-osc133-command-finished' import type { DaemonLaunchNote, DaemonLaunchNoteChange } from '../protocol/daemon-launch-note-protocol' -/** Main's live launch here; retired on command-finished too, since it can finish while main is down. */ +/** Main's live launch here, so a reattach after a main restart can re-arm it. + * Why no output scan: a finish while main is down is caught by reattach's foreground check. */ export class SessionLaunchNote { current: DaemonLaunchNote | null = null - private retirement: Osc133CommandFinishedScanner | null = null - - scan(data: string): void { - this.retirement?.scan(data) - } change(change: DaemonLaunchNoteChange): void { - const token = this.current?.launchToken if ('retire' in change) { - if (change.retire === token) { + if (change.retire === this.current?.launchToken) { this.current = null - this.retirement = null } return } - // Re-arming the same launch keeps the scanner, whose carry may hold a split marker. - const note = change.arm - if (note.launchToken !== token) { - this.current = note - this.retirement = createOsc133CommandFinishedScanner(() => - this.change({ retire: note.launchToken }) - ) - } + this.current = change.arm } } diff --git a/src/main/daemon/sessions/session.ts b/src/main/daemon/sessions/session.ts index 38c89f0a845..f5d84d66099 100644 --- a/src/main/daemon/sessions/session.ts +++ b/src/main/daemon/sessions/session.ts @@ -76,7 +76,6 @@ export class Session extends SessionProcessInspection { try { this.subprocess.onData((data) => { if (!this._disposed) { - this.launchNote.scan(data) this.shellReady.ingestSubprocessData(data) } })