TUI skill mention popup shows duplicate entries for the same skill name
Summary
The TUI skill mention popup can show duplicate entries for the same skill invocation when the same skill name is available from multiple scopes and one copy has an interface display name.
Example observed from a repo with both user-level and repo-level SDLC skills:
SDLC [Skill] ...sdlc [Skill] ...
Both entries insert the same $sdlc token, so the popup looks like two different commands even though the invocation name is identical. This is confusing in repos where a repo-local skill intentionally overrides or specializes a user-level skill.
Expected behavior
When multiple skills share the same SkillMetadata.name, the mention popup should show one entry for that invocation name. Repo-scoped skills should take precedence over user/system/admin scopes because repo-local instructions are the most specific.
Root cause
ChatComposer::mention_items currently iterates every skill metadata entry and builds one MentionItem per entry. The item display label comes from skill_display_name, which can use interface.display_name, while the inserted token still uses skill.name.
That means these two skills render as visually distinct rows but insert the same token:
- user skill:
name = "sdlc",interface.display_name = "SDLC" - repo skill:
name = "sdlc", no display name
Patch shape tested locally
I tested a focused TUI patch that dedupes skill mention rows by skill.name before building MentionItems. The dedupe policy preserves first-seen order, but replaces an existing entry when a later skill with the same name has a higher-priority scope:
Repo > User > System > Admin
This matches the existing skill-root cache ranking used elsewhere in core-skills.
Regression tests added locally
mention_items_deduplicate_same_skill_name_preferring_repo_scopemention_items_deduplicate_preserves_first_seen_skill_orderskill_mention_popup_dedupes_same_name_snapshot
The snapshot verifies the popup renders a single row:
sdlc [Skill] Repo SDLC workflow
Local verification
Targeted tests pass:
cargo test -p codex-tui mention_items_deduplicate
cargo test -p codex-tui skill_mention_popup_dedupes_same_name_snapshot
just fmt
Full-suite note on Windows
The broader Windows cargo test -p codex-tui run is currently blocked locally by unrelated Windows TUI test failures:
- without
RUST_MIN_STACK, several unrelatedapp::tests::*cases abort withSTATUS_STACK_OVERFLOW; see #19596 - with
RUST_MIN_STACK=16777216, stack overflow clears, but three unrelatedstatus::helpers::*compose_agents_summary*path-display assertions fail because expected~\AppData\...differs from actualC:\Users\...\AppData\...
Those blockers are separate from this skill mention popup patch; the targeted duplicate-skill tests pass.
I can open a PR with the focused patch if contributor permissions/invitation allow it.
4 Comments
Process note: I usually file issues like this after following a full local
$sdlcpass, meaning I have a focused patch shape plus regression tests and targeted proof before opening the report. If maintainers prefer that I open a PR directly for this kind of already-proven issue, let me know and I can do that when contributor permissions allow it.Implementation-ready patch notes
Adding the exact local patch shape here so this issue is usable as a PR handoff if I cannot open the branch directly.
File to change
codex-rs/tui/src/bottom_pane/chat_composer.rsBehavior to preserve
SkillMetadata.name.insert_textbased onskill.name, notdisplay_name.skill.nameanddisplay_namewhen they differ.Scope precedence used by the local patch
This mirrors the repo-specific-over-global behavior users expect, and it matches the existing cache-key rank shape in
codex-rs/core-skills/src/manager.rs.Minimal code change
Import
SkillScopenear the other protocol imports:In
ChatComposer::mention_items, change only the skill loop source:Add this helper near
skill_description:Tests added locally
In the existing
mod testsforchat_composer.rs, add imports:Local helper used by the tests:
Regression test 1: same skill name prefers repo scope
Regression test 2: distinct skill ordering stays stable
Snapshot test
Expected snapshot body:
Verification I ran locally
Results:
mention_items_deduplicate: 2 passedskill_mention_popup_dedupes_same_name_snapshot: 1 passedFull-suite caveat
cargo test -p codex-tuiis blocked on my Windows machine by unrelated upstream failures already split into separate issues:STATUS_STACK_OVERFLOWin unrelatedapp::tests::*~\AppData\...vsC:\Users\...\AppData\...status-helper path assertionsThe duplicate skill-label patch is targeted to
ChatComposer::mention_items; the focused tests above pass.Thanks for reporting the issue. The current behavior is intended, so I wouldn't consider this a bug.
These are not duplicate skills, even though they have the same name. Collapsing duplicate names would remove the user’s ability to choose a non-default same-name skill from the popup.
Ahh I see, thanks for the response and clarification!