Skip to content

feat(site): pin skills to a chat from the composer - #240

Merged
ibetitsmike merged 14 commits into
mainfrom
mike/chat-pinned-skills-ui
Nov 12, 2026
Merged

ibetitsmike merged 14 commits into
mainfrom
mike/chat-pinned-skills-ui

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of Mike.

Adds the composer UI for pinned skills from #237. With the fork-pinned-skills experiment on, the composer shows a "Pinned skills" pill. Its popover lists the chat's pins as chips and has a searchable picker of the skills the chat can load. Each change sends the whole list with PUT /api/v2/chats/fork/{chat}/pinned-skills.

  • api/forkChatPinnedSkills.ts and api/queries/forkChatPinnedSkills.ts: the GET/PUT calls and react-query options. The mutation writes the returned list into the query cache.
  • ForkPinnedSkillsPill.tsx: the pill, split into ForkPinnedSkillsPillView for stories and a container that runs the queries. Only the chat owner (canManageChat) gets removable chips and the picker; others see read-only chips. Chip removal and the picker are disabled while a save is pending. The picker allows at most MAX_PINNED_SKILLS_PER_CHAT (8) pins, the backend limit. A failed skill source shows an error with retry.
  • ForkComposerSlot.tsx renders the pill. Upstream hook lines: AgentChatInput.tsx forwards workspaceSkills to the slot; SkillChip.tsx and FileReferenceChip.tsx gain an optional disabled prop on the remove button.
  • ForkPinnedSkillsPill.stories.tsx: collapsed, expanded, loading, load error, none pinned, read-only, saving, pin limit, skill load error, skills partly loaded and no skills available.
  • ForkComposerSlot.test.tsx: no request while the experiment is off; pinning sends the existing pins plus the picked skill; removing a chip sends the rest; chip removal is disabled while a save is pending.

Known gaps:

  • The code that gathers the four skill sources repeats about 25 lines from AgentChatPage.tsx, because the fork keeps it out of upstream files.
  • The unpin button is labelled "Remove skill ...", the label of the reused chip.

Validation on 8a90182:

  • In a container: pnpm install --frozen-lockfile, biome, tsc, vitest on ForkComposerSlot.test.tsx (18/18), oxlint and lint:compiler all pass. Breaking the pin, unpin and pending-save code each fails its test.
  • Live check on a local Coder server with the experiment on (run on 696fe9c; since then only the cap constant was renamed and stories were added). 6 of 6 steps passed. With the experiment off there is no pill and the API returns 403. Pin and unpin send the expected PUT and persist across reload. The next turn's prompt carries the pinned skill, and after unpinning it gets a "(none)" message. An admin sees a member's pins read-only, and the admin's PUT returns 403.
  • Frontend review: three rounds. The last round's should-fix items are fixed, except the projectId ?? "" query key fallback, which matches the upstream callers of chatProjectSkills.

Persist skills pinned to a chat in chatd.chat_pinned_skills behind the
fork-pinned-skills experiment, serve them on GET and PUT
/api/v2/chats/fork/{chat}/pinned-skills, and append their bodies as a
model-only message whenever the prompt does not show the current pins,
so they apply on every turn and return after compaction.
# Conflicts:
#	codersdk/fork_experiments.go
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T10:22:14.240004Z 8a90182 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.

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

Copy link
Copy Markdown

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: 85767ab6d5

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

Comment thread site/src/api/forkChatPinnedSkills.ts Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: b1916f82ef

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

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of @ibetitsmike.

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

Copy link
Copy Markdown

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: 696fe9c4da

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

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of @ibetitsmike.

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

Copy link
Copy Markdown

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: 8a90182f28

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

@ibetitsmike
ibetitsmike merged commit 5149a9e into main Nov 12, 2026
10 checks passed
@ibetitsmike
ibetitsmike deleted the mike/chat-pinned-skills-ui branch November 12, 2026 10:32
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum merged this PR on behalf of @ibetitsmike.

Merge evidence for head 8a90182f28ad7bb0ea105000b4b45f9bbac7aff8:

  • fork-ci run 43198750426 passed on this head. All checks on the head pass. The branch is not behind main.

  • Codex review 5872754746 is on this head. Its 5 P2 nits and earlier rounds 5872300112 and 5872644020 were replied to and resolved. 12 threads, 0 unresolved.

  • Frontend deep review round 3 found 0 blocking:

    • fixed in this head: should-fix TS7/DF5 (picker stories) and TN4 (MAX_PINNED_SKILLS_PER_CHAT)
    • declined: TN2, because the fix needs an upstream query module and the PR follows the upstream ?? "" pattern
  • Ops container validation val3 passed on this head: tsc, biome, oxlint, and vitest 18/18. 3 negative controls fail as intended.

  • UAT-240 passed 6/6 on :3100 at 696fe9c with fork-pinned-skills enabled temporarily:

    • flag off hides the pill and returns 403
    • pin and unpin through the UI, and the pin persists across reload
    • the prompt carries the pinned skill, and (none) appears after unpinning everything
    • a non-owner gets read-only chips and a 403

    Since then the only runtime change is the constant rename, with the same value 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant