Skip to content

fix: call the chat API on /api/v2 after the experimental mounts were removed - #43

Merged
nickvigilante merged 1 commit into
mainfrom
vigilante/codagt-1136-agents-chat-action-calls-removed-apiexperimental-chat-routes
Sep 22, 2026
Merged

nickvigilante merged 1 commit into
mainfrom
vigilante/codagt-1136-agents-chat-action-calls-removed-apiexperimental-chat-routes

Conversation

@nickvigilante

Copy link
Copy Markdown
Contributor

Summary

Repoint the Coder chat API client at /api/v2.
coder/coder#29548 removed the /api/experimental duplicates of the promoted chat API once the one-release compatibility window from coder/coder#28496 closed with v2.37.0, so every run of this action against an up-to-date deployment currently fails.

This has the AI Documentation Check workflow red on all coder/coder pull requests:

Error: Failed to look up chats by reuse labels [coder-agents-chat-action:true, gh-target:coder/coder#29625, coder-agents-chat-action-workflow:AI Documentation Check]: Coder API error: Not Found

The error names the reuse labels, but the labels are fine.
The reuse lookup is simply the first call to hit the dead prefix.

Changes

  • src/coder-client.ts: move listChats, createChat, getChat, and createChatMessage from /api/experimental/chats… to /api/v2/chats….
    updateChatACL was already on /api/v2, so its now-obsolete comment about the older prefix is dropped.
  • src/coder-client.test.ts: update the endpoint assertions, and add a listChats block covering the route and the label/archived query construction.
  • src/action.ts, README.md, AGENTS.md: correct stale prose references to the experimental prefix.
  • dist/index.js: rebuilt.

Why the new test

listChats was the method that broke, and it was the only chat method with no coverage against RealCoderClient.
It was exercised solely through the fake client in test-helpers.ts, so nothing pinned its URL and the drift shipped silently.
The other four methods already had endpoint assertions, which is why this adds coverage rather than only updating it.

Testing

Run locally against bun 1.3.14, matching CI:

  • make build, make fmt-check, make lint (biome + tsc --noEmit): pass.
  • make test: 231 pass, 0 fail.
  • ./check_unstaged.sh equivalent: dist/index.js is rebuilt and committed.
    Verified the committed dist is reproducible by rebuilding pristine HEAD with bun 1.3.14 and getting a byte-identical file, so this diff contains only the intended change.
  • Confirmed zero remaining api/experimental references in source, docs, or dist.

Not exercised against a live deployment from CI; that happens when the follow-up SHA bump lands in coder/coder.

Investigation notes and decision log

How the root cause was established

  1. The error string comes from findReuseMatch in src/action.ts, which wraps any listChats failure.
    The wrapper names the labels, which made the report look like a label or reuse-scope bug.

  2. listChats in src/coder-client.ts calls GET /api/experimental/chats.

  3. coderd/chat_routes_test.go in coder/coder asserts that GET /api/experimental/chats now returns 404, under the comment "Promoted routes no longer answer on /api/experimental."

  4. coderd/chat_routes.go confirms the surviving experimental surface. registerExperimentalChatRoutes mounts only:

    • /chats/config/computer-use-provider
    • /chats/config/advisor
    • /chats/{chat}/stream/desktop
    • /chats/{chat}/debug/runs and /chats/{chat}/debug/runs/{debugRun}

    Everything else moved to /api/v2 via registerChatAPIRoutes.

Scope: four methods, not one

Because the experimental /chats group no longer registers GET /, POST /, GET /{chat}, or POST /{chat}/messages, all four of the action's chat calls were broken, not just the reuse lookup.

This ruled out the obvious stopgap: setting force-new-chat: true skips the reuse lookup, but createChat then hits the same removed prefix and the run fails anyway.
It also means a narrow one-line fix to listChats would have moved the failure rather than fixed it.

Corroboration

On coder/coder#29625, the Analyze PR for Documentation Updates Needed check failed after 7 seconds (10:58:15 to 10:58:22 UTC).
That duration is consistent with dying at the reuse lookup, before any chat is created or polled.

Timeline caveat

coder/coder#29548 merged 2026-09-21 15:42 UTC, so this breakage is about a day old.
The original report described the check as red "for a while", which suggests an earlier, separate cause may also be in play: doc-check.yaml hard-fails when the doc-check-pr-<n> workspace goes dormant, per CODAGT-1025.
This PR does not address that failure mode.

Follow-up

After release, bump the pinned action SHA in .github/workflows/doc-check.yaml in coder/coder.
That repo pins by commit SHA (currently 3e20636, v0.5.0), so this fix does not reach doc-check until that bump lands.

Resolves CODAGT-1136.

Note

Coder Agents generated this pull request on Nick Vigilante's behalf.

…removed

coder/coder#29548 removed the /api/experimental duplicates of the promoted
chat API once the one-release compatibility window from coder/coder#28496
closed with v2.37.0. The client still pointed at the old prefix, so every
run against an up-to-date deployment failed.

The reuse lookup runs before chat creation, so listChats was the first call
to 404 and the failure surfaced as "Failed to look up chats by reuse labels
... Coder API error: Not Found". createChat, getChat, and createChatMessage
were equally dead, which is why force-new-chat was not a workaround.

listChats was only ever exercised through the fake client in test-helpers,
so no test pinned its URL and the drift went unnoticed. Add coverage against
RealCoderClient for both the route and the label/archived query construction.

Fixes CODAGT-1136.
@linear-code

linear-code Bot commented Sep 22, 2026

Copy link
Copy Markdown

CODAGT-1136

@nickvigilante
nickvigilante marked this pull request as ready for review September 22, 2026 14:36
@nickvigilante
nickvigilante merged commit 9b3ac42 into main Sep 22, 2026
1 check passed
nickvigilante added a commit to coder/coder that referenced this pull request Sep 22, 2026
…/v2 fix (#29732)

## Summary

Bump the pinned `coder/agents-chat-action` SHA so doc-check actually
runs the `/api/v2` fix.

[#29548](#29548) removed
the `/api/experimental` chat mounts, and the action still called them.

[coder/agents-chat-action#43](coder/agents-chat-action#43)
repointed the client at `/api/v2` and is merged, but this workflow pins
the action by commit SHA, so doc-check kept running the broken v0.5.0
bundle.

## Changes

- `.github/workflows/doc-check.yaml`: `coder/agents-chat-action@3e20636`
(v0.5.0) to `@9b3ac42` (v0.5.1).

`v0.5.1` is a new tag cut at the post-merge commit of
coder/agents-chat-action#43.
The pin is the commit SHA, matching the existing convention for every
pinned action in this workflow.

## Evidence

Of the eight most recent `doc-check.yaml` runs, seven failed with the
stale action:

```
Failed to look up chats by reuse labels [...]: Coder API error: Not Found
```

## This does not fix every doc-check failure

The eighth recent failure has a different cause and survives this
change:

```
doc-check-pr-29440 is dormant since 2026-09-18T20:25:12Z. The review cannot run,
because a chat cannot start its own dormant workspace
```

That is the `Check the review workspace is usable` step failing per
[CODAGT-1025](https://linear.app/codercom/issue/CODAGT-1025), which is
deliberate: the step fails loudly rather than letting a review silently
read nothing.
Individual pull requests whose review workspace has gone dormant will
keep going red until CODAGT-1025 is addressed.

## Testing

- `make lint/actions/actionlint`: pass (via pre-commit).
- Full `pre-commit-light` suite: pass.
- Verified `v0.5.1` dereferences to commit
`9b3ac42d568e9206f9cd51a97789820d6935cc8d`, which is the SHA pinned
here.

End-to-end verification needs this merged, since the workflow runs the
pinned SHA from the base branch.

<details>
<summary>Investigation notes</summary>

### Why the earlier fix did not take effect

The action fix merged at 14:39 UTC, but GitHub Actions resolves `uses:`
against the pinned SHA, not the default branch.
Nothing in coder/coder changed when the action merged, so every
subsequent run still executed the v0.5.0 bundle.

### Failure classification, eight most recent runs

| Run | Failing step | Cause |
| --- | --- | --- |
| 35742517848 | Check the review workspace is usable | CODAGT-1025,
dormant workspace |
| 35741492350 | Run doc-check via Coder Agent Chat | stale pin, reuse
label 404 |
| 35741372081 | Run doc-check via Coder Agent Chat | stale pin, reuse
label 404 |
| 35741334633 | Run doc-check via Coder Agent Chat | stale pin, reuse
label 404 |
| 35741253070 | Run doc-check via Coder Agent Chat | stale pin, reuse
label 404 |
| 35740876746 | Run doc-check via Coder Agent Chat | stale pin, reuse
label 404 |
| 35740802233 | Run doc-check via Coder Agent Chat | stale pin, reuse
label 404 |
| 35740674362 | Run doc-check via Coder Agent Chat | stale pin, reuse
label 404 |

### Note on the floating tag

The repository also carries a `v0` tag, but it still points at `v0.1.0`
and is unmaintained.
This workflow pins exact SHAs, so that tag is not used here and was left
alone.

</details>

Refs
[DOCS-987](https://linear.app/codercom/issue/DOCS-987/bump-the-pinned-agents-chat-action-sha-in-doc-checkyaml-to-pick-up-the).

> [!NOTE]
> Coder Agents generated this pull request on Nick Vigilante's behalf.
@bpmct

bpmct commented Sep 29, 2026

Copy link
Copy Markdown
Member

Solid!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants