Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/domains/terminal/src/main/pty-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,12 @@ export function killPty(sessionId: string): boolean {
sessions.delete(sessionId)
notifySessionChange()
// Use SIGKILL (9) to forcefully terminate - SIGTERM may not kill child processes
session.pty.kill('SIGKILL')
// Wrap in try/catch: on Windows, killing an already-dead process throws
try {
session.pty.kill('SIGKILL')
} catch {
// Process already exited — not an error
}
Comment on lines +1350 to +1352
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Silent catch reduces observability

The analogous resizePty try/catch (around line 1296) records a pty.resize_failed diagnostic event before swallowing the error, which makes it possible to correlate Windows kill failures in diagnostic logs. The new catch here is completely silent.

Consider recording a warn-level diagnostic event so the condition is visible in telemetry without causing the call to fail:

Suggested change
} catch {
// Process already exited — not an error
}
} catch (error) {
// Process already exited — not an error on Windows
recordDiagnosticEvent({
level: 'warn',
source: 'pty',
event: 'pty.kill_failed',
sessionId,
taskId: session.taskId,
message: (error as Error).message
})
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/domains/terminal/src/main/pty-manager.ts
Line: 1350-1352

Comment:
**Silent catch reduces observability**

The analogous `resizePty` try/catch (around line 1296) records a `pty.resize_failed` diagnostic event before swallowing the error, which makes it possible to correlate Windows kill failures in diagnostic logs. The new catch here is completely silent.

Consider recording a `warn`-level diagnostic event so the condition is visible in telemetry without causing the call to fail:

```suggestion
  } catch (error) {
    // Process already exited — not an error on Windows
    recordDiagnosticEvent({
      level: 'warn',
      source: 'pty',
      event: 'pty.kill_failed',
      sessionId,
      taskId: session.taskId,
      message: (error as Error).message
    })
  }
```

How can I resolve this? If you propose a fix, please make it concise.

return true
}

Expand Down
Loading