## Why
The `test-go-race-pg` job fails intermittently with `WARNING: DATA RACE`
in `swag.(*Spec).ReadDoc`, on pull requests whose changes do not cause
it. It failed CI runs 43102680650 and 43103681536 on two unrelated pull
requests. A green rerun of the same commit passes, so it hides as a
flake.
## Cause
swag's `Spec.ReadDoc` writes shared state, so parallel tests that each
call it race. #31829 addressed this by reading the spec once through
`swaggerDoc`, a `sync.OnceValue`. #30122 then added
`TestSwaggerEnumsNotNarrowed` with a direct
`apidoc.SwaggerInfo.ReadDoc()` call, which races with the tests that
still read the shared value.
## What changed
`TestSwaggerEnumsNotNarrowed` calls `swaggerDoc()`, like the other
tests. It was the only direct call outside the generated
`coderd/apidoc/docs.go`.
## Reproduction
- On `main` (412d998777), `go test -race -count=20 -run
'TestSwagger|TestChatModelPathParametersFormatted' ./coderd/coderdtest/`
fails with 2 data race reports. `TestChatModelPathParametersFormatted`,
`TestSwaggerParametersValid` and `TestSwaggerEnumsNotNarrowed` fail.
- With this change, the same command passes with no data race report.
---
_Generated with [`xum`](https://github.com/coder/xum) • Model:
`anthropic:claude-sonnet-5-5` • Thinking: `xhigh`_
The API reference is generated from Swagger comments and struct tags,
and several `enums:"..."` tags narrowed a named enum type, so the docs
omitted values the server returns. For example, `User.status` listed
only `active` and `suspended`, not `dormant`, and
`TemplateVersion.warnings` listed `DEPRECATED_PARAMETERS`, which is not
a value of the type.
Remove 34 `enums` tags that narrow or duplicate a named type so the
referenced type's full value list is used. Tags that describe an
intentional subset stay: ACL role fields (which omit the `""` deleted
sentinel used only in update requests), `APIKey.scope`, and plain-string
fields. `Template.provisioner` keeps its tag because `.swaggo` replaces
`ProvisionerType` with `string`.
Also fix enum defects that break code generators:
- The provisioner jobs and daemons `status` query parameters listed
their enum twice (Swagger 2.0 requires unique `enum` items) or with the
wrong type. Both are now `[]codersdk.ProvisionerJobStatus` and
`[]codersdk.ProvisionerDaemonStatus`, matching what each handler parses,
including comma-separated values. The daemons route previously
documented job statuses, which the handler rejects with a 500.
- Replace the `_` zero placeholder of `WatchErrorCode` with `iota + 1`,
so the spec no longer lists 0 or `x-enum-varnames: ["_", ...]`. Wire
values are unchanged.
Where the narrowed tag hid values the server returns, the SDK type now
includes them: `LoginTypeOAuth2ProviderApp`, `BuildReasonAutodelete`,
and `MissingTemplateParameter` widen the generated TypeScript unions.
The dashboard attributes `autodelete` builds to Coder like other system
builds. `APIKey.login_type` and `AuthorizationCheck.action` set explicit
examples so the generated samples stay representative.
`TestSwaggerEnumsNotNarrowed` fails when a property's enum list drops
values of its named type (other than the 15 allowlisted intentional
subsets), lists a value the type lacks, or repeats a value.
Part of DOCS-1122, split from #30121.
---
🤖 Built with AI assistance.
## Why
`test-go-race-pg` fails on PRs that touch no Go product code, for
example two runs on #31782. Since #30124, two parallel tests in
`coderd/coderdtest` call swag's `Spec.ReadDoc`, which writes shared
state, so the race detector fails the whole package (`WARNING: DATA
RACE` in `swag.(*Spec).ReadDoc`, `swagger_test.go:41` and `:77`).
## What changed
`swagger_test.go` renders the spec once through `sync.OnceValue`, and
both tests read that string.
## Verification
- On `main`, `go test -race -count=20 -run
'TestSwaggerParametersValid|TestChatModelPathParametersFormatted'
./coderd/coderdtest/` reported 4 data races and failed.
- With this change, the same command passed with 0 races.
- `golangci-lint` reports 0 issues for `./coderd/coderdtest/` with both
the main and the new-code configs.
---
_Generated with [`xum`](https://github.com/coder/xum) • Model:
`anthropic:claude-opus-5-5` • Thinking: `high`_
Several parameter annotations produced a wrong or invalid spec.
- `GET /api/v2/settings/idpsync/available-fields` and `field-values`
documented a required `organization` path parameter that their URLs do
not contain. The annotations were copied from the organization-scoped
routes.
- `format(uuid)` on the `ids` array query parameter of the provisioner
jobs and daemons routes put `format: uuid` on the array rather than its
items. swag cannot set an item format, so the description now says the
IDs are UUIDs.
- Swagger 2.0 does not allow `example` on header parameters, which
failed strict validation. The `Authorization` and `Content-Disposition`
examples move to `x-example` vendor extensions, which Swagger 2.0 allows
on parameters and the docs generator uses for the curl samples.
- `TestSwaggerParametersValid` reads every path in the generated spec
and fails on a non-body parameter with `example`, an array parameter
with `format`, or a path parameter missing from its route.
Part of DOCS-1122, split from #30121.
---
🤖 Built with AI assistance.
Removes the Tasks API and task orchestration from coderd and codersdk:
the `/api/v2/tasks` handlers, task middleware and search filters, task
name generation, autobuild pause/resume logic, task notification
enqueues, telemetry, and the codersdk task types. Regenerates apidoc,
the API reference docs, and `typesGenerated.ts`.
**Breaking change:** the Tasks API is removed; requests to
`/api/v2/tasks` fail. Tasks was deprecated in v2.34.
**Stack context:** Coder Tasks removal stack (CODAGT-642): #28743
frontend → #28788 CLI → #28789 API → #28790 provisioner → #29084
notifications → #29085 build reasons → #29086 tables → #28750
permissions. The last four PRs replace the single data-drop migration
that used to live in #28750; each carries one concern and its own
migration number.
**Why:** with the UI (#28743) and CLI (#28788) gone, this deletes the
server surface. Database tables, RBAC, and notification templates stay
until the top of the stack so every layer builds and migrates
independently.
**What to scrutinize:**
- The `enable-ai-tasks` option is removed outright (review feedback):
configs still carrying `enableAITasks` fail to parse until the key is
deleted.
- provisionerdserver now writes `HasAITask: false` on template/build
flags; the column and these lines are dropped in #29085.
- `codersdk.ResourceTypeTask` stays so audit logs recorded before the
removal keep rendering.
**Validation:** `go build ./...`, `go vet ./...`, `go test
./codersdk/...`, site biome and tsc, CLI goldens regenerated, pre-commit
hooks.
**Size:** +242/-10,792 over 76 files; additions are regenerated
docs/goldens and test fixture updates.
> Created by Xum (AI agent) on behalf of @ibetitsmike.
## Stack context
This is the base of a 3-PR stack promoting the chat API from
`/api/experimental` to `/api/v2`: server compatibility mounts (this PR),
codersdk promotion (#28497), and frontend path updates (#28498).
## Summary
Double-mount the stable chat and MCP handlers under `/api/v2` while
retaining the existing experimental routes for the one-release
compatibility window decided in CODAGT-921. CODAGT-922 tracks removing
the compatibility mounts.
The shared route builders preserve existing authentication and
middleware behavior. Experiment-gated, debug, tombstone, and legacy
default-organization model routes remain experimental-only. Signed file
URLs, external OAuth callback URLs, and mixed-version replica relays
also remain on the experimental prefix during the transition.
Update Swagger and the generated API reference for the promoted routes,
including the workspace lookup and a runnable raw-body chat file upload
example. Retain internal endpoints outside the published reference,
share chat-file rate limits across both prefixes, enable CORS for the v2
MCP routes, and cover dual mounts plus exclusions with compatibility
tests. Remote dogfood UAT passed for the promoted chat, model, MCP, and
file flows.
> [!NOTE]
> Xum acted on Mike's behalf in this pull request.
<!-- xum-attribution: model=claude-fable-5 thinking=high -->
<!--
If you have used AI to produce some or all of this PR, please ensure you have read our [AI Contribution guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) before submitting.
-->
relates to GRU-18
Adds basic implementation for Workspace Agent Connection Watch and tests.
Missing are handling of logs.
* chore: add /v2 to import module path
go mod requires semantic versioning with versions greater than 1.x
This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```
Migrate generated files to import /v2
* Fix gen