Skip to content

feat(agents): unify settings dialog for users and admins#22914

Merged
kylecarbs merged 22 commits intomainfrom
unify-settings-dialog
Mar 10, 2026
Merged

feat(agents): unify settings dialog for users and admins#22914
kylecarbs merged 22 commits intomainfrom
unify-settings-dialog

Conversation

@kylecarbs
Copy link
Copy Markdown
Member

Summary

Refactors the admin-only "Configure Agents" dialog into a unified Settings dialog accessible to all users via a gear icon in the sidebar.

What changed

  • Settings gear in sidebar: A gear icon now appears in the bottom-left of the sidebar (next to the user avatar dropdown). Clicking it opens the Settings dialog. This replaces the admin-only "Admin" button that was in the top toolbar.

  • Custom Prompt tab (all users): A new "Custom Prompt" tab is always visible in the dialog. Users can write personal instructions that are applied to all their new chats (stored per-user via the /api/experimental/chats/config/user-prompt endpoint).

  • Admin tabs remain gated: The Providers, Models, and Behavior (system prompt) tabs only appear for admin users, preserving the existing RBAC model.

  • API + query hooks: Added getUserChatCustomPrompt / updateUserChatCustomPrompt methods to the TypeScript API client and corresponding React Query hooks.

Files changed

File Change
site/src/api/api.ts Added GET/PUT methods for user custom prompt
site/src/api/queries/chats.ts Added query/mutation hooks for user custom prompt
site/src/pages/AgentsPage/ConfigureAgentsDialog.tsx Added "Custom Prompt" tab, renamed to "Settings"
site/src/pages/AgentsPage/AgentsSidebar.tsx Added settings gear button next to user dropdown
site/src/pages/AgentsPage/AgentsPageView.tsx Removed "Admin" button, pass onOpenSettings to sidebar
site/src/pages/AgentsPage/AgentsPage.tsx Wired up user prompt state, removed admin-only guard on dialog
*.stories.tsx Updated to match new prop interfaces

Refactor the admin-only Configure Agents dialog into a unified Settings
dialog accessible to all users via a gear icon in the sidebar.

Changes:
- Add settings gear button to the bottom-left of the sidebar (next to
  user avatar)
- Remove the admin-only "Admin" button from the top toolbar
- Add "Custom Prompt" tab (always visible) for per-user instructions
- Admin-only tabs (Providers, Models, Behavior) remain gated behind
  isAgentsAdmin
- Wire up getUserChatCustomPrompt / updateUserChatCustomPrompt API
  methods and React Query hooks
- Dialog defaults to the Custom Prompt tab on open
- Rename dialog title from "Configure Agents" to "Settings"
@kylecarbs kylecarbs force-pushed the unify-settings-dialog branch from 70e5c60 to 7c913f8 Compare March 10, 2026 17:21
@coder-tasks
Copy link
Copy Markdown
Contributor

coder-tasks bot commented Mar 10, 2026

Documentation Check

Updates Needed

  • docs/ai-coder/agents/platform-controls.md - The PR adds a user-level Personal Instructions setting accessible to all users via a Settings gear icon in the sidebar. This contradicts several statements in this doc:

    • "All agent configuration is admin-level." — needs to distinguish admin-level (providers, models, system prompt) from user-level (personal instructions)
    • "Developers never need to configure anything." — no longer accurate; users can now write personal instructions
    • The "System prompt" subsection says "The system prompt configuration is only accessible to administrators in the dashboard. Developers do not see or interact with it." — true for the system prompt, but the new Settings dialog is now accessible to all users and includes a Personal Instructions input (alongside the admin-only Behavior tab)

    Suggest adding a new subsection covering the user-level personal instructions, and updating the design philosophy bullets to reflect that users now have one configurable preference.

    ⚠️ Still unaddressed through 64441aa — recent commits are UI-only (story test fix, biome formatting, scrollbar tweaks, label copy changes to "Personal/System Instructions", "Applied to" wording); no documentation changes have been included.


Automated review via Coder Tasks

- Add AdminBadge component with tooltip for content panel headers
- Use plain ShieldIcon (no tooltip) in sidebar nav items
- Render SectionHeader externally for Providers/Models with AdminBadge
- Add AdminBadge to Behavior section header
…ontent panel

- Wrap ShieldIcon in a <span> so TooltipTrigger asChild has a proper
  DOM element that can receive pointer/focus events.
- Add [scrollbar-width:thin] and matching scrollbar-color to the
  content panel's overflow container.
- Remove separate "Behavior" sidebar tab; merge system prompt into
  the "Prompts" tab below the user custom prompt, separated by an hr.
- System prompt section only renders when canSetSystemPrompt is true,
  with AdminBadge inline next to the heading.
- Set delayDuration={0} on all TooltipProvider instances so shield
  tooltips appear instantly on hover.
- Cap textareas at max-h-[240px] with thin scrollbar and minRows={4}
  so both prompts fit comfortably without the panel overflowing.
- Update stories to reflect merged tab structure.
Add badge prop to SectionHeader that renders next to the h2 label.
Switch Providers and Models headers from action to badge so the
Admin pill sits right of the title.
…no resize

- Rename "Personal Prompt" → "Personal Instructions"
- Rename "System Prompt" → "System Instructions"
- Both textareas start at minRows={1} and auto-grow
- Placeholder: "Additional behavior, style, and tone preferences"
- Remove resize handle (resize-none)
…update system placeholder

- Let react-textarea-autosize manage overflow internally so scrollbar
  hides when content does not exceed max-h-[240px].
- System instructions placeholder now reads "Additional behavior,
  style, and tone preferences for all users".
The react-textarea-autosize component sets overflow:hidden as an
inline style during height measurement. Without overflow-y-auto to
override it, content disappears when adding newlines before the
height recalculates.

Removed scrollbar-color (the explicit track/thumb colors were
making the scrollbar always visually render). Kept scrollbar-width:
thin so the scrollbar is unobtrusive when it does appear at
max-height.
- Add mocks for getUserChatCustomPrompt and updateUserChatCustomPrompt
- Update placeholder text to match new System Instructions textarea
- Handle multiple Save buttons (personal + system forms)
@kylecarbs kylecarbs requested a review from mattvollmer March 10, 2026 19:52
@kylecarbs kylecarbs enabled auto-merge (squash) March 10, 2026 19:52
@kylecarbs kylecarbs merged commit e7f8dfb into main Mar 10, 2026
25 checks passed
@kylecarbs kylecarbs deleted the unify-settings-dialog branch March 10, 2026 19:52
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants