Repository navigation
refactor(site/src/pages/AgentsPage/components): split the skill editor into compound components - #31122
Conversation
|
@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. |
Chats that belong to a chat project now get the project's skills, next to personal, organization and workspace skills. They show up in the model's skill list, load through `read_skill`, and appear in a "Project skills" group in the `/` menu. - `coderd/x/skills` adds the `project` source. `MergeSkills` now takes a list of sources in merge order (personal, organization, project, workspace). Bare names stay bare unless two sources share a name, in which case they get `project/<name>` style aliases. - chatd loads project skills only when the chat owner owns the project or the project is shared with them. Role grants don't count. This is the same `usableChatProject` check that project instructions and memory use, and one check per turn covers both instructions and skills. Disabled skills are skipped. A failed load logs a warning and the turn continues without them. Subagents use their root chat's project; that lookup is now a helper shared with project instructions. - The site loads project skills for the composer on the project page and in project chats, behind the `chat-projects` experiment. `/clear` and `/compact` defer to a project skill with the same name, as they already do for other sources. When the user can't use the project, the site treats it as no project skills, like chatd, so those commands keep working and the `/` menu shows no retry prompt for project skills. That covers a 403 or 404 from the project skills request and a project missing from the user's project list, which holds only owned and shared projects, so an administrator role that can read the project doesn't count. Other failures are retried and leave the list unknown. A cached project list is also unknown while it refetches or after a failed refetch, so a share revoked since it was cached keeps those commands pending instead of deferring to stale project skills. - Docs gain a "Project skills" section in the extending agents page. `coderd/x/chatd/ARCHITECTURE.md` gains a paragraph on project skills. Dogfood UAT on this branch passed: project skills appear in the project page `/` menu and in project chats, `read_skill` loads them, disabled and deleted skills report not found, chats outside the project don't see them, and a subagent gets them through its root chat. The site reads project skills from the chat's own `project_id`, so subagent chats show them in the composer once sub-chats carry their root's project (#30683). | Project page `/` menu | `read_skill` in a project chat | | --- | --- | | <img alt="Project skills group in the project page slash menu" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30838-project-skills/pr/project-page-slash-menu.png" width="600" /> | <img alt="read_skill loading a project skill in a project chat" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30838-project-skills/pr/project-chat-read-skill.png" width="600" /> | Stack (merge top to bottom): - #30838 👈 - #30854 - #30855 - #30856 - #30861 - #30880 - #30881 - #30882 - #30884 - #31122
…ed skill helpers (#30854) Pulls the skill form body out of `SkillEditor` into a `SkillEditorForm` with no dialog wrapper, and moves the row helpers (download, delete confirmation, form values from a skill) out of `SkillsTable`/`SkillsTableView` so the project skills dialog in the next PR can reuse them. `SkillEnabledSwitch` gains a `readOnly` prop. The personal and organization skill pages behave the same, with two small fixes that came along: Save is locked while a submit is in flight, so a double click no longer sends two create requests, and the Body placeholder renders its line breaks. Stack (merge top to bottom): - #30826 - #30827 - #30838 - #30840 - #30854 👈 - #30855 - #30856 - #30861 - #30880 - #30881 - #30882 - #30884 - #31122
Adds `ProjectSkillsDialog`, the dialog for managing a chat project's skills, plus the API client methods and react-query factories for the project skill routes from #30827. Nothing opens the dialog yet; the next PR adds the entry point in the project page Details panel. - List view: "Project skills" with each skill's name, description, an enabled switch and last updated time, a row menu with Edit (View when read-only), Download and Delete, and a "No skills added yet" empty state. - New and Edit replace the list inside the same dialog and reuse `SkillEditorForm`, including paste-to-import and file upload. Name is locked when editing, and Escape asks before discarding unsaved edits. - Without update permission the dialog is read-only: no New, Delete or Save, and fields are disabled. - Create, update and delete invalidate the project skill list, so the composer `/` menu picks up changes too. A 409 (duplicate name or the 100-skill cap) is shown in the form and refreshes the list. Stack (merge top to bottom): - #30826 - #30827 - #30838 - #30840 - #30854 - #30855 👈 - #30856 - #30861 - #30880 - #30881 - #30882 - #30884 - #31122
Adds a "Skills" row to the project page Details panel. It shows "None" or the skill count (noting disabled skills) and opens the project skills dialog from #30855. Editing follows the project's `permissions.update`, the same flag that gates the instructions editor. The server computes it with the project's sharing ACL, so an `admin` sharee can edit skills, and users who can only read the project get the read-only dialog. Focus returns to the row when the dialog closes. The extending agents docs now point at the project page for managing project skills. Dogfood UAT on this stack passed: creating, editing, importing, downloading, turning off and deleting skills from the dialog; Save stays disabled until the form is valid; a duplicate name shows the 409 in the dialog; new skills show up in the project page `/` menu without a reload. The read-only dialog was checked with a stubbed projects list, before project sharing (#30439) landed. | Editor | List after saving | | --- | --- | | <img alt="New project skill editor" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30856-project-skills/pr/skill-editor.png" width="600" /> | <img alt="Project skills list after saving" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30856-project-skills/pr/skill-list.png" width="600" /> | Stack (merge top to bottom): - #30826 - #30827 - #30838 - #30840 - #30854 - #30855 - #30856 👈 - #30861 - #30880 - #30881 - #30882 - #30884 - #31122 --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Adds a structured `skill-invocation` chat part so a user message can carry an explicit skill. chatd loads that exact skill when the message is sent and puts its body into the user's prompt, so the skill always applies instead of relying on the model to notice it in `<available-skills>`. The composer chip that sends these parts comes in the next PR. - codersdk: a `skill-invocation` input part and message part with `skill_source` (`personal`, `org`, `project`, `workspace`) and `skill_name`. The resolved body is stored on the part as internal `skill_body`; it's hidden from TypeScript and stripped from every API response. - coderd rejects an unknown source or an invalid name with 400. - chatd resolves each invocation on create, send and edit with the chat owner's permissions, through the same loaders as `read_skill`: stored skills by source and name (project skills through the chat's project, with the root chat fallback for subagents) and workspace skills from the pinned context snapshot. The body is saved at send time so past turns show what the model received. A missing, disabled or unreadable skill rejects the send with 400 "Skill project/triage is not available." - The prompt renders a line saying the user invoked the skill, followed by `<invoked-skill name="project/triage">` with the sanitized body. Titles and hook prompt text show the invocation as `/project/triage`. - The site only gets no-op cases so the regenerated types compile. `coderd/x/chatd/ARCHITECTURE.md` gets a TODO for the author. Stack (merge top to bottom): - #30826 - #30827 - #30838 - #30840 - #30854 - #30855 - #30856 - #30861 👈 - #30880 - #30881 - #30882 - #30884 - #31122 - #31126 --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Choosing a skill from the `/` menu now inserts a skill chip into the composer instead of `/alias` text, and the message sends it as a structured `skill-invocation` part (#30861), so chatd loads that exact skill's body into the prompt. - A Lexical `SkillInvocationNode` renders the chip with a remove button; `/clear` and `/compact` still insert as commands, and typed `/name` text that wasn't picked from the menu still goes out as plain text (#31126 turns a typed full alias into a chip). - `buildChatInputContent` emits text and skill parts in document order, a chip-only message can be sent, drafts keep chips, and the new chat form forwards them. - `insertSkill(source, name)` on the composer handle inserts a chip at the caret without duplicating one that's already there. The project action bar later in this stack uses it. - Arrow keys step over chips instead of selecting them. Selecting a chip node dropped the browser selection, so the next keystroke landed at the start of the message; file reference chips had the same bug and get the same fix. - Copy and paste keep chips: copied text includes `/source/name`, pasting skips a chip that's already in the composer, and a chip for a skill this chat can't use is pasted as plain text. Rendering the parts in the transcript and edit flow is in the next PR. Dogfood UAT passed on this stack: picking project, personal and organization skills sends one skill part each and the agent answers from the skill body without calling `read_skill`; the caret, paste and copy cases above, drafts, `/clear`, `/compact` and the 400 for a disabled or deleted skill all behaved as expected. | Chip in the composer | Sent message in the transcript | | --- | --- | | <img alt="Skill chip in the project composer" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30880-skill-chips/pr/composer-chip.png" width="600" /> | <img alt="Skill chip in the sent message with the codeword reply" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30880-skill-chips/pr/transcript-chip.png" width="600" /> | Stack (merge top to bottom): - #30826 - #30827 - #30838 - #30840 - #30854 - #30855 - #30856 - #30861 - #30880 👈 - #30881 - #30882 - #30884 - #31122 - #31126 --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Renders `skill-invocation` parts from #30861 in the conversation. A user message shows its skill chips inline with the text, and a message with only a skill invocation is no longer treated as empty. Editing a past message restores its chips in the composer (the editable payload now carries the serialized editor state), optimistic edits keep skill parts, and queued messages show the skill. | Editing a message with a chip | Queued message | | --- | --- | | <img alt="Editing a past message restores its skill chip" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30880-skill-chips/pr/edit-chip.png" width="600" /> | <img alt="Queued message showing its skill" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30880-skill-chips/pr/queued-chip.png" width="600" /> | Stack (merge top to bottom): - #30826 - #30827 - #30838 - #30840 - #30854 - #30855 - #30856 - #30861 - #30880 - #30881 👈 - #30882 - #30884 - #31122 - #31126 --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
|
@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". |
Adds two per-skill settings that the project skills UI will expose next: - `action` marks a project skill to show as an action button above project chat composers. A `skills_action_project_only` check keeps it to project skills; the personal and organization routes reject `action` with 400. - `model_invocable` (default true, every stored source) controls automatic use. When it's false the skill is left out of `<available-skills>` and `read_skill` reports it as not found, but a structured skill invocation (a chip from the `/` menu or an action) still loads it, as long as the skill is enabled and the chat owner can read it. Workspace skills always count as model-invocable. Migration 000625 adds both columns with defaults, so existing skills keep today's behavior. The list, get, insert and update queries, `codersdk.SkillMetadata` and the create/update requests carry both fields, and the audit table tracks them. `coderd/x/chatd/ARCHITECTURE.md` gets TODO notes for the author. **NOTE**: the migration adds two columns with constant defaults and a CHECK constraint to `skills`. Stack (merge top to bottom): - #30826 - #30827 - #30838 - #30840 - #30854 - #30855 - #30856 - #30861 - #30880 - #30881 - #30882 👈 - #30884 - #31122 - #31126 --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
Exposes the two project skill settings from #30882 and adds project actions above project chat composers. - The project skill editor gets two switches, "Show as action" and "Agents can use it automatically". New skills start with actions off and automatic use on, importing a SKILL.md with `disable-model-invocation: true` starts automatic use off, and a settings-only change saves without rewriting SKILL.md. The skills list shows "Action" and "Manual only" badges. - A new `ProjectSkillActions` bar shows enabled action skills sorted by name: up to three buttons (description as tooltip), the rest under "More". Clicking one inserts that skill's chip into the composer through `insertSkill`; it doesn't start a chat, and a chip that's already there isn't duplicated. It renders nothing while loading, on error, or with no actions. - The bar appears above the project page's new-chat composer and above the composer of ongoing project chats (subagents use the root chat's project). It's hidden when the composer is read-only and behind the `chat-projects` experiment. The list refetches when the window regains focus and after a send fails because a skill is no longer available. - The extending agents docs describe both settings. Dogfood UAT passed: three buttons plus More on the project page and in ongoing chats, chips inserted without creating a chat, the agent answering from action-invoked skills (including a manual-only skill that `read_skill` can't load), the bar updating after settings changes and after a deleted skill's send failed, settings-only saves leaving SKILL.md unchanged, and no bar outside projects. | Project page actions with More open | Action chip in an ongoing chat | | --- | --- | | <img alt="Project page composer with three action buttons and More open" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30884-project-actions/pr/project-page-actions.png" width="600" /> | <img alt="Ongoing project chat with an action chip inserted" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30884-project-actions/pr/chat-actions.png" width="600" /> | | Editor switches | List badges | | --- | --- | | <img alt="Project skill editor with the two switches" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30884-project-actions/pr/editor-switches.png" width="600" /> | <img alt="Project skills list with Action and Manual only badges" src="https://raw.githubusercontent.com/coder/coder/assets/pr-30884-project-actions/pr/list-badges.png" width="600" /> | Stack (merge top to bottom): - #30826 - #30827 - #30838 - #30840 - #30854 - #30855 - #30856 - #30861 - #30880 - #30881 - #30882 - #30884 👈 - #31122 - #31126 --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
f68b943 to
5253970
Compare
…r into compound components
5253970 to
0fa2d93
Compare
|
@jaaydenh I'm removing myself as a reviewer, since I think the PR added me as a codeowner, but I don't own any of the files in this PR anymore. If you do still need my review, feel free to add me back! |
Turns
SkillEditorForminto compound components, the condition @jakehwll set when pre-approving #30854 (thread).SkillEditorFormtook 11 props. Two were render-prop slots (header(state),footer(state)) that only existed to hand{ isBusy, canSubmit, isDirty }back to the caller, three were per-field overrides (nameHint,bodyPlaceholder,showProjectSettings), and the dialog wrapper's props were anOmit<>of all that. The change lands at the top of the stack because #30855 and #30884 both reshape this API, so doing it once here avoids reworking each layer.SkillEditorFormis now a root that owns Formik, validation, the submit-settlement guard, and the file-read busy flag, and provides them through context. Callers compose named parts:SkillEditorFields,SkillEditorSubmitError,SkillEditorImport(resetsModelInvocablereplaces theshowProjectSettingsbranch in import),SkillEditorNameField(hint),SkillEditorDescriptionField,SkillEditorBodyField(placeholder),SkillEditorProjectSettings, andSkillEditorSubmitButton. Custom headers and footers read{ mode, readOnly, isBusy, canSubmit, isDirty }fromuseSkillEditorFormState(). Parts don't hide themselves when read-only; the caller decides.SkillEditoris renamedSkillEditorDialog, since a bareSkillEditoris ambiguous next to the parts.The project dialog call site, before:
After:
Behavior is unchanged and the existing tests pass without edits beyond the rename. The rendered DOM is identical: I compared
document.bodybefore and after for the personal dialog (create, edit, read-only, with a submit error) and the project dialog (create, edit with unsaved changes, read-only), so there are no screenshots. Everything stays inSkillEditor.tsxso the diff reads as moved JSX rather than file renames.Stack (merge top to bottom):