Repository navigation
docs: describe the Chats API operations and parameters - #31532
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. Part of DOCS-1439. Assisted-by: AI
Use the shared pagination wording on GET /api/v2/chats, say "sub-agent" as the glossary does, and state every case in which the chat diff is empty. 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 the 21 published Chats routes for chats, messages, queued messages, files, and per-user AI provider keys, and improves the parameters on them.
The REST API reference renders these routes from
swagger.json, and they had no description.It leaves the annotation blocks of the routes that #30125 documents (
/api/v2/chats/watch,/stream,/stream/git) and the frozenContent-Dispositionheader onPOST /api/v2/chats/{chat}/workspace-filesalone.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.Existing text fixed on routes in scope:
GET /api/v2/chatslimitsaidPage limitandafter_idsaidAfter ID. The handler defaultslimitto 50 andafter_idis a chat ID.GET /api/v2/chats/{chat}/messagesandGET /api/v2/chats/{chat}/attachmentsdescribed cursors with a raw<or>, which breaks the Markdown and MDX renderers. They now say "lower ID" and "higher ID".useron the AI provider key routes is now the sharedUser ID, username, or mewording.Verification
The
swagger.jsondiff againstorigin/mainchanges onlydescriptionvalues: 21 descriptions added and 23 parameter descriptions rewritten on 22 operations.The route list regenerated from
5c691c82c9is identical to the shared one.The remaining
THINlines are all UUID-only path IDs (chat,file,aiProvider), which the brief treats as complete.Claims checked against the code
GET /api/v2/chatscoderd/database/queries/chats.sql:627(GetChats,ORDER BYpin order thenupdated_at)GET /api/v2/chatslimitdefaults to 50, andoffsetandafter_idare the pagination cursorscoderd/database/queries/chats.sql:860,coderd/exp_chats.go:475GET /api/v2/chatssource:shared_with_meincludes shared chatscoderd/searchquery/search.go:581GET /api/v2/chatschildrencoderd/database/queries/chats.sql(parent_chat_id IS NULLinGetChats),coderd/exp_chats.go:471GET /api/v2/chatscoderd/database/dbauthz/dbauthz.go:4009GET /api/v2/chats/by-workspacecoderd/exp_chats.go:408,coderd/database/queries/chats.sql:2465,coderd/exp_chats.go:428GET /api/v2/chats/by-workspacecoderd/database/dbauthz/dbauthz.go:4028(post-filter)POST /api/v2/chatsorganization_idis requiredcoderd/exp_chats.go:1348POST /api/v2/chatsowner_idfor another user needs permission to create API keys for that user, which the Owner role hascoderd/exp_chats.go:1395,coderd/rbac/roles.go:414,codersdk/chats.go:888POST /api/v2/chats,POST /api/v2/chats/{chat}/messagesinline_mcp_serversneeds thechat-inline-mcp-serversexperimentcoderd/exp_chats.go:1519,coderd/exp_chats.go:3260,codersdk/deployment.go:5515POST /api/v2/chats/filescodersdk/chats.go:57,coderd/exp_chats.go:6964POST /api/v2/chats/filesorganizationis required, and the caller needs permission to create chats in itcoderd/exp_chats.go:6923,coderd/exp_chats.go:6937POST /api/v2/chats/filesContent-Dispositionis requiredcoderd/exp_chats.go:6990GET /api/v2/chats/files/{file}coderd/database/dbauthz/dbauthz.go:3500GET /api/v2/chats/{chat}coderd/exp_chats.go:1926,coderd/exp_chats.go:1886,codersdk/chats.go:337PATCH /api/v2/chats/{chat}readandworkspace_idcoderd/exp_chats.go:2789,coderd/exp_chats.go:2798PATCH /api/v2/chats/{chat}coderd/exp_chats.go:2951,coderd/exp_chats.go:2956PUT /api/v2/chats/{chat}/contextcoderd/x/chatd/context_hydration.go:254,codersdk/chats.go:337GET /api/v2/chats/{chat}/difforiginandbranchare set together or both omittedcoderd/exp_chats.go:4257GET /api/v2/chats/{chat}/diffdiffis empty without a matching git provider or an owner tokencoderd/exp_chats.go:4631POST /api/v2/chats/{chat}/interruptinterrupting, requires-action chats get their tool calls canceled, idle chats return409coderd/x/chatd/chat_mutations.go:713,coderd/exp_chats.go:3968GET /api/v2/chats/{chat}/messageslimit1 to 200 with default 50,after_idalone polls oldest first, queued messages only without a cursorcoderd/exp_chats.go:1987,coderd/exp_chats.go:2006,coderd/exp_chats.go:2059POST /api/v2/chats/{chat}/messagesbusy_behaviordefaults to queue withinterruptas the alternativecoderd/exp_chats.go:3210,coderd/exp_chats.go:3285,codersdk/chats.go:998PATCH /api/v2/chats/{chat}/messages/{message}coderd/exp_chats.go:3453,coderd/exp_chats.go:3546,coderd/x/chatd/chat_mutations.go:276DELETE /api/v2/chats/{chat}/queue/{queuedMessage}coderd/exp_chats.go:3621POST /api/v2/chats/{chat}/queue/{queuedMessage}/promote202responsecoderd/exp_chats.go:3677,coderd/exp_chats.go:3738,coderd/x/chatd/chat_mutations.go:558POST /api/v2/chats/{chat}/reconcile-invalid409when the chat is not invalidcoderd/x/chatd/chat_mutations.go:880,coderd/exp_chats.go:4155POST /api/v2/chats/{chat}/title/proposecoderd/exp_chats.go:4197,coderd/x/chatd/chatd.go:1055POST /api/v2/chats/{chat}/tool-results409when the chat is not waitingcoderd/exp_chats.go:9377,coderd/exp_chats.go:9393,coderd/exp_chats.go:9440GET /api/v2/users/{user}/ai-provider-keyscoderd/database/dbauthz/dbauthz.go:5507,coderd/rbac/roles.go:414,coderd/rbac/roles.go:541PUT /api/v2/users/{user}/ai-provider-keys/{aiProvider}403when--ai-gateway-allow-byokis off, fails when the provider is disabled, API key can't be empty or paddedcoderd/exp_chats.go:8087,coderd/exp_chats.go:8109,coderd/exp_chats.go:8128,codersdk/deployment.go:2118PUT,DELETE /api/v2/users/{user}/ai-provider-keys/{aiProvider}coderd/database/dbauthz/dbauthz.go:9852,coderd/database/dbauthz/dbauthz.go:2786,coderd/rbac/roles.go:541{user}routesmecoderd/coderd.go:1758(ExtractUserParam)doc-check self-check
Mode: author self-check on the branch diff.
Nothing was posted to GitHub.
The deterministic checks passed:
make lint/emdash,check_routes.pywithproblems=0, and the swagger tests.InterruptChat, and the message-edit sentence now saysdeleted_message_idsholds IDs. The chat diff sentence now lists every case wherediffis empty.word-choice.md.shared_params.py.usermatches on every branch.offset,after_id, andlimitonGET /api/v2/chatsused chat-specific wording, so they now use the shared wording with the handler's default of50.sub-agentreplaces "subagent" to match the glossary entry "Sub-agent (Coder Agents)". "Coder Agents" names the product and "chat" names the object throughout.10 MiB. The rule covers Markdown source underdocs/, and in an annotation would render as literal text inswagger.json. The other was a style preference with no rule behind it (the "toggle" wording in the user debug logging description), which never blocks.exp_chats.go(the cost description) still says "subagent". That text predates this PR and is outside the routes in scope.Writing rules applied
word-choice.mdand the glossary.Authorizecall, adbauthzmethod, andcoderd/rbac/roles.go.chat.OwnerIDin addition to RBAC.chat-inline-mcp-servers).RequireFeatureMW.word-choice.md.Part of DOCS-1439.
Generated by Coder Agents on behalf of @nickvigilante.