Repository navigation
feat: add organization skill opt-out controls to the dashboard - #31135
Conversation
Docs previewCheck 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. |
|
@codex review
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 718dd6d1bd
ℹ️ 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".
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a25bc4c4e
ℹ️ 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".
|
@codex review
|
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review
|
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd33c60086
ℹ️ 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".
|
@codex review
|
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review
|
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
nickvigilante
left a comment
There was a problem hiding this comment.
I had an agent go through this PR again, and it found a few issues I didn't catch the first time. They're inline below: one clarity fix, two contractions, one structure change, and a couple of nits. None of them change what the docs say, so Docs LGTM once these are addressed.
|
@codex review
|
|
@codex review
|
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
UAT accessibility finding: the read-only "Members can turn off organization skills" switch can't be reached with the keyboard For users who can view but not update organization skills (for example a site auditor), Verified in a browser as an auditor on Suggestion. For the permission case, use Found during remote UAT on PR head
|
DanielleMaywood
left a comment
There was a problem hiding this comment.
This review was performed by ai-review, an automated review bot.
5 inline findings and 1 below.
whole PR
SCOPE-1: This PR changes 1571 lines in 25 files (limit 1000). Split it into smaller PRs.
Remedy: split
Coverage
Coverage: 25 of 27 files reviewed, 2 unsupported; 22 rules.
Candidates: 348 found, 320 outside changed lines, 2 already discussed, 26 evaluated.
Findings: 6 (11 sites, 2 pre-existing sites), 0 over budget, 0 failed.
Model: deepseek/deepseek-v4.1-flash; 18 questions, 17 answered, 1 abstained (truncated 1), 18 cached; 0 uncalibrated findings held back; 0 input and 0 output tokens.
Experiments: 3 run, 0 passed, 3 vetoed, 0 unverified, 0 skipped for time.
vetoed: TYPE-1 site/src/pages/AgentsPage/components/ChatMessageInput/ChatMessageInput.tsx:744: 1 new type error, first src/pages/AgentsPage/components/ChatMessageInput/ChatMessageInput.tsx: TS2345 Argument of type 'string
vetoed: TYPE-1 site/src/pages/AgentsPage/utils/skills.ts:397: 3 new type errors, first src/pages/AgentsPage/AgentChatPage/AgentChatPage.tsx: TS2345 Argument of type 'SkillMetadata[]
vetoed: TYPE-1 site/src/pages/AgentsPage/utils/skills.ts:398: 4 new type errors, first src/pages/AgentsPage/AgentChatPage/AgentChatPage.tsx: TS2345 Argument of type 'OrganizationSkillPreferences
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
DanielleMaywood
left a comment
There was a problem hiding this comment.
This review was performed by ai-review, an automated review bot.
2 inline findings.
Coverage
Coverage: 25 of 27 files reviewed, 2 unsupported; 22 rules.
Candidates: 341 found, 319 outside changed lines, 6 already discussed, 16 evaluated.
Findings: 3 (7 sites, 0 pre-existing sites), 0 over budget, 0 failed.
Model: deepseek/deepseek-v4.1-flash; 9 questions, 9 answered, 0 abstained, 8 cached; 0 uncalibrated findings held back; 972 input and 171 output tokens.
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
22808f5 to
87eca02
Compare
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
| const description = | ||
| "Each member can turn off individual organization skills, or all of them, for their own chats."; | ||
|
|
There was a problem hiding this comment.
not a fan of this being a constant placed here. plop it into the component instead.
There was a problem hiding this comment.
Moved the description into the component in 0194358.
Xum posted this on behalf of Mike.
| export const activeOrganizationSkills = ( | ||
| skills: readonly SkillMetadata[] | undefined, | ||
| preferences: OrganizationSkillPreferences | undefined, | ||
| ): SkillMetadata[] | undefined => { | ||
| const enabledSkills = skills?.filter((skill) => skill.enabled); | ||
| // Without enabled skills there is nothing to opt out of. | ||
| if (!enabledSkills || enabledSkills.length === 0) { | ||
| return enabledSkills; | ||
| } | ||
| if (!preferences) { | ||
| return undefined; | ||
| } | ||
| if (!preferences.members_can_disable_skills) { | ||
| return enabledSkills; | ||
| } | ||
| if (preferences.all_skills_disabled) { | ||
| return []; | ||
| } | ||
| return enabledSkills.filter( | ||
| (skill) => !preferences.disabled_skill_ids.includes(skill.id), | ||
| ); | ||
| }; |
There was a problem hiding this comment.
whitespace please
There was a problem hiding this comment.
Added blank lines between the steps here in 0194358, and did the same in the other new code in this PR (the skills settings page, the master switch, the settings component and the query helpers).
Xum posted this on behalf of Mike.
| const pendingOrganizationQuery = | ||
| organizationSkillsQuery.data === undefined | ||
| ? organizationSkillsQuery | ||
| : organizationPreferencesQuery; | ||
| const isOrganizationUnresolved = | ||
| organizationQueryEnabled && organizationSkillList === undefined; | ||
| const isOrganizationLoading = | ||
| isOrganizationUnresolved && pendingOrganizationQuery.isFetching; | ||
| const isOrganizationError = | ||
| isOrganizationUnresolved && pendingOrganizationQuery.isError; |
There was a problem hiding this comment.
this just feels wrong. why do we have to do this?
There was a problem hiding this comment.
Agreed, it was too clever. The menu only knows the organization list once both the skills and the member's preferences have loaded, and the old code picked whichever request was still pending to decide between loading and error. In 0194358 it now just checks both requests: an error in either shows the error, otherwise either one fetching shows loading.
Xum posted this on behalf of Mike.
f719218 to
109bbe7
Compare
…31134) ## Stack Organization skills load into every member's Coder Agents chats in their organization, with no way for a member to opt out. This stack adds a per-organization setting that lets members turn them off for their own chats, bottom to top: 1. **#31134** data model, API, and chatd (this PR) 2. #31135 admin and member controls in the dashboard, the `/` menu, and docs ## What changes Organizations get `members_can_disable_skills`, off by default. Users who can update organization skills change it with `PUT /api/experimental/organizations/{organization}/skill-settings`, which writes an organization audit entry. Anyone who can read the organization can `GET` it. While the setting is on, each member saves their own choices with `PATCH /api/experimental/organizations/{organization}/members/{user}/skill-preferences`: `all_skills_disabled` (a master switch that also covers skills created later) and `skills`, a sparse map from skill ID to on or off. `GET` returns the setting, the master switch, and `disabled_skill_ids`. The routes follow the personal-settings rules: without `read_personal` or `update_personal` on that user the caller gets 404, a PATCH while the setting is off gets 403, and a key that is not an organization skill that member can read gets a 400 that names the key. The check runs as the member, not the caller, so an owner or user admin editing someone else's choices is held to that member's skills. Turning the setting off keeps the choices but ignores them. Migration 000636 adds the column and two tables keyed by organization membership. Both cascade when the membership goes away, and the per-skill table also cascades when the skill is deleted, so a recreated skill loads by default. chatd reads the preferences as the chat owner when it builds the skill index and when it loads a body for `read_skill` or for a structured skill invocation (#30861). A skill the member turned off is left out of the index, and both loads report it as not found, including later in a running chat. If the preferences cannot be read, turn preparation fails, as it already does when the skill metadata cannot be read. Older migration tests created organizations with `dbgen.Organization` and `GetDefaultOrganization`, which now select the new column before it exists, so they insert organizations with raw SQL instead. ## Review focus - Authorization in `coderd/organizationskillpreferences.go` and the five new dbauthz methods (`read_personal` and `update_personal` on the user, `organization_skill` update for the setting). - `GetOrganizationSkillMemberPreferencesRow.Excludes` is the one rule chatd applies; #31135 mirrors it in `activeOrganizationSkills`. ## Testing - Go tests cover the queries and cascades, dbauthz, both routes (including the audit diff and each 400 case), and chatd (index, `read_skill`, skill invocations, master switch, a change during a chat). Each new test fails with its code path removed. - Remote dogfood UAT (10 scenarios, real model) passed on the pre-split branch head `186c28d81ab`, which has the same code except the fix below. It found one issue: two spellings of one skill ID with opposite values stored a random result. The PATCH now rejects every aliased key with a 400. A second run on the stack's top head at the time, `718dd6d1bd1`, passed: every aliased form returns 400 and stores nothing, and chats leave out a skill the member turned off, including in `read_skill`. - Polish and the test audit stayed inside the implementation diff. No new dependencies. - Rebased on main as one commit. The migration is now 000636, after main's 000634 and 000635. Every organization skill load passes the chat owner, including main's skill invocation path, so `/skill` invocations honor the opt-out too. The model's skill index leaves out a skill that is not model-invocable or that the member turned off. Apart from that, the diff is unchanged. > Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.
Admins get a "Members can turn off organization skills" switch on the organization Skills settings page. While it is on, members see a master switch and a per-skill switch for each organization skill on their Agents Skills settings page, and the chat / menu and submit path ignore the skills they turned off. Docs describe the setting and the member controls.
109bbe7 to
f6e380b
Compare
Stack
Organization skills load into every member's Coder Agents chats in their organization, with no way for a member to opt out. This stack adds a per-organization setting that lets members turn them off for their own chats, bottom to top:
/menu, and docs (this PR)What changes
/ai/settings/skills): a "Members can turn off organization skills" switch above the organization's skill table, built fromSectionHeader. Users who cannot update organization skills see the switch disabled, and its description tells them they don't have permission to change it. A failed load showsErrorAlertwith a retry button, also beside the cached switch when a background refetch fails./menu and the submit path useactiveOrganizationSkills, which mirrors chatd'sExcludesrule, so a skill the member turned off is not offered and does not shadow/compactor/clear. For an organization with no enabled skills the menu does not wait for the preferences request, so a slow or failed request cannot hide the built-in commands.platform-controls/organizations.mdcovers the admin setting and lists it in the scope table;extending-agents.mdcovers the member controls and how chats load organization skills, and links to the setting.Review record
SkillEnabledSwitch, and changing that shared pattern is a follow-up. Per-skill switches show the stored choice while the master switch is off, so the choices are visible when it is turned back on. Stories keep reading query keys from the query builders, as the stories files already do onmain.186c28d81ab, on718dd6d1bd1, and on0fd2776ece4, which added the loading and error checks. The member screenshots come from these runs. The human-review fixes (the admin setting's layout, read-only state, and error alert, and the organization queries inChatMessageInput) were checked with Vitest, stories, and the Storybook screenshots above, not with another dogfood run.RetryButtonintosite/src/components/.Testing
Vitest covers the helper's truth table, the cache rules, the admin PUT body, the admin retry after a failed reload, the member PATCH bodies, the refetch after a failed write, and the
/menu skipping a turned-off skill. Stories cover the loading, error, reload error, read-only, and member states. The submit path is covered insubmitChatTurn.test.ts, which already tests an organization skill that takes over/compact, together with the helper's truth table. Each new test fails with its code path removed. The organization revocation test inAgentCreateForm.test.tsx, which came frommain, now seeds the organization's skill preferences, because the/menu waits for them before it lists organization skills. Polish and the test audit stayed inside the implementation diff. No new dependencies.