mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
* fix(server): use terminateWithTreeKill in Claude Code provider close() The Claude Code agent's close() method only called SDK-level cleanup (query.close/interrupt/return) which may only kill the direct child process. MCP server processes spawned by the Claude CLI survived as orphans, accumulating over time and consuming significant memory. Fix: - Add onChildProcess callback to ClaudeQueryContext to capture the spawned child process reference - Store the child process in ClaudeAgentSession - In close(), call terminateWithTreeKill() after SDK cleanup to recursively terminate the entire process tree (claude + MCP children) - Use 2s graceful (SIGTERM) / 2s force (SIGKILL) timeouts, consistent with other providers (ACP, Codex, Pi, OpenCode) Co-Authored-By: Claude <noreply@anthropic.com> * fix(server): tree-kill old process during query restart to prevent MCP orphans Greptile review identified a gap: ensureQuery() replaces this.childProcess when spawning a new query without first killing the old process tree. During reconnection events, this can leak MCP children from the previous claude process. Fix: add terminateWithTreeKill() in the queryRestartNeeded block after SDK cleanup, before the replacement query spawns. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>