fix(site/src): reposition org pickers in AI settings models and MCP pages to be consistent by tracyjohnsonux · Pull Request #28564 · coder/coder · GitHub
Skip to content

fix(site/src): reposition org pickers in AI settings models and MCP pages to be consistent - #28564

Merged
tracyjohnsonux merged 24 commits into
mainfrom
feat/models-org-picker-placement
Aug 26, 2026
Merged

fix(site/src): reposition org pickers in AI settings models and MCP pages to be consistent#28564
tracyjohnsonux merged 24 commits into
mainfrom
feat/models-org-picker-placement

Conversation

@tracyjohnsonux

@tracyjohnsonux tracyjohnsonux commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Repositions the organization picker on the AI settings models and MCP servers pages so it lives with the content it scopes instead of floating above the page header.

Models (/ai/settings/models)

  • The picker moved out of OrganizationModelsLayout into a shared ModelOrganizationSelect component that preserves the current path and auxiliary query params when switching orgs.
  • List page: rendered in the filter row to the right of search.
  • Add/edit model form: rendered as row 3 of the form grid at 50% width, labeled "Organization". On the edit page it is informational only (a static value, not a picker), since switching org there would 404 the model. Also rendered in the no-provider fallback and "Provider not found" states so the switcher never disappears on those pages.

MCP servers (/ai/settings/mcp-servers)

  • List page: new client-side search input (matches display name, slug, and URL) with the org picker beside it, label hidden.
  • Add/edit server form: the picker moved into the form as the third cell of the first row (slug, display name, organization), making it a 3-up.
  • OrganizationPicker now renders a static read-only value instead of a disabled button when the org cannot be changed (no handler or single org). This fixes the muted content-disabled text on the update page. The read-only rendering is shared with the models edit page via a new OrganizationValue component beside OrganizationAutocomplete.

Status columns (both list tables)

  • The visible "Status" header and the Enabled/Disabled badges are removed; both list tables drop the status column entirely. Models whose provider is deleted or disabled show a warning "Unavailable" badge (with an explanatory tooltip) beside the name.
  • Disabled models and MCP servers show a "Disabled" badge beside the name, matching the existing "Default" badge placement, and the row dims like disabled providers: avatar/icon at half opacity, text in content-disabled.
Decision log
  • ModelOrganizationSelect reuses OrganizationAutocomplete and reads accessible organizations from the models context (accessibleOrganizations added to OrganizationModelsContext), rather than duplicating the layout's navigation logic per page.
  • Navigation semantics are unchanged: switching orgs rewrites the org search param and preserves the path and remaining params, exactly as the old layout-level picker did.
  • The MCP OrganizationPicker read-only state uses an <output> element (labelable, keeps the Label association) rather than a disabled button, so non-interactive values do not render with disabled styling or sit in the tab order.
  • The add MCP server page keeps a standalone picker above the "cannot add servers" alert since the form (and its picker slot) is not rendered in that state.
  • Story review: one interaction story per new behavior. A ModelsPageView story duplicating the shared picker's select-and-navigate flow was deliberately dropped; list-page placement is covered by the OrganizationModelsLayout stories that mount the real ModelsPage. The ModelForm fallback-branch picker has no dedicated story since its sibling branch and the shared flow are covered.

Verification: pnpm lint:types, pnpm check, and all affected Storybook tests pass (ModelsPage and MCPServersPage: 140), plus the organizationModels and mcpServerFormLogic unit tests.


🤖 This PR was generated by Coder Agents on behalf of @tracyjohnsonux.

@ibetitsmike

Copy link
Copy Markdown
Collaborator

Comment thread site/src/pages/AISettingsPage/ModelsPage/components/ModelOrganizationSelect.tsx Outdated
Comment thread site/src/pages/AISettingsPage/MCPServersPage/MCPServersPageView.tsx Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb2789d1b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/pages/AISettingsPage/ModelsPage/components/ModelOrganizationSelect.tsx Outdated
Comment thread site/src/pages/AISettingsPage/MCPServersPage/components/MCPServerFormHeader.tsx Outdated
Comment thread site/src/pages/AISettingsPage/ModelsPage/components/ModelRow.tsx Outdated

@ibetitsmike ibetitsmike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclosure: This review was researched and written by Xum, an AI coding agent, acting for @ibetitsmike.

Ran the repo frontend-review skill (FE1 to FE10 from .claude/docs/FRONTEND_PATTERNS.md) over the full merge-base diff (29 files under site/src/).

FE1  FAIL  ModelsPage/components/ModelFormFields.tsx:253  interactive add-mode organization select is never rendered in any story (every form story pins a single accessible org)
FE2  PASS  no any/casts/non-null assertions; generated types used
FE3  PASS  note inline: shared OrganizationAutocomplete restyle reaches 5 consumers outside these pages
FE4  PASS  added comments carry rationale and stay factually correct
FE5  PASS  search empty state, error-state pickers, and org-keyed search reset all handled
FE6  FAIL  MCPServersPage/components/MCPServerFormHeader.tsx:89  permission-disabled switch is keyboard-unreachable and its reason undiscoverable; two smaller ARIA notes inline
FE7  PASS  query keys via chatModels/organizationsPermissions constants; no direct API calls in components
FE8  PASS  no new effects; filtering derived via useMemo
FE9  PASS  shared MockGitHubMCPServer reused; per-story inline query wiring
FE10 PASS  role/label/text queries throughout

Validation on the PR head (eb2789d): biome check --error-on-warnings clean across site/, tsc -p . clean, and PR CI is green including the Storybook interaction suite.

Out-of-title scope (status column removal, kebab menu to inline Delete, dirty-gated submit) is documented in the description and covered by updated stories, so no FE3 action needed; just noting it spans more than picker placement.

Nice touches: the Unavailable badge story asserts keyboard focus opens the tooltip without activating the row, and the dirty-gated update flow is exercised end to end with the submitted payload.

Comment thread site/src/pages/AISettingsPage/MCPServersPage/components/MCPServerFormHeader.tsx Outdated
Comment thread site/src/pages/AISettingsPage/ModelsPage/components/ModelFormFields.tsx Outdated
Comment thread site/src/components/OrganizationAutocomplete/OrganizationAutocomplete.tsx Outdated
Comment thread site/src/pages/AISettingsPage/ModelsPage/components/ModelRow.tsx Outdated
Comment thread site/src/components/OrganizationAutocomplete/OrganizationAutocomplete.tsx Outdated
const [searchParams] = useSearchParams();
const id = useId();

if (!readOnly && accessibleOrganizations.length <= 1) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: with a single accessible org the add form renders no organization field at all, while the MCP add form shows a read-only value (showSingleOrganization) and the models edit form always shows the static value via readOnly. That preserves the old layout-level behavior, but it leaves add and edit inconsistent on single-org deployments. Intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coder Agents: Kept the current behavior intentionally: add/list switchers hide for a single accessible org to match the previous layout-level behavior, while edit pages still show the static org because it explains the immutable scope. MCP add differs because its create flow already had showSingleOrganization semantics; I left models unchanged rather than expanding scope.

@tracyjohnsonux
tracyjohnsonux marked this pull request as ready for review August 25, 2026 18:26
@coderagents

coderagents Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Updates Needed

  • docs/ai-coder/agents/models.md (section "Models with a missing or disabled provider") - Addressed in 50c7d4f2f. The docs no longer reference the removed Status column and now describe the Unavailable badge (with a tooltip explaining whether the provider was deleted or disabled) beside the model name, plus the Disabled badge for disabled models. Verified against ModelRow.tsx.

Documentation to Verify

  • docs/images/guides/ai-agents/models-list.png and docs/images/guides/ai-agents/models-add-model.png (referenced in docs/ai-coder/agents/models.md) - These screenshots are still stale: the list drops the Status column and gains an organization picker in the filter row, and the add-model form gains an Organization field. Refresh them to match the new layout.

    ⚠️ Checked but no corresponding screenshot changes found in this PR

Notes:

  • MCP servers docs (docs/ai-coder/agents/platform-controls/mcp-servers.md) describe the org picker functionally and remain accurate; no change needed there.
  • Remaining changes are UI layout/presentation only (org picker placement, search inputs, read-only org rendering) with no new flags, APIs, or config, so they need no docs.

Automated review via Coder Agents

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@ibetitsmike ibetitsmike changed the title feat(site): reposition org pickers in AI settings models and MCP pages feat: reposition org pickers in AI settings models and MCP pages Aug 26, 2026

@ibetitsmike ibetitsmike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclosure: This review was researched and written by Xum, an AI coding agent, acting for @ibetitsmike.

Follow-up frontend-review audit at the current head 51c7e4d9 (supersedes the earlier FE table posted on eb2789d): all FE1-FE10 now PASS.

Adjudication of the open threads/findings, verified in code:

  • FE1 add-mode org picker story gap -> addressed in f337a74 (AddModelPageView.stories.tsx WithOrganizationPicker mounts two orgs and drives the picker; ProviderNotFound/LoadError keep it available).
  • FE6 keyboard-unreachable disabled switch (MCPServerFormHeader) -> addressed in f337a74 (aria-disabled path, switch stays reachable, tooltip restored).
  • Codex P2 (focusable Unavailable badge on a generic div) + aria-label-on-div nit -> fixed in 3103e9f8: Badge asChild wrapping a real <button type="button">, focus opens the tooltip without activating the row, story-verified.
  • Codex P1 (org switch into a no-permission org unmounts the page) -> fixed in 3103e9f8: add/duplicate selectors filter to orgs with createChatModelConfigs (story asserts unauthorized orgs are excluded); edit/list keep full selection.
  • coderagents docs check -> fixed in 50c7d4f2: models.md now documents the Unavailable/Disabled badges instead of the removed Status column.
  • <output> live-region concern -> verified fixed in 51c7e4d9: div role="group" keeps the accessible name (contains the visible text; getByLabelText queries intact) and drops the implicit role="status".
  • useMemo and shared chevron restyle threads -> verified removed/reverted in f337a74.

Transparency: commits 3103e9f8 + 50c7d4f2 were written and pushed by Xum acting for @ibetitsmike, and the PR title scope was dropped to feat: (the docs commit made the previous site scope fail contrib/title).

Status: FE-clean at current head. CI note: a GitHub Actions incident (~15:19Z) caused startup_failures and a dropped ci trigger on the previous head; contrib + docs-preview were re-run and ci is in progress on 51c7e4d9 at time of writing.

Copy link
Copy Markdown
Contributor Author

Coder Agents: Follow-up on the org selector pattern: I checked workspaces/agents/templates/users. The shared pattern is to render OrganizationAutocomplete directly and keep page-specific state/routing in the owning page or form; the chat workspace flow is the exception with its compact CompactOrgSelector. Based on that, I removed the page-specific ModelOrganizationSelect wrapper in 7a0f444f3f and inlined OrganizationAutocomplete / OrganizationValue in the Models call sites. The model-specific shared code is now limited to pure helpers in organizationModels.tsx for ?org= URL construction and creatable-org filtering.

Copy link
Copy Markdown
Contributor Author

@tracyjohnsonux
tracyjohnsonux merged commit 78c65ea into main Aug 26, 2026
29 checks passed
@tracyjohnsonux
tracyjohnsonux deleted the feat/models-org-picker-placement branch August 26, 2026 19:14
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 2026
@tracyjohnsonux
tracyjohnsonux requested a review from mtojek August 26, 2026 19:29
@tracyjohnsonux tracyjohnsonux changed the title feat: reposition org pickers in AI settings models and MCP pages fix: reposition org pickers in AI settings models and MCP pages to be consistent Aug 26, 2026
@tracyjohnsonux tracyjohnsonux changed the title fix: reposition org pickers in AI settings models and MCP pages to be consistent fix(site/src): reposition org pickers in AI settings models and MCP pages to be consistent Aug 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants