Files
coder/.github
Nick Vigilante 44285af741 ci(.github/workflows): add doc-check kill switch and auth-failure stop (#31242)
## Summary

Adds a repository-variable kill switch for doc-check, and a prompt rule
so the agent stops when GitHub authentication fails.
This is the coder/coder part of the response to the Oct 23 doc-check
token leak (same root cause as SEC-1205 and DOCS-1352).

## Changes

- The `doc-check` job now runs only when the repository variable
`DOC_CHECK_ENABLED` is `'true'`.
The gate fails closed, matching `AUDIT_DOCS_PATHS_ENABLED` in
`audit-docs-paths.yaml`.
  The `delete-workspace` cleanup job is not gated.
- New "When GitHub authentication fails" section in the chat prompt.
It tells the agent to stop, report the error, and post nothing; not to
read, decode, or print credentials; not to mint tokens; and not to
search the environment or files for a replacement credential.

> [!IMPORTANT]
> After merge, doc-check stays off until someone with repo admin sets
`DOC_CHECK_ENABLED=true`.
> The workflow is also currently disabled in the Actions UI (`gh
workflow disable`), so re-enabling needs both.
> Don't re-enable until coder/dogfood#738 is deployed.

The prompt rule is defense in depth only.
The primary fix is coder/dogfood#738, which removes the GitHub App
private key from the agent environment.

## Testing

- Rendered the `Build chat prompt` step locally with bash and confirmed
the new section appears with literal backticks.
- `actionlint`, `zizmor --offline`, and `pre-commit-light` pass.

<details>
<summary>Incident handoff steps and status</summary>

1. Stop new exposure: `doc-check.yaml` disabled in the Actions UI. Runs
that were in progress and the #31226 chat and workspace are handled
separately.
2. Land coder/dogfood#738 and confirm a new active `coder-workflow-bot`
template version. Pending review.
3. Handle token expiry for runs longer than one hour. Not decided.
4. Prompt rule and kill switch in coder/coder. **This PR.**
5. Review the `coder-doc-check[bot]` audit log for Oct 23, 23:18 to
00:19 UTC. Optionally rotate the key.
6. Record the incident on SEC-1205 and link it to DOCS-1352.

</details>

> Generated by Coder Agents on behalf of @nickvigilante.
2026-10-28 09:23:09 -05:00
..