feat: add status watcher to MCP server (#18320)

This is meant to complement the existing task reporter since the LLM
does not call it reliably.

It also includes refactoring to use the common agent flags/env vars.
This commit is contained in:
Asher
2025-06-13 12:53:43 -08:00
committed by GitHub
parent 5bcde58bdc
commit 4bd5609e13
12 changed files with 931 additions and 186 deletions

View File

@ -72,7 +72,14 @@ func TestTools(t *testing.T) {
})
t.Run("ReportTask", func(t *testing.T) {
tb, err := toolsdk.NewDeps(memberClient, toolsdk.WithAgentClient(agentClient), toolsdk.WithAppStatusSlug("some-agent-app"))
tb, err := toolsdk.NewDeps(memberClient, toolsdk.WithTaskReporter(func(args toolsdk.ReportTaskArgs) error {
return agentClient.PatchAppStatus(setupCtx, agentsdk.PatchAppStatus{
AppSlug: "some-agent-app",
Message: args.Summary,
URI: args.Link,
State: codersdk.WorkspaceAppStatusState(args.State),
})
}))
require.NoError(t, err)
_, err = testTool(t, toolsdk.ReportTask, tb, toolsdk.ReportTaskArgs{
Summary: "test summary",