Files
coder/.github/workflows
Ben Potter 2e0db07498 fix: fail the doc-check when the review workspace is dormant (#29209)
A review reuses one chat for each pull request, and that chat owns one
workspace. The workspace stops after about a day and then goes dormant.
When a later push reuses the chat, every tool call fails:

```
get workspace agents in latest build: unauthorized: rbac: forbidden
```

The review reads no files, searches no docs, and posts nothing. This job
read only the chat's terminal status, so the pull request got a green
check for a review that never ran.

Tracked in [CODAGT-1025](https://linear.app/codercom/issue/CODAGT-1025).

## How often

Measured on the deployment that runs doc-check, over 30 days:

| | |
|---|---|
| review sessions inspected | 250 |
| sessions that hit this error | 54 (21.6%), 54 distinct pull requests |
| failure on a reused chat, more than 48 h after the chat was created |
44 |
| reused chat, 6 to 48 h later | 9 |
| within 15 min of chat creation | 1 |
| first seen | 2026-07-23 |

The failing turn ran on Opus 4.8 in 49 of 54 cases, so this is not model
specific. Right now 116 of 159 review workspaces are dormant, and 20 of
those belong to open pull requests.

## What changes

A new step reads the workspace state from Coder before the chat starts.
If the workspace is dormant, the job fails, and the error and the
summary link
[CODAGT-1025](https://linear.app/codercom/issue/CODAGT-1025) and say how
to start the workspace. If Coder cannot be read, the step warns and
continues, so this never blocks a review on its own.

The prompt now tells the review what to do when a tool call fails on the
workspace, and it matches what the tools can actually do:

- stopped workspace: call `start_workspace`
- deleted workspace: `list_templates`, then `create_workspace` with the
`coder-workflow-bot` template
- dormant workspace: it cannot be repaired from inside the chat, so
stop, say the review did not happen, and post no comment

## Why the chat cannot repair a dormant workspace

A dormant workspace is a different RBAC resource.
`WorkspaceTable.RBACObject` returns `ResourceWorkspaceDormant` when
`DormantAt` is set. The chat daemon subject holds `workspace` read and
update and no `workspace_dormant` permission, so both `start_workspace`
and `create_workspace` fail on the same read before they do any work.
Full write-up, with the code paths and a suggested fix, in
[CODAGT-1025](https://linear.app/codercom/issue/CODAGT-1025).

I tested this on this pull request: with its workspace stopped and
dormant, the review called `start_workspace` twice, got `load workspace:
unauthorized: rbac: forbidden`, then stopped and posted nothing. The new
step then failed the job before the chat started, which is what the red
check on this pull request is.

## Still open

The job reads only the chat's terminal status, so a review that could
not run and a review that found nothing both report success. The dormant
case is covered here. Other failures are not.
2026-09-10 21:32:00 -05:00
..