Moves chat model override settings from deployment scope to organization scope, following the org-scoping of chat model configs in #28440. Depends on #28440 (based on `ethan/chat-models-availability-consolidation`). Remote dogfood UAT passed on this change, including multi-organization scenarios on a licensed deployment with real models. ## Problem Chat model configs are now owned by organizations, but the override settings that reference them stayed deployment-wide: admin subagent/title/compaction overrides in `site_configs`, personal overrides in `user_configs`, and the advisor model embedded in the advisor runtime JSON. A single deployment-level override can only point at one organization's model config, so overrides effectively worked for the default organization only, and title generation had to soften its hard-failure contract to tolerate unusable overrides. ## Fix Admin overrides (general, explore, title generation, compaction, advisor) and personal overrides (root, general, explore) become organization-scoped rows in two new typed tables, `chat_organization_model_overrides` and `chat_user_model_overrides`. Composite foreign keys on `(organization_id, model_config_id)` make cross-organization model references unrepresentable. The migration deletes the legacy serialized `site_configs`/`user_configs` override keys instead of migrating them; admins and users re-select models in the new organization-scoped settings. New endpoints live under `/api/experimental/organizations/{organization}/chats/model-overrides` (admin defaults) and `/api/experimental/organizations/{organization}/members/{user}/chats/model-overrides` (personal overrides); the legacy deployment-level routes are removed. chatd resolves overrides via the chat's organization, restoring the hard-failure contract for configured-but-unusable title generation overrides. The deployment-level `AllowUsers` switch and advisor runtime limits stay deployment-scoped. The Coder Agents settings UI gains a per-organization "Defaults & overrides" page under AI Settings > Models, and the personal overrides page gains an organization selector for users in multiple organizations. Advisor telemetry now reports per-organization override rows. **BREAKING CHANGE**: Existing deployment-level overrides are dropped, not migrated. Every organization starts with no overrides after upgrade, and model selections must be re-applied in the new settings. The legacy deployment-level override endpoints are removed. Closes https://linear.app/coder/issue/CODAGT-872 > [!NOTE] > Xum (AI agent) authored this PR on behalf of @ibetitsmike. <!-- xum-attribution: model=claude-opus-4-6 thinking=high --> --------- Co-authored-by: Ethan Dickson <ethan@coder.com>
2.2 KiB
Advisor
Note
This feature is experimental. Pin a release before broad rollout and review the release notes before upgrading.
Enable the experiment
coder server --experiments=chat-advisor
Or set the environment variable:
CODER_EXPERIMENTS=chat-advisor
What it does
Lets a root agent pause its current turn and request strategic guidance from a separate, single-step model call. The advisor sees recent conversation context, runs without any tools, and returns concise advice for the root agent rather than the end user. While active, it is the only tool the root agent can call for that turn.
Useful for planning ambiguity, architectural tradeoffs, debugging strategy after repeated failures, or risk reduction before a destructive operation.
Configuration
Once the experiment is enabled, configure the advisor's runtime limits under AI Settings > Coder Agents > Advisor. These limits apply deployment-wide.
| Field | Default | Notes |
|---|---|---|
| Max uses per turn | 0 (unlimited) |
Caps how many times the root agent can call the advisor in a single chat turn. Must be a non-negative integer. |
| Max output tokens | 0 (server default) |
Caps the advisor model's response length. 0 uses the server default of 16,384 tokens. Must be a non-negative integer. |
The advisor model and its reasoning effort are organization-scoped model overrides. Configure them on the Defaults & overrides tab under AI Settings > Models for the selected organization. When no override is set, the advisor reuses the root agent's model.
The advisor is not available in plan mode or to subagents. Failed advisor invocations refund the per-turn budget.
The same configuration is available through the API: runtime limits at
GET/PUT /api/experimental/chats/config/advisor, and the advisor
model override at
PUT /api/experimental/organizations/{organization}/chats/model-overrides/advisor.