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.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗