Skip to content

feat(crew): disambiguate colliding package skill copies in the agent editor - #11923

Closed
rnoack1 wants to merge 1 commit into
kirodotdev:mainfrom
rnoack1:feat/agent-skills-editor-qualifier-ui
Closed

rnoack1 wants to merge 1 commit into
kirodotdev:mainfrom
rnoack1:feat/agent-skills-editor-qualifier-ui

Conversation

@rnoack1

@rnoack1 rnoack1 commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

One unit of a split of #7105, which was 6.9x over the 1500 added-line cap. This is the
frontend half and stands alone: it touches only website/src, needs nothing from the backend
units, and is 721 added lines.

Problem / Motivation

Two bundles can vend a skill under the same display name. The agent skills editor rendered both
identically, so:

  • the picker offered two visually identical options — same name, same description — with
    nothing to tell them apart, so which copy you mapped was a coin flip;
  • a mapped chip named a copy indistinguishable from its twin;
  • a failed catalog load looked the same as "you have no skills": the picker rendered an
    empty state that contradicted the failure;
  • a refused mapping gave no indication which key the backend rejected;
  • a hand-authored skill:// URI was read-only — it rendered in the picker's chip row with
    no way to remove it, so undoing one meant editing the agent's config by hand.

Removing a mapping also worked by resubmitting the client's remaining keys, which silently
overwrites whatever a concurrent session added in the meantime.

Why it matters

Mapping the wrong copy of a colliding skill is silent: the agent loads a different file than the
user intended and nothing reports it. The catalog-failure case is worse than unhelpful — the
empty state actively asserts something false.

What changed (motivation → approach → change)

The disambiguator has to be readable and announced, so it is rendered inside the control
rather than left to a hover title, and it is shown only where it carries information:

  • Only for a genuine collision. Counted over package rows only: a user's own copy sharing
    a crew skill's name is not an ambiguity, so an ordinary skill stays a plain label.
  • Widened until the rows actually differ, so the fragment shown is the shortest one that
    distinguishes them.
  • No raw-key fallback. Where no path is available the line is omitted rather than printing a
    32-hex digest, which is not something a user can act on.
  • Catalog failure states its reason in visible text and withholds the picker, so no empty
    state can contradict the notice.
  • A refusal names the key the backend refused — with its disambiguator, since twins share a
    name — and advises a re-pick only when the refused key is the one just picked. A blocked add
    holds the user's pick rather than making them find it again, and does not resubmit it when the
    blocker clears.
  • Hand-authored skill:// URIs move into their own region with a config glyph and a
    confirm-guarded remove. The confirmation exists because the picker cannot put one back: an
    unasked mis-click would be recoverable only by editing config.
  • A removal names only itself (removed_skill / removed_unmanaged_skill) instead of
    resubmitting the remaining set, so a stale tab cannot delete a mapping another session added.

The component was composed onto the current main, which had rebuilt this popup on Radix
Popover in #11283. That shell is kept wholesale — Popover/PopoverTrigger/PopoverContent,
the focus-return on close, the Escape handling and the IME latch — and this change is layered
inside it. The earlier hand-rolled createPortal dropdown and its computed positioning block
are gone.

Tests

  • AgentSkillsEditor.test.tsx — the two existing removal tests are updated to pin the new
    contract: removing a chip PATCHes only the removal, and removing an unmanaged URI asks
    first and then names the URI rather than omitting it from a resubmitted set. Also asserts the
    remove control lives in the unmanaged region.
  • AgentSkillsEditor.themeTokens.test.ts — new: the notice surfaces name theme tokens rather
    than literal colours, so they stay readable in every theme.
  • Gates run clean on this branch: typecheck, lint, lint:theme-colors,
    lint:phantom-classes, lint:i18n, i18n:check.

Deferred, and why: the full behavioural suite for the disambiguator, the refusal notice and
the not-installed marker is ~900 further added lines, which would put this PR over the cap. It
follows as its own PR once this lands — it asserts behaviour that does not exist on main
today, so it cannot be opened in parallel. It was run against this branch during development:
49 of 50 passing, the single failure being a test that reads a capture-harness script
belonging to a different deferred unit (ENOENT), not a behavioural failure.

Manual verification

N/A — the behaviour above is covered by the suite described under Tests, including the ~900
deferred lines that were run against this branch before the cut.

Screenshots / video

Captured from the real built SPA by website/scripts/capture-agent-skill-copy-qualifier.mjs,
committed in this PR. It answers every /api/** call from fixtures and asserts each contract
before it writes a frame, so a stale or half-rendered capture fails the run instead of shipping.

1 — the bound chip names which copy it bound. Two installed bundles each ship a code-review
skill. The mapped chip reads Located in skills/papyrus-writer; the non-colliding memory stays a
plain label, so an ordinary skill gains no qualifier.

Mapped code-review chip reading "Located in skills/papyrus-writer" beside a plain memory chip

2 — both colliding copies are separately addressable in the picker. The two code-review rows
are distinguished by their own paths rather than rendering as one repeated label.

Picker listing two code-review rows, one Located in skills/papyrus-writer and one in skills/ospro-team

3 — a mapping whose copy is gone reads as a warning, not as healthy. The chip takes the warn
style with a triangle, and the count line states the remedy in visible text rather than only in a
tooltip.

Warn-styled code-review chip above the line "1 mapped skill no longer matches an installed copy"

4 — a failed catalog read is stated, not shown as an empty list. An unreadable catalog would
otherwise look like a catalog with nothing in it.

Red notice reading "Could not load the skill catalog." above a disabled Add skill button

Correcting an earlier note that stood in this section: it said captures were blocked on the
deferred capture unit. That was wrong. A harness driving the built SPA with stubbed APIs imports
nothing from the deferred slices, so the evidence was producible in this unit all along.

Related Issues

Part of the split of #7105. Composes with #11283, which rebuilt this popup on Radix Popover.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable) — N/A, no doc surface in this unit
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 19, 2026
@dwu96

dwu96 commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review.

When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically.

@rnoack1
rnoack1 marked this pull request as ready for review September 19, 2026 01:19
@rnoack1
rnoack1 requested review from a team and patrigao September 19, 2026 01:19
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ⚠️ could not complete

The design review did not produce a verdict for 172acc43f53aee73b383dd6374bec8b0aea1a718 (the review step failed). See the Fork Design Review job logs. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ⚠️ review incomplete

Reviewed 172acc43f53aee73b383dd6374bec8b0aea1a718 via the fork AI-review pipeline; updated in place on each push.

No completed Opus verdict for this commit; see the Fork Opus 4.8 Review job logs.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — ⚠️ could not complete

The first-principles review did not produce a verdict for 172acc43f53aee73b383dd6374bec8b0aea1a718 (the review step failed). See the Fork First Principles Review job logs. Advisory — does not block merge.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ⚠️ review incomplete

Reviewed 172acc43f53aee73b383dd6374bec8b0aea1a718 via the fork AI-review pipeline; updated in place on each push.

No completed GPT verdict for this commit; see the Fork GPT 5.6 Review job logs.

Captured review output -- no verdict stamp for this commit, so this is NOT a verdict

Incomplete review: pass(es) 1 2 did not complete.

The pass-2 verdict was not published because both calls are required. Re-run the workflow for a complete review.

@rnoack1
rnoack1 force-pushed the feat/agent-skills-editor-qualifier-ui branch from 172acc4 to bad5017 Compare September 19, 2026 01:47
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 19, 2026
@rnoack1
rnoack1 force-pushed the feat/agent-skills-editor-qualifier-ui branch from bad5017 to 92a6205 Compare September 19, 2026 03:13
…editor

Two bundles can vend a skill under one display name, so picker rows and mapped chips now carry a disambiguating path fragment, and a failed catalog load or a refused key states its reason in visible text.
Hand-authored skill:// URIs move into their own region with a confirm-guarded remove, and removing a mapping names only the removal instead of resubmitting the caller's remaining set.
@rnoack1
rnoack1 force-pushed the feat/agent-skills-editor-qualifier-ui branch from 92a6205 to 8f6415a Compare September 19, 2026 06:12
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 19, 2026
@iamwhatever iamwhatever self-assigned this Sep 25, 2026
@iamwhatever iamwhatever added the drive-to-green PR claimed by drive-to-green pipeline label Sep 25, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: removing a skill chip silently does nothing, and the new token test imports a file main deleted

1. Against the current backend, removing a mapped skill has no effect.

website/src/components/AgentSkillsEditor.tsx:443 now sends only the key being removed:

save.mutate({ agent: agentName, removedSkill: key })

:331-336 leaves out skills whenever next is undefined. The PATCH body is therefore {removed_skill: key}, plus unmanaged_skills when there are any. No backend reads that field. removed_skill, removed_unmanaged_skill and skills_unknown have no hits in src/kiro_crew on main, and the backend half in PR #7105 does not add them.

On main, api_agent_detail changes the mapping only if "skills" in patch_body: (src/kiro_crew/dashboard/handlers/agents.py:3715). Otherwise it reads the unchanged set back with agent_skill_keys and returns 200 {"ok": true, "skills": mapped} (:3825). The client then runs const applied = res?.skills ?? next ?? skills (:359), which gives the unchanged list, and passes it to onChange.

What the user sees: they click X on a mapped chip in the crew pane or the Agent templates tab. The server returns 200, the chip stays, and no error appears. The agent keeps loading a skill the user thinks they removed. This works on main today, where remove sends {skills: skills.filter(k => k !== key)}.

The new remove button for unmanaged URIs (:717) does nothing either, for the same reason. The skills_unknown refusal parsing never matches, because main's 400 has no code field. The tests mock api.agentPatch, so they pass without any backend.

Smallest fix: keep sending {skills: remaining} for removals until a backend that reads removed_skill / removed_unmanaged_skill lands. The other option is to land that backend first and link it here.

2. The new test fails to resolve its import on current main.

website/src/test/AgentSkillsEditor.themeTokens.test.ts:19:

import tailwindConfig from '../../tailwind.config.js'

PR #12220 (the Tailwind v4 upgrade, merged 2026-09-20, after this commit) deleted website/tailwind.config.js. The theme now lives in src/tailwind-theme.css. The merge is textually clean, but vitest run cannot resolve the import. tsc does not catch it, because tsconfig.app.json excludes src/test. If this PR merges as-is, main's website test job goes red.

Note: PR #13681 cherry-picks this commit and already moves the token test over to tailwind-theme.css. It still carries the removal change at the same line (443), so finding 1 needs a fix whichever PR goes forward.

From a full open-PR audit against origin/main c66f95b (2026-09-25); findings were checked by independent reviewers reading the code. Reply here if this is wrong.

@bolichen97

Copy link
Copy Markdown
Contributor

Closing as a duplicate of PR #13681, which carries this PR's commit and fixes its two breaks on current main

PR #13681 is an in-repo branch whose description says "Supersedes #11923, original author @rnoack1". Its first commit, 9d3546ad2a, is this PR's only commit (8f6415a0ea) cherry-picked. I compared every added and removed line of the two commits, leaving out temp-screenshots/, and they are identical. That covers website/src/components/AgentSkillsEditor.tsx, website/src/test/AgentSkillsEditor.test.tsx, website/src/test/AgentSkillsEditor.themeTokens.test.ts, website/scripts/capture-agent-skill-copy-qualifier.mjs, website/src/i18n/pluralKeys.json and every locale file. It is not a stack, because 8f6415a0ea is not an ancestor of #13681's head. Closing this PR loses nothing.

Why #13681 is the one to keep. Its follow-up commit fd3317c0ca fixes the two things that break this branch on current main:

#13681 also moves the four PNGs out of the tree and into the PR body. It is 48 commits behind main, against 790 for this branch, and drive-to-green can push to it, which it can't do on this fork. Every AI review lane on this PR failed to complete. #13681 has real verdicts to work from.

Harvest: nothing. The only lines unique to this PR are the committed PNGs and the two variants above, and neither variant works on main.

The removal problem from the earlier review here still applies: AgentSkillsEditor.tsx:443 sends {removed_skill}, and no backend reads that field. That line is part of the shared code, so the fix belongs on #13681. The First Principles review on #13681 already blocks on it.

If this is the wrong call, for example because you plan to keep working on this branch yourself, reopen the PR and say so here.

From a full open-PR audit against origin/main c66f95b (2026-09-25); findings were checked by independent reviewers reading the code. Reply here if this is wrong.

@bolichen97 bolichen97 closed this Sep 25, 2026
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 25, 2026
@NicholasRBowers NicholasRBowers removed the drive-to-green PR claimed by drive-to-green pipeline label Sep 25, 2026
@rnoack1
rnoack1 deleted the feat/agent-skills-editor-qualifier-ui branch November 9, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants