fix(agent): reap exited processes and scope process list by chat ID (#22944)

This commit is contained in:
Kyle Carberry
2026-03-12 14:51:05 -07:00
committed by GitHub
parent 322a94b23b
commit 0e1846fe2a
5 changed files with 260 additions and 17 deletions
-1
View File
@@ -2482,7 +2482,6 @@ func (p *Server) runChat(
}),
chattool.Execute(chattool.ExecuteOptions{
GetWorkspaceConn: getWorkspaceConn,
ChatID: chat.ID.String(),
}),
chattool.ProcessOutput(chattool.ProcessToolOptions{
GetWorkspaceConn: getWorkspaceConn,
+1 -6
View File
@@ -65,7 +65,6 @@ type ExecuteResult struct {
type ExecuteOptions struct {
GetWorkspaceConn func(context.Context) (workspacesdk.AgentConn, error)
DefaultTimeout time.Duration
ChatID string
}
// ProcessToolOptions configures a process management tool
@@ -97,7 +96,7 @@ func Execute(options ExecuteOptions) fantasy.AgentTool {
if err != nil {
return fantasy.NewTextErrorResponse(err.Error()), nil
}
return executeTool(ctx, conn, args, options.DefaultTimeout, options.ChatID), nil
return executeTool(ctx, conn, args, options.DefaultTimeout), nil
},
)
}
@@ -107,7 +106,6 @@ func executeTool(
conn workspacesdk.AgentConn,
args ExecuteArgs,
optTimeout time.Duration,
chatID string,
) fantasy.ToolResponse {
if args.Command == "" {
return fantasy.NewTextErrorResponse("command is required")
@@ -116,9 +114,6 @@ func executeTool(
// Build the environment map for the process request.
env := make(map[string]string, len(nonInteractiveEnvVars)+1)
env["CODER_CHAT_AGENT"] = "true"
if chatID != "" {
env["CODER_CHAT_ID"] = chatID
}
for k, v := range nonInteractiveEnvVars {
env[k] = v
}