Michael Suchacz 300f73b05a test(coderd/x/chatd): cover advisor eligibility in the tool policy table (#30990)
`TestBuildTurnEnvironmentToolPolicy` ran every row with the advisor
experiment off and had no general sub-agent row, so only end-to-end
tests checked advisor eligibility and the tools that only root chats
get. This PR adds those checks to the table and deletes nothing; the PRs
above it delete the end-to-end tests.

- The rows run on a server with `ExperimentChatAdvisor`; the new
`RootAdvisorOff` row uses a second server without it. The stored advisor
config says `Enabled: true`, which must not matter: the experiment is
the only gate (`codersdk/chats.go:1277`).
- `Root` now wants the advisor, its guidance, and the five workspace and
five sub-agent tools, and rejects `propose_plan`. The new `GeneralChild`
row rejects all of those and `ask_user_question`. The plan and Explore
rows reject the advisor.
- Every row checks the guidance and the exclusive tool set: only the
advisor when the row wants it, otherwise empty.

### Why it is safe

The rows pass on `main` (`e53cfef8643`), which now includes #30911. Each
of 15 mutants of `turn_environment.go` fails a row:

| Mutant | Row that fails |
| --- | --- |
| Advisor gate ignores the experiment, the root check, plan mode, or
Explore mode | `RootAdvisorOff`, `GeneralChild`, `PlanRoot`,
`ExploreRoot` in that order |
| No advisor guidance, no advisor tool, or no exclusive set | `Root` |
| Root-only tools in every chat, or in none | `GeneralChild`, or `Root`,
`RootAdvisorOff`, `PlanRoot` |
| `ask_user_question` in standard root turns, or in child turns |
`Root`, or `GeneralChild` |
| `propose_plan` in every turn | `Root` |
| Plan children get `write_file`, or plan turns drop `read_file` |
`PlanChild` |
| Plan turns drop approved MCP tools | `PlanRoot` |

The deletion PRs above map each deleted assertion to these rows. Under
the plan and Explore gate mutants, the plan filter and the Explore
allowlist still drop the advisor tool, so those rows fail on the new
guidance and exclusive set checks.

### Review focus

Both servers are built once and never changed, and each row creates its
own chat, so the rows stay parallel.

### Timing

From 5 alternating runs, the table took 0.29 s (median) before this PR
and 0.28 s after.

### Validation

- `go test ./coderd/x/chatd/ -run '^TestBuildTurnEnvironmentToolPolicy$'
-count=10`, and with `-race -count=3`: pass
- `go test -overlay` mutant runs: results above
- the pre-commit hook (gen, fmt, lint, slim build) passed

### Stack

The stack moves advisor eligibility and the root versus child tool split
into `TestBuildTurnEnvironmentToolPolicy` and deletes the end-to-end
tests that only checked them, finishing #30868. #30911 has merged, so
the stack now starts at `main`.

1. #30990 Advisor and general child rows in the tool policy table (this
PR)
2. #30991 Remove the end-to-end advisor gating tests
3. #30992 Remove the end-to-end root and child tool list tests
4. #30993 Fold the duplicate advisor scenarios

> Xum, an AI agent, opened this PR for @ibetitsmike and wrote this
description.
2026-10-26 14:55:55 +00:00
…
…
…

Coder Logo Light Coder Logo Dark

Self-Hosted Cloud Development Environments and AI Agents

Coder Banner Light Coder Banner Dark

Quickstart | Docs | Why Coder | Premium

discord release godoc OpenSSF Best Practices OpenSSF Scorecard license Ask DeepWiki

Coder is a self-hosted platform for cloud development environments and AI coding agents. Workspaces are defined with Terraform, connected through a secure Wireguard® tunnel, and automatically shut down when not used. Coder Agents runs a native AI coding agent whose loop executes in the control plane on your infrastructure, with no API keys in workspaces.

  • Define cloud development environments in Terraform
    • EC2 VMs, Kubernetes Pods, Docker Containers, etc.
  • Automatically shutdown idle resources to save on costs
  • Onboard developers in seconds instead of days
  • Delegate coding work to AI agents on your infrastructure
    • Bring any model (Anthropic, OpenAI, Google, Bedrock, self-hosted)
    • No LLM credentials in workspaces, user identity on every action
    • Centralized model governance, cost tracking, and audit logging

Coder platform showing templates and a running workspace

Quickstart

Check out our install guides for other methods and a complete tutorial.

Try Coder with the install script on Linux and macOS, or grab the latest binary or installer from GitHub Releases on Windows:

curl -fsSL https://coder.com/install.sh | sh

Start the server and open http://localhost:3000 to create your initial user, create a Docker template, and provision your first workspace:

coder server

For a production deployment, add a PostgreSQL database (version 13 or later) and an external access URL, and see our validated architectures for sizing and infrastructure guidance:

coder server --postgres-url <url> --access-url <url>

Without these flags, Coder uses a built-in database and sets up a *.try.coder.app access URL for evaluation. Use coder --help for the full list of flags and environment variables.

Documentation

Browse the documentation or visit a specific section below:

  • Workspaces: Workspaces contain the IDEs, dependencies, and configuration information needed for software development
  • Templates: Templates are written in Terraform and describe the infrastructure for workspaces
  • Coder Agents: Delegate coding work to AI agents running on your self-hosted infrastructure
  • AI Gateway: Centralize authentication, auditing, and cost controls for AI tooling
  • Administration: Learn how to operate Coder
  • Premium: Learn about paid features built for large teams
  • IDEs: Connect your existing editor to a workspace

Support

Open an issue for bugs and feature requests.

For community support, showcasing what you built, and feedback on in-progress features, join our Discord or GitHub Discussions.

Dedicated support is included in Coder Premium. For more information, visit coder.com/pricing.

Integrations

New integrations are always in progress. Open an issue to request one. Contributions are welcome in any official or community repository.

Official

Community

Contributing

New contributors are always welcome. If you are new to the Coder codebase, see the contribution guide to get started.

Hiring

Apply on the careers page if you are interested in joining the team.

S
Description
No description provided
Readme AGPL-3.0
2.3 GiB
0 Stars 1 Watchers 0 Forks
Languages
Go 73.5%
TypeScript 24.3%
Shell 0.9%
PLpgSQL 0.3%
Go Template 0.2%
Other 0.5%