Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit83077fd

Browse files
authored
Merge branch 'main' into main
2 parents18adf4d +e54aa44 commit83077fd

File tree

69 files changed

+1862
-2085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1862
-2085
lines changed

‎agent/agent_test.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,8 +1650,10 @@ func TestAgent_Lifecycle(t *testing.T) {
16501650
t.Run("ShutdownScriptOnce",func(t*testing.T) {
16511651
t.Parallel()
16521652
logger:=testutil.Logger(t)
1653+
ctx:=testutil.Context(t,testutil.WaitMedium)
16531654
expected:="this-is-shutdown"
16541655
derpMap,_:=tailnettest.RunDERPAndSTUN(t)
1656+
statsCh:=make(chan*proto.Stats,50)
16551657

16561658
client:=agenttest.NewClient(t,
16571659
logger,
@@ -1670,7 +1672,7 @@ func TestAgent_Lifecycle(t *testing.T) {
16701672
RunOnStop:true,
16711673
}},
16721674
},
1673-
make(chan*proto.Stats,50),
1675+
statsCh,
16741676
tailnet.NewCoordinator(logger),
16751677
)
16761678
deferclient.Close()
@@ -1695,6 +1697,11 @@ func TestAgent_Lifecycle(t *testing.T) {
16951697
returnlen(content)>0// something is in the startup log file
16961698
},testutil.WaitShort,testutil.IntervalMedium)
16971699

1700+
// In order to avoid shutting down the agent before it is fully started and triggering
1701+
// errors, we'll wait until the agent is fully up. It's a bit hokey, but among the last things the agent starts
1702+
// is the stats reporting, so getting a stats report is a good indication the agent is fully up.
1703+
_=testutil.RequireRecvCtx(ctx,t,statsCh)
1704+
16981705
err:=agent.Close()
16991706
require.NoError(t,err,"agent should be closed successfully")
17001707

‎cli/exp_mcp.go‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,21 +402,28 @@ func mcpServerHandler(inv *serpent.Invocation, client *codersdk.Client, instruct
402402
// Create a new context for the tools with all relevant information.
403403
clientCtx:=toolsdk.WithClient(ctx,client)
404404
// Get the workspace agent token from the environment.
405+
varhasAgentClientbool
405406
ifagentToken,err:=getAgentToken(fs);err==nil&&agentToken!="" {
407+
hasAgentClient=true
406408
agentClient:=agentsdk.New(client.URL)
407409
agentClient.SetSessionToken(agentToken)
408410
clientCtx=toolsdk.WithAgentClient(clientCtx,agentClient)
409411
}else {
410412
cliui.Warnf(inv.Stderr,"CODER_AGENT_TOKEN is not set, task reporting will not be available")
411413
}
412-
ifappStatusSlug!="" {
414+
ifappStatusSlug=="" {
413415
cliui.Warnf(inv.Stderr,"CODER_MCP_APP_STATUS_SLUG is not set, task reporting will not be available.")
414416
}else {
415417
clientCtx=toolsdk.WithWorkspaceAppStatusSlug(clientCtx,appStatusSlug)
416418
}
417419

418420
// Register tools based on the allowlist (if specified)
419421
for_,tool:=rangetoolsdk.All {
422+
// Skip adding the coder_report_task tool if there is no agent client
423+
if!hasAgentClient&&tool.Tool.Name=="coder_report_task" {
424+
cliui.Warnf(inv.Stderr,"Task reporting not available")
425+
continue
426+
}
420427
iflen(allowedTools)==0||slices.ContainsFunc(allowedTools,func(tstring)bool {
421428
returnt==tool.Tool.Name
422429
}) {
@@ -689,6 +696,11 @@ func getAgentToken(fs afero.Fs) (string, error) {
689696
// mcpFromSDK adapts a toolsdk.Tool to go-mcp's server.ServerTool.
690697
// It assumes that the tool responds with a valid JSON object.
691698
funcmcpFromSDK(sdkTool toolsdk.Tool[any]) server.ServerTool {
699+
// NOTE: some clients will silently refuse to use tools if there is an issue
700+
// with the tool's schema or configuration.
701+
ifsdkTool.Schema.Properties==nil {
702+
panic("developer error: schema properties cannot be nil")
703+
}
692704
return server.ServerTool{
693705
Tool: mcp.Tool{
694706
Name:sdkTool.Tool.Name,

‎cli/testdata/coder_list_--output_json.golden‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"count": 0,
6868
"available": 0,
6969
"most_recently_seen": null
70-
}
70+
},
71+
"template_version_preset_id": null
7172
},
7273
"latest_app_status": null,
7374
"outdated": false,

‎coderd/apidoc/docs.go‎

Lines changed: 13 additions & 103 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 13 additions & 93 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/coderdtest/coderdtest.go‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
421421
handler.ServeHTTP(w,r)
422422
}
423423
}))
424+
t.Logf("coderdtest server listening on %s",srv.Listener.Addr().String())
424425
srv.Config.BaseContext=func(_ net.Listener) context.Context {
425426
returnctx
426427
}
@@ -433,7 +434,12 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
433434
}else {
434435
srv.Start()
435436
}
436-
t.Cleanup(srv.Close)
437+
t.Logf("coderdtest server started on %s",srv.URL)
438+
t.Cleanup(func() {
439+
t.Logf("closing coderdtest server on %s",srv.Listener.Addr().String())
440+
srv.Close()
441+
t.Logf("closed coderdtest server on %s",srv.Listener.Addr().String())
442+
})
437443

438444
tcpAddr,ok:=srv.Listener.Addr().(*net.TCPAddr)
439445
require.True(t,ok)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp