mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(agent): reap exited processes and scope process list by chat ID (#22944)
This commit is contained in:
@@ -2482,7 +2482,6 @@ func (p *Server) runChat(
|
||||
}),
|
||||
chattool.Execute(chattool.ExecuteOptions{
|
||||
GetWorkspaceConn: getWorkspaceConn,
|
||||
ChatID: chat.ID.String(),
|
||||
}),
|
||||
chattool.ProcessOutput(chattool.ProcessToolOptions{
|
||||
GetWorkspaceConn: getWorkspaceConn,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user