docs: generate Chats API docs from swagger annotations#24830
Merged
Conversation
Adds @Summary/@Router/@tags annotations to the 12 public endpoints under /api/experimental/chats so they render in the autogenerated API reference at docs/reference/api/chats.md. Replaces the hand-maintained chats-api.md with the generated reference. Authorization for the AGENTS.md exception (no swagger annotations on coderd/exp_chats.go): CODAGT-250. Endpoints documented: - GET, POST /experimental/chats - GET, PATCH /experimental/chats/{chat} - GET, POST /experimental/chats/{chat}/messages - PATCH /experimental/chats/{chat}/messages/{message} - POST /experimental/chats/{chat}/interrupt - POST /experimental/chats/{chat}/title/regenerate - GET /experimental/chats/{chat}/diff - POST /experimental/chats/files - GET /experimental/chats/files/{file} Admin endpoints (retention, usage limits, compaction thresholds, workspace overrides) and WebSocket endpoints (/stream, /watch, *.gen) remain unannotated for now and continue to use @x-apidocgen skip. Also fixes a stray emdash in codersdk.Chat.LastInjectedContext doc comment that propagated through the generated apidoc and tripped scripts/check_emdash.sh once chats.md regenerated. Generated by Coder Agent on behalf of @david-fraley.
Docs preview |
Adds @Summary/@Router/@tags annotations to the 4 chat WebSocket handlers so they render alongside the REST endpoints in the autogenerated reference: - GET /experimental/chats/watch (watchChats) - GET /experimental/chats/{chat}/stream (streamChat) - GET /experimental/chats/{chat}/stream/git (watchChatGit) - GET /experimental/chats/{chat}/stream/desktop (watchChatDesktop) Pattern matches watchWorkspaceWS in coderd/workspaces.go: swag handles WebSocket endpoints fine. Earlier 'follow-up needed' note was wrong. Generated by Coder Agent on behalf of @david-fraley.
Three changes that surface stability information for the experimental Chats API: 1. Adds @description "Experimental: this endpoint is subject to change." to all 16 chat handler annotations. swag renders the description as a paragraph below the route line on each endpoint page (same pattern as 'Get all templates' in coderd/templates.go). 2. Sets state: ["experimental"] on the Chats reference manifest entry so the docs sidebar shows a stability badge. (Companion change in coder/coder.com adds the badge style.) 3. Teaches scripts/apidocgen/postprocess/main.go to preserve existing state, description, and icon_path on REST API child entries when regenerating the manifest. Without this the badge would be wiped on the next make gen. Generated by Coder Agent on behalf of @david-fraley.
Add swagger annotations to the GET /experimental/chats/models handler. The endpoint was previously neither documented nor marked skip; this brings it into the autogenerated reference.
Collaborator
Author
|
Added swagger annotations to the
|
david-fraley
added a commit
that referenced
this pull request
Apr 30, 2026
- Drop CODER_EXPERIMENTS=agents references; the flag was removed by #24432 - Keep 'coder exp agents' per @david-fraley's direction (the API is still experimental) even though #24432 also graduated the CLI to 'coder agents' - Repoint chats-api.md link to ../../reference/api/chats.md (deletion in #24830) - Flip manifest state to beta to match the rest of /agents/ post-#24826 - Clarify that 'waiting' is both the initial idle state and the post- completion idle state in the status mapping table
johnstcn
reviewed
May 1, 2026
Addresses some notes in the swagger definitions
- interruptChat: 204 -> 200 codersdk.Chat
- postChatMessages: 201 -> 200 to match handler
- streamChat: {array} -> {object} to match watchWorkspaceWS
- chatFileByID: widen @produce to actual MIME list
- postChatFile: drop redundant Content-Type @Param
- watchChatDesktop: note raw binary stream in @description
mattvollmer
added a commit
that referenced
this pull request
May 4, 2026
…#24929) Updates `docs/ai-coder/index.md`, `docs/ai-coder/best-practices.md`, and `docs/ai-coder/ai-governance.md` to point readers at Coder Agents and the AI Governance Add-On instead of Coder Tasks and Agent Firewall (CODAGT-157). ## Changes - `docs/ai-coder/index.md`: - Rename `## Agents with Coder Tasks` to `## Coder Agents`. Drop the Devin / ChatGPT Codex name-drops and the Tasks pitch. New copy points at `./agents/index.md`, names the agent loop in the control plane, and notes that workspaces can be completely network isolated. Image swapped from `tasks-ui.png` to `agents-hero-image.png` (the hero shot added in #24915). - Replace the `## Secure Your Workflows with Agent Firewall` section with `## Govern AI activity with the AI Governance Add-On`. The new section opens with adoption-first framing (visibility, guardrails, cost) and links to `./ai-governance.md`, with bulleted callouts for AI Gateway, Agent Firewall, and the expanded Agent Workspace Build allowance the add-on bundles. - `docs/ai-coder/best-practices.md`: - In the use-case table, swap `[Tasks](./tasks.md)` to `[Coder Agents](./agents/index.md)` for the developer-led-investigation and prototyping rows, and swap the "Tasks API *(in development)*" cell to `[Coder Agents API](./agents/chats-api.md)` for the background-jobs row. Retitle the Security section link from "securing agents with Coder Tasks" to "securing AI agents" since `security.md` does not actually mention Tasks. Re-ran `markdown-table-formatter` to repad column widths. - In `## Provide Agents with Proper Context`, add a paragraph describing how context is provided in Coder Agents (admin-configured system prompts, centrally registered MCP servers, and skills shipped from repos or templates under `.agents/skills/`), with a transition line clarifying that the existing Memory and Tools subsections cover BYO-agent patterns. - `docs/ai-coder/ai-governance.md`: drop the "Additional Tasks Use (via Agent Workspace Builds)" bullet from the intro feature list and the "Expanding the use of Coder Tasks for AI-driven background work" bullet from the audience list. The `## How Coder Tasks usage is measured` section and the rest of the Tasks-related prose on this page are intentionally left for a follow-up PR. ## Notes for the reviewer - The `[Coder Agents API](./agents/chats-api.md)` link in `best-practices.md` will need to be retargeted if #24830 (which replaces `agents/chats-api.md` with auto-generated `reference/api/chats.md`) lands first. - This is the first slice of the Tasks-references audit. Remaining files (`tasks-core-principles.md`, `tasks-lifecycle.md`, `tasks-migration.md`, `cli.md`, `github-to-tasks.md`, `agent-compatibility.md`, the rest of `ai-governance.md`, `custom-agents.md`, `ai-gateway/clients/claude-code.md`, `manifest.json`, `reference/api/tasks.md`, the `task*` CLI references, the ESR upgrade guide, `feature-stages.md`, `workspace-scheduling.md`, `shared-workspaces.md`) will land in follow-up PRs against the same Linear ticket. Open PRs #24831, #24833, and #24841 cover separate slices and do not touch any file in this PR. - Validation: `markdownlint-cli2`, `markdown-table-formatter`, `scripts/check_emdash.sh`, and `make pre-commit-light` all pass. PR generated with Coder Agents.
- docs/ai-coder/agents/getting-started.md: use 'beta' wording from main, keep generated docs link from this branch - docs/manifest.json: accept 'beta' state for Extending Agents, keep Tasks to Chats Migration entry from main, keep removal of Chats API entry (replaced by generated reference) - docs/ai-coder/agents/chats-api.md: keep deleted (replaced by generated docs/reference/api/chats.md) - coderd/apidoc/docs.go, coderd/apidoc/swagger.json: regenerated via make gen
The deleted chats-api.md was referenced from best-practices.md. Retarget to the generated reference at ../reference/api/chats.md.
mattvollmer
approved these changes
May 5, 2026
Keep entries from both branches: Security & Agent Firewall and GitHub to Tasks Workflow from main, plus Tasks to Chats API Migration from this branch.
The merge from main re-introduced the chats-api.md manifest entry that this PR originally removed. Also fix trailing whitespace in best-practices.md markdown table.
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.
Adds swagger annotations to all 16 endpoints under
/api/experimental/chatsso they autogenerate intodocs/reference/api/chats.md. Replaces the hand-maintaineddocs/ai-coder/agents/chats-api.mdwith the generated reference.Authorization for the AGENTS.md exception (no swagger annotations on
coderd/exp_chats.go): CODAGT-250 (created by Cian Johnston, May Beta milestone).Endpoints documented
REST:
/experimental/chats/experimental/chats/experimental/chats/{chat}/experimental/chats/{chat}/experimental/chats/{chat}/messages/experimental/chats/{chat}/messages/experimental/chats/{chat}/messages/{message}/experimental/chats/{chat}/interrupt/experimental/chats/{chat}/title/regenerate/experimental/chats/{chat}/diff/experimental/chats/files/experimental/chats/files/{file}WebSockets (annotated like the existing
watchWorkspaceWSincoderd/workspaces.go):/experimental/chats/watch/experimental/chats/{chat}/stream/experimental/chats/{chat}/stream/git/experimental/chats/{chat}/stream/desktopIntentionally not annotated
Admin endpoints (retention config, usage limits, compaction thresholds, workspace overrides) keep their existing
@x-apidocgen {"skip": true}markers. They are not part of the May Beta integration surface.Side effect:
codersdk.Chat.LastInjectedContextdoc commentThe pre-existing emdash in this comment propagated through the regenerated apidoc and tripped
scripts/check_emdash.shoncechats.mdwas regenerated. Replaced with a comma. No semantic change; this also flows through tosite/src/api/typesGenerated.ts.Manifest and link cleanup
docs/ai-coder/agents/chats-api.md: removed.docs/manifest.json: removed the Chats API entry.docs/ai-coder/agents/getting-started.md: 3 in-prose links retargeted to../../reference/api/chats.md.coder/coder.com.Validation
make gensucceeds and is idempotent (no diff on rerun).bash scripts/check_emdash.sh: clean.pnpm exec markdownlint-cli2 'docs/ai-coder/agents/**/*.md' 'docs/reference/api/chats.md' 'docs/reference/api/schemas.md': 0 errors.python3 -c "import json; json.load(open('docs/manifest.json'))": valid.go build ./coderd/...andgo vet ./coderd/ ./codersdk/: clean.UI proof
Screenshots of the generated reference (rendered via headless Chrome from the markdown) are attached to the chat where this PR was prepared. David: please drag
chats-endpoints.pngandchats-endpoint-send-message.pnginto this description before marking ready for review. (These predate the WebSocket additions; the live page on coder.com after merge will include all 16 endpoints.)Linear and authorization context
Generated by Coder Agent on behalf of @david-fraley.