Fix ACP connection and thread leak (#35670)
When you switched away from an ACP thread, the `AcpThreadView` entity (and thus thread, and subprocess) was leaked. This happened because we were using `cx.processor` for the `list` state callback, which uses a strong reference. This PR changes the callback so that it holds a weak reference, and adds some tests and assertions at various levels to make sure we don't reintroduce the leak in the future. Release Notes: - N/A
This commit is contained in:
parent
f27dc7dec7
commit
b7469f5bc3
8 changed files with 73 additions and 27 deletions
|
@ -125,8 +125,7 @@ impl AgentConnection for ClaudeAgentConnection {
|
|||
session_id.clone(),
|
||||
&mcp_config_path,
|
||||
&cwd,
|
||||
)
|
||||
.await?;
|
||||
)?;
|
||||
|
||||
let pid = child.id();
|
||||
log::trace!("Spawned (pid: {})", pid);
|
||||
|
@ -262,7 +261,7 @@ enum ClaudeSessionMode {
|
|||
Resume,
|
||||
}
|
||||
|
||||
async fn spawn_claude(
|
||||
fn spawn_claude(
|
||||
command: &AgentServerCommand,
|
||||
mode: ClaudeSessionMode,
|
||||
session_id: acp::SessionId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue