Repository navigation
docs: describe the Agents API operations and parameters - #31536
Closed
nickvigilante wants to merge 2 commits into
Closed
nickvigilante wants to merge 2 commits into
nickvigilante wants to merge 2 commits into
Conversation
The REST API reference renders these routes from swagger.json, and they had no description. This adds one to each Agents route and improves the parameter descriptions. Part of DOCS-1439. Assisted-by: AI
Part of DOCS-1439. Assisted-by: AI
Collaborator
Author
|
Combined into #31562, where this PR's changes are the commit Generated by Coder Agents on behalf of @nickvigilante. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describes 23
AgentsAPI routes and improves 22 parameters, so the REST API reference page for each route has more than a title.The reference renders from
swagger.json, and these routes had no description.The tag is the workspace agent API, so each description names the credential the route takes and which side calls it.
Merge notes
This PR doesn't touch #31473's exemption lists.
If #31473 merges first,
TestEndpointsDocumentednames each route on this PR to remove from those lists.Verification
A JSON diff of
swagger.jsonagainstorigin/mainchanges onlydescriptionvalues: 45 in total, all on routes in this PR or their parameters, and no other value differs.doc-check self-check
Ran the
doc-checkskill in author self-check mode on the branch diff, one persona at a time: Fact Checker, Continuity Editor, Copy Editor, then Skeptic on what survived. The other personas (Cartographer, Newcomer, Reader Advocate, Architect) didn't run.{workspaceagent}routes andconnectionalso accept a workspace proxy token in theCoder-External-Proxy-Tokenheader, and the text now says so (coderd/coderd.go:1865-1878,coderd/httpmw/actor.go:15-36,coderd/httpmw/workspaceproxy.go:28).GET /api/v2/workspaceagents/me/reinitsaidwait=truereturns409whenever the workspace isn't a prebuild waiting to be claimed, but a just-claimed workspace gets an event instead. The text now lists the409cases (coderd/workspaceagents.go:1719,:1765,:1776,:1805).external auth providerin four parameters now readsexternal authentication provider, matching the glossary and the route text.a Azureanda AWSare nowan Azureandan AWS.New code uses,older, andcurrentare nowUse ... instead,legacy, andother(voice and tone, describe conditions, not moments in time).reinit,coordinate, andlistening-portswent over three sentences, so each is back to three.1 MiB(the rule skips the API reference),workspace agent tokenagainstagent tokenelsewhere in the docs (no glossary entry), and sentences over 25 words (targets, not ceilings).The
workspaceagentpath parameter staysWorkspace agent IDon the 11 routes that take it, because the middleware accepts only a UUID (coderd/httpmw/workspaceagentparam.go,ParseUUIDParam).Claims checked against the code
GET /api/v2/derp-mapcoderd/coderd.go:1483(route has no auth middleware, only the/api/v2rate limiter and CLI telemetry)GET /api/v2/derp-mapcoderd/workspaceagents.go:1265(websocket.Accept),:1309(CompareDERPMaps)GET /api/v2/tailnetcoderd/workspaceagents.go:2583(AuthorizeSQLFilterwithActionSSH),:2597(websocket.Accept),coderd/coderd.go:2131(apiKeyMiddleware)GET /api/v2/tailnet,GET /api/v2/workspaceagents/{workspaceagent}/coordinate409when the deployment turns on browser-only connectionscoderd/workspaceagents.go:1364,:2553(override),enterprise/coderd/workspaceagents.go:18-22GET /api/v2/tailnetcoderd/workspaceagents.go:2625(fillCoderDesktopTelemetryreads the Coder Desktop header on this route)POST /api/v2/workspaceagents/{aws,azure,google}-instance-identitycoderd/coderd.go:1832-1836(registered before any auth middleware),coderd/workspaceresourceauth.go:220(handleAuthInstanceIDreturnsSessionToken)POST /api/v2/workspaceagents/{aws,azure,google}-instance-identitycoderd/workspaceresourceauth.go:204-216PATCH /api/v2/workspaceagents/me/app-statusUpdateAppStatuson the Agent APIcoderd/coderd.go:1143,:1845(workspaceAgentInfoisExtractWorkspaceAgentAndLatestBuild),coderd/workspaceagents.go(@Deprecatedannotation and the back-compat comment inpatchWorkspaceAgentAppStatus)PATCH /api/v2/workspaceagents/me/app-statusstatevaluesworking,idle,complete,failurecodersdk/workspaceapps.go:21-24GET /api/v2/workspaceagents/me/external-authcoderd/coderd.go:1844-1845,:1857GET /api/v2/workspaceagents/me/external-authmatchorid, not both, andlistenis presence-basedcoderd/workspaceagents.go:2162-2179(400 when both or neither,query.Has("listen"))GET /api/v2/workspaceagents/me/external-authlistencoderd/workspaceagents.go:2350,:2369(login URL response),:2457-2460(workspaceAgentsExternalAuthListenpolls)GET /api/v2/workspaceagents/me/external-authcoder external-auth access-tokencoderd/workspaceagents.go:2231,:2245(error text namescoder gitaskpassandcoder external-auth access-token)GET /api/v2/workspaceagents/me/gitauthexternal-auth, kept for legacy agentscoderd/deprecated.go(workspaceAgentsGitAuthcallsworkspaceAgentsExternalAuth),coderd/coderd.go(// Deprecated: Required to support legacy agents)GET /api/v2/workspaceagents/me/gitsshkeycodersdk/agentsdk/agentsdk.go:70-73(PrivateKey),coderd/gitsshkey.go:121POST /api/v2/workspaceagents/me/log-sourceiddoesn't create another sourcecoderd/workspaceagents.go:1621-1630(unique violation returns the existing source)PATCH /api/v2/workspaceagents/me/logs413when exceededcoderd/database/dump.sql:4092(max_logs_lengthonworkspace_agents),coderd/workspaceagents.go:236PATCH /api/v2/workspaceagents/me/logsleveldefaults toinfocoderd/workspaceagents.go:205GET /api/v2/workspaceagents/me/reinitworkspace_id,reason,owner_idcoderd/workspaceagents.go:1810(NewSSEAgentReinitTransmitter),codersdk/agentsdk/agentsdk.go:865-869GET /api/v2/workspaceagents/me/reinitwait=true, an immediate event when the claim build succeeded, and409when the workspace wasn't a prebuild, the claim build failed, or a later build replaced the claim buildcoderd/workspaceagents.go:1707(wait),:1719(not a prebuild),:1765(seeded event),:1776(claim build failed),:1805(later build){workspaceagent}routes (notpty)Coder-External-Proxy-Tokenheader, instead of a session tokencoderd/coderd.go:1865-1878(apiKeyMiddlewareOptional,ExtractWorkspaceProxy,RequireAPIKeyOrWorkspaceProxyAuth),coderd/httpmw/workspaceproxy.go:28,coderd/httpmw/actor.go:15-36GET /api/v2/workspaceagents/{workspaceagent}and the other{workspaceagent}routescoderd/coderd.go:1874(ExtractWorkspaceAgentAndWorkspaceParam),coderd/database/dbauthz/dbauthz.go:5824(GetWorkspaceAgentAndWorkspaceByIDusesfetch, which authorizesActionRead)GET /api/v2/workspaceagents/{workspaceagent}/connectioncoderd/workspaceagents.go:1216-1224,codersdk/workspacesdk/workspacesdk.go:156-161GET /api/v2/workspaceagents/{workspaceagent}/containers400unless the agent is connected, labels filter containers and not dev containerscoderd/workspaceagents.go:977,:1016GET /api/v2/workspaceagents/{workspaceagent}/containerslabelrequires all labels (key=value)coderd/workspaceagents.go:937-952,coderd/util/maps/maps.go:22-31(Subset)DELETE .../containers/devcontainers/{devcontainer}409while transitioning, stops and removes the container and deletes the sub-agent if anycoderd/workspaceagents.go:1036,agent/agentcontainers/api.go:1277,:1296,:1307,:1333,:1354,codersdk/workspaceagents.go:481-489POST .../containers/devcontainers/{devcontainer}/recreate202,409while transitioningcoderd/workspaceagents.go:1128,:1203,agent/agentcontainers/api.go:1408,:1427{devcontainer}path parameteridindevcontainersof the list responseagent/agentcontainers/api.go:1239-1244(lookup byknownDC.ID),codersdk/workspaceagents.go:494-495GET .../containers/watch400unless connectedcoderd/workspaceagents.go:853,:878,:894,:914GET .../coordinatecoderd/workspaceagents.go:1357,:1398GET .../listening-ports400unless connected, TCP only, omits ports below9, app ports, and ignored portscoderd/workspaceagents.go:733,:797-806,codersdk/workspacesdk/workspacesdk.go:60,codersdk/workspaceagents.go:447-451GET .../logsfollow,no_compressionare presence-based,afteris an integer of0or more,beforeis unused,formatisjsonortextandtextisn't supported withfollowcoderd/workspaceagents.go:407-409(follow,no_compression),:410-440(format,after), no read ofbeforein the handlerGET .../logsfollow, each WebSocket message is a JSON array of log entriescoderd/workspaceagents.go:525-528GET .../ptyreconnectUUID required,heightandwidthdefault80, optionalcommand,container,container_user,backend_typecoderd/workspaceapps/db.go:360-361,coderd/workspaceapps/proxy.go:785-790,:844GET .../startup-logslogs, kept for older clientscoderd/deprecated.go(workspaceAgentLogsDeprecatedcallsworkspaceAgentLogs)/api/v2/workspaceagents/me/*routescoderd/httpmw/workspaceagent.go:59-60(ExtractWorkspaceAgentAndLatestBuildrequires a valid agent token),coderd/coderd.go:1845Writing rules applied
api.Authorizecalls, middleware, andcoderd/rbac/roles.go.Annotation bugs noticed, not changed here
*-instance-identityroutes andGET /api/v2/derp-maplist@Security CoderSessionToken, but their handlers need no session token.GET /api/v2/workspaceagents/me/external-authand/me/gitauthmarkmatchandidas required, but the handler needs exactly one of them.GET /api/v2/workspaceagents/{workspaceagent}/containersmarkslabelas required, but the handler treats it as optional.GET /api/v2/workspaceagents/{workspaceagent}/logsand/startup-logsdocumentbefore, which the handler never reads, andstartup-logsomitsformat.POST /api/v2/workspaceagents/me/log-sourcedocuments200, but the handler returns201.GET /api/v2/workspaceagents/{workspaceagent}/coordinate,/api/v2/tailnet, and/ptyaccept query parameters (version,reconnect,height, and others) that have no@Param, so their descriptions state them instead.GET /api/v2/workspaceagents/{workspaceagent}/containers/watchdocuments a JSON response, but the route upgrades to a WebSocket.CI flakes unrelated to this change
test-go-pg (windows-2022)failedTestAPISessionRecoveryWriteDeadline/messageinagent/x/agentacp, a package this PR doesn't touch: https://github.com/coder/coder/actions/runs/40938193914/job/123674569767Part of DOCS-1439.
Generated by Coder Agents on behalf of @nickvigilante.