Files
Wenxi 2cd9fadd0f feat(skills): add installation policies and persistent user choices (#16351)
## Description

Add Available, Installed by default, and Required policies for custom
skills. Store explicit opt-outs so edits and policy changes preserve
user choices. Resolve effective enablement in one database query used by
listings and runtime selection.

Keep the schema changes in one migration. Assign existing ownerless
private skills to an active admin, then require private skills to have
an owner. Permit one automatic skill per name across the organization to
keep name resolution deterministic.

This is the data and policy layer. The next PR adds API enforcement.

Share replacement expires changed relationships so all callers see
current grants. Removed the redundant policy value and scope CHECK
constraints; enum and application validation remain. The private-owner
and uniqueness constraints remain.

## How Has This Been Tested?

Validated on the complete stack: 103 focused PostgreSQL-backed tests and
238 backend unit tests passed. Applied the migration to a fresh
database. Confirmed the local kind skill, preference, and sandbox
schemas match it exactly. Pre-commit checks passed.

Latest regression pass on the complete stack: 76 PostgreSQL-backed tests
and 32 unit/contract tests passed. All changed-file pre-commit checks
passed.

## Additional Options

- [ ] [Optional] Please cherry-pick this PR to the latest release
version.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added admin-controlled installation policies for custom skills:
Available, Default, and Required.
* Required skills are automatically enabled and cannot be disabled by
users.
* Added sharing controls, permissions, ownership requirements, and
policy-aware access for custom skills.
* Added validation to prevent conflicting skill names and unsupported
private skills.

* **Bug Fixes**
  * User opt-outs now persist when disconnecting an external app.
* Deleting an external app resets its detached custom skills to
Available.

* **Documentation**
* Updated skill guidance with installation policies, sharing behavior,
and related limitations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-21 04:59:03 +00:00
..