GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add the organization skills data model by ibetitsmike · Pull Request #30609 · coder/coder

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Stack

Part of CODAGT-1341. This stack adds organization skills to Coder Agents: admins publish a skill once per organization, share it with groups or members, and chats in that organization load it next to personal and workspace skills. It replaces the 21-PR draft stack #30584 to #30604 with five PRs, bottom to top:

  1. feat: add the organization skills data model #30609 data model: one migration, queries, RBAC and dbauthz (this PR)
  2. feat: add organization skill API routes #30610 organization skill API routes and the scope-neutral SDK
  3. feat: add organization skill sharing ACL routes #30611 sharing ACL routes
  4. feat(site): add organization skill settings with a shared skills UI #30612 settings UI: shared skills table, admin page, member section
  5. feat: load organization skills in chats #30613 chats: chatd loading, / menu, docs

What changes

This PR adds the data model and authorization for organization skills. Personal skills keep working unchanged: git diff origin/main -- codersdk site shows only generated RBAC and API key scope additions (apikey_scopes_gen.go, rbacresources_gen.go, rbacresourcesGenerated.ts, the RBAC and scope unions in typesGenerated.ts) and codersdk.ResourceTypeOrganizationSkill with its friendly string. No personal route, SDK type or site component changes, and coderd/userskills_test.go changes only by mechanical constant renames.

One migration, 000621_skills (please review it closely):

  • renames user_skills to skills with its constraints, index and triggers, and recreates the cap function and delete_deleted_user_resources, whose PL/pgSQL bodies name the table;
  • adds organization_id and project_id (ON DELETE CASCADE), enabled (default true), and group_acl / user_acl (jsonb, default {}), with CHECKs for exactly one owner, ACLs that are JSON objects, and ACLs that stay empty unless an organization owns the row, plus partial unique name indexes per owner kind;
  • replaces the cap trigger with enforce_skills_per_owner_limit(): 100 rows per owner, disabled rows included, locking the owner row FOR NO KEY UPDATE so unrelated foreign key checks are not blocked;
  • adds a BEFORE DELETE trigger on organization_members that removes a departing member from user_acl on that organization's skills, so rejoining doesn't restore a direct grant;
  • adds the organization_skill resource_type and api_key_scope enum values last; nothing in the migration uses them.

The down migration undoes the three old migrations in reverse order: it drops organization and project rows and restores user_skills, its names, the cap function and user_id NOT NULL.

Authorization: a new RBAC resource organization_skill (create, read, update, delete, share). Owner and org admin get it; site and org auditors get read; members read only through the skill's ACL, which applies only to members of its organization. Skill.RBACObject() returns the organization object with both ACLs; project rows stay denied to everyone. New sqlc queries cover organization insert, get, list (SQL-filtered through GetAuthorizedOrganizationSkillMetadata and a regosql converter), update and delete, with dbauthz wrappers and the audit table entries. No routes yet.

Commits

The first commit reproduces the reviewed code from the old stack; each later commit is a labeled trim or fix.

  • baa3150e3b7 feat: add the organization skills data model. Reproduction: every non-site file this commit changes equals the reviewed old authz head 1e16b3004c4, except that the old stack's migrations 000615, 000616 and 000617 are merged into one migration (then 000615_skills, now 000621_skills) with one fixture (testdata/fixtures/000621_skills.up.sql) and one migration test (now testMigration000621Skills). At that commit, dump.sql was byte-identical to the old head's.
  • 1b84e83463a test(coderd/database): keep only the SQL paths of the org skill matrix. TestOrganizationSkillAuthorization becomes TestOrganizationSkillQueries instead of being deleted, because coverage showed it is this PR's only run of the GetAuthorizedOrganizationSkillMetadata row scan (80% to 65% without it) and of the organization update and delete queries (100% to 0%). Swapping group_acl and user_acl in the converter makes GrantedMember fail. The removed cases are decided by TestRolePermissions, TestSkillRBACObjectOrganizationACL and the dbauthz method suite.
  • e2931b412e9 test(coderd/database): fold the skill cap cases into existing coverage. The user case is covered by TestUserSkillLimit and TestUserSkillLimitConcurrentCreates; the organization case folds into ConcurrentOrganizationInsertsHonorCap, which now also checks that disabled rows count and another organization is unaffected (mutation checked); the project case stays.
  • be62aea9021 test(coderd/rbac): drop TestOrganizationSkillReadScope, covered by TestExternalScopeNames and the generated scope file.
  • 0c275ba37de merges main at 454a2fcc697, which took 000615 to 000618: it renumbers the migration to 000619 and resolves dump.sql, check_constraint.go and the generated API docs. 8f2b4b87ee2 merges main at ad85646164e, which took 000619: it renumbers the migration to 000620.
  • 5248d56b64f merges main at e7b76872098, which took 000620 (000620_audit_chat_project_instructions_resource_type): it renumbers the migration, fixture and migration test to 000621_skills (step Migration000621Skills, version 621), and resolves enterprise/audit/table.go (keeping main's AuditableChatProjectInstructions entries and the Skill entry), dump.sql and models.go (the resource_type enum gets chat_project_instructions, then organization_skill) and the regenerated schemas.md. The up and down SQL are unchanged by every renumbering.

Size

Production +549/-67, tests +728/-33, generated +881/-314; total +2158/-414. This is above the 500-line reviewer-friendly limit on purpose: Mike asked for 4 to 5 PRs instead of the 21 small ones this stack replaces.

Replaces

#30584 (rename user_skills to skills), #30585 (skill owners), #30586 (organization skill authorization).

Validation

  • Migration test: up keeps the existing personal row and its ID; down restores the user_skills names, cap function and NOT NULL, and drops organization rows; soft-deleting a user removes their skills after up, after down, and after re-up.
  • go test passed on be62aea9021, before the main merges, for coderd (skill tests), coderd/database, dbauthz, migrations, gentest, coderd/rbac/..., coderd/x/chatd, coderd/x/skills, enterprise/audit and enterprise/coderd; make lint/check-scopes passed; the four personal skills Vitest files pass unchanged.
  • On 5248d56b64f: build, vet, TestMigrate, TestMigrationChain, the migrations, database, dbauthz, gentest, rbac and enterprise/audit packages pass; make gen run twice is clean, and make pre-commit passes.
  • Remote UAT round 7 through Coder Agents passed on the whole stack; see feat: load organization skills in chats #30613's Validation for scope and findings.

Xum opened this PR on behalf of @ibetitsmike.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
ibetitsmike added 4 commits October 10, 2026 20:44
@ibetitsmike
feat: add the organization skills data model
baa3150
Rename user_skills to skills and add organization and project owners, an
enabled flag, and per-skill user and group ACL columns in one migration.
Add the organization_skill RBAC resource, scopes, audit table entry, skill
queries, and dbauthz methods. The personal skills API, SDK, and frontend
are unchanged.
@ibetitsmike
test(coderd/database): keep only the SQL paths of the org skill matrix
1b84e83
TestOrganizationSkillAuthorization becomes TestOrganizationSkillQueries.
Coverage showed it is the only PR 1 test that runs the SQL-filtered list
with rows (the regosql converter and the row scan of
GetAuthorizedOrganizationSkillMetadata) and the only one that executes
UpdateOrganizationSkillByOrganizationIDAndName and
DeleteOrganizationSkillByOrganizationIDAndName, so those stay.

Removed cases and what covers them:
- Member, OrgAuditor, OtherOrgMember list cases: same SQL predicates as
  GroupMember, GrantedMember, OrgAdmin and GrantedOutside.
- Single-row get checks: TestRolePermissions OrganizationSkill* and
  TestSkillRBACObjectOrganizationACL decide the same Rego rules, and the
  dbauthz method suite asserts the fetch authorizes read on the row.
- Read-grant write denials: TestRolePermissions
  OrganizationSkillUserACLWrite and TestSkillRBACObjectOrganizationACL.
@ibetitsmike
test(coderd/database): fold the skill cap cases into existing coverage
e2931b4
The user branch of enforce_skills_per_owner_limit is already covered by
TestUserSkillLimit and TestUserSkillLimitConcurrentCreates in coderd,
which assert the skills_per_user_limit mapping to 409. The organization
case repeated ConcurrentOrganizationInsertsHonorCap, so that test now
also proves disabled rows count toward the cap and that another
organization is unaffected. Only the project branch keeps its own case.
@ibetitsmike
test(coderd/rbac): drop the organization skill read scope test
be62aea
TestExternalScopeNames already expands every catalog entry, including
organization_skill:read, to its single site permission, and allowing a
site scope permission on an organization object is generic Authorize
behavior. The catalog entry itself is pinned by the generated
codersdk/apikey_scopes_gen.go: removing it changes the generator output.
@github-actions github-actions Bot assigned ibetitsmike Oct 11, 2026
@github-actions

github-actions Bot commented Oct 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

  • docs/admin/security/audit-logs.md
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
ibetitsmike added this pull request to stack #30614 October 11, 2026 00:29
@ibetitsmike

ibetitsmike commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T15:33:53.204324Z 5248d56 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Oct 11, 2026
View reviewed changes

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

Copy link
Copy Markdown

There was a problem hiding this comment.

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: be62aea902

ℹ️ 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/audit/request.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread coderd/database/migrations/000621_skills.up.sql Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike ibetitsmike changed the title mike/skills/data model feat: add the organization skills data model Oct 11, 2026
This was referenced Oct 11, 2026
feat: add organization skill API routes #30610
Merged
feat: add organization skill sharing ACL routes #30611
Merged
feat(site): add organization skill settings with a shared skills UI #30612
Merged
feat: load organization skills in chats #30613
Merged
@linear-code

linear-code Bot commented Oct 11, 2026

Copy link
Copy Markdown

CODAGT-1341

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike

ibetitsmike commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: be62aea902

ℹ️ 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".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 11, 2026
refactor: rename user_skills to skills #30584
Closed
feat: add organization and project owners to skills #30585
Closed
feat: add the organization_skill RBAC resource and skill queries #30586
Closed
feat: make skill types scope-neutral and add a personal skill enabled toggle #30587
Closed
feat: add organization skill read routes #30588
Closed
feat: add organization skill write routes and audit #30589
Closed
refactor(site/src/pages/AgentsPage): make skill components scope-neutral #30590
Closed
feat: add organization skill ACL queries and share organization ACL helpers #30591
Closed
feat: add organization skill ACL routes #30592
Closed
feat(coderd/x): merge skills from personal, org, and workspace sources #30593
Closed
feat(coderd/x): load organization skills in chats #30594
Closed
feat(site/src): add organization skill API methods and owner-scoped skill queries #30595
Closed
This was referenced Oct 11, 2026
refactor(site/src): parameterize the skills table by owner, copy, and edit access #30596
Closed
feat(site/src): add an enabled toggle and a view dialog to the skills table #30597
Closed
feat(site): add the organization skills settings page #30598
Closed
refactor(site/src/pages/AISettingsPage): share the ACL principal autocomplete #30599
Closed
feat(site/src): add organization skill permissions #30600
Closed
refactor(site/src/pages/AgentsPage): resolve slash menu aliases with one n-source helper #30601
Closed
feat(site/src/pages/AgentsPage): show organization skills in the slash menu #30602
Closed
feat(site/src): show organization skills on the member skills page #30603
Closed
docs(docs/ai-coder/agents): document organization skills #30604
Closed
@ibetitsmike
ibetitsmike marked this pull request as ready for review October 11, 2026 10:18
@ibetitsmike
ibetitsmike requested a review from nickvigilante as a code owner October 11, 2026 10:18
@pr-queue-manager
pr-queue-manager Bot requested a review from ThomasK33 October 11, 2026 10:19
ThomasK33
ThomasK33 approved these changes Oct 12, 2026
View reviewed changes
ibetitsmike added 2 commits October 13, 2026 09:15
@ibetitsmike
Merge main into data-model
0c275ba
@ibetitsmike
Merge main into data-model
8f2b4b8
@ibetitsmike

ibetitsmike commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 8f2b4b87ee

ℹ️ 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".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
Merge main into data-model
5248d56
@ibetitsmike

ibetitsmike commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 5248d56b64

ℹ️ 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".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
ibetitsmike merged commit b67587c into main Oct 13, 2026
36 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
ibetitsmike deleted the mike/skills/data-model branch October 13, 2026 15:51
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@ThomasK33 ThomasK33 ThomasK33 approved these changes
@nickvigilante nickvigilante Awaiting requested review from nickvigilante

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ibetitsmike ibetitsmike

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ibetitsmike @ThomasK33
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.