Repository navigation
fix(native-chat): one / picker for every agent, anywhere in the prompt - #19832
Conversation
The composer only opened its picker when `/` was the first character of the
draft, so a skill named mid-sentence ("validate it with /electron") offered
nothing. Codex was worse: its `/` menu listed commands only, and skills lived
on a separate `$` trigger, so the prompt box behaved differently per agent.
`/` is now the whole composer grammar. It opens one grouped commands+skills
menu for every agent with a known grammar, both at the start of the draft and
mid-prompt after whitespace. The `$` trigger is gone.
Per-agent invocation is preserved where it belongs — in what a pick writes.
Each row carries its own token, so choosing a skill in Codex inserts
`$electron` while Claude inserts `/electron`, and the text that reaches the
agent stays the text that agent actually invokes. Only a draft-leading command
is dispatchable; picking one mid-sentence completes the token instead of
sending the command on its own and discarding the draft.
Name collisions now key on whether both kinds share a sigil, so a Codex
`/review` command and a `$review` skill stay separate rows.
📝 WalkthroughWalkthroughNative chat autocomplete now uses slash mode for both commands and skills. Picker items provide exact insertion tokens. Leading slash entries can dispatch commands, while mid-prompt entries only complete text. Picker rendering, ARIA state, keyboard handling, and state tracking no longer use a separate skill mode. Agent profiles no longer expose Merge Risk: 🔵 Low · up to Selecting a mid-sentence picker suggestion can add an extra space before the remaining text. This is a minor draft-formatting defect that should be corrected before or shortly after merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description is detailed and covers the change, rationale, testing, visual proof, compatibility, and checklist. However, it explicitly states "No issue — reported directly" even though the template requires a linked issue.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
ℹ️ Two minor suggestions — a mid-prompt path edge case and a test-coverage gap. Nothing blocking.
Reviewed changes
/becomes the composer's only trigger.deriveComposerAutocompletenow keys off two shared regexes (LEADING_SLASH_TRIGGER,MID_PROMPT_SLASH_TRIGGER) and returns a singleslashmode for every profiled agent; theskillmode and$trigger are removed.- Per-row
tokenonNativeChatPickerItem. Skills render under/but insert the agent-native form ($electronfor Codex,/electronfor Claude), so accept-time translation replaces the oldprefixplumbing. dispatchablegating. Only a draft-leading/commanddispatches on Enter; mid-prompt picks complete the token instead, preserving the surrounding prose.- Profile simplification.
groupedSlashis dropped fromNativeChatAgentProfile;groupedis now derived fromskillsEnabled, andskillPrefixgoverns only the written token.
The accept-time-translation model and the removal of the $ popup are well reasoned and the test suite pins the interesting cases (per-item tokens, same-named command/skill staying separate for Codex, mid-prompt filtering, $ inertness). Two rough edges worth a look are inline.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| // the one that can dispatch; elsewhere the token starts after whitespace and its | ||
| // query stops at the next `/` so file paths stay prose. | ||
| export const LEADING_SLASH_TRIGGER = /^\/(\S*)$/ | ||
| export const MID_PROMPT_SLASH_TRIGGER = /\s\/([^\s/]*)$/ |
There was a problem hiding this comment.
A mid-prompt token only stops at the next /, so a single-segment absolute path after whitespace — rm /tmp, open /Users, cat /etc — still opens the picker, and isSkillPickerTriggered will fetch the skill catalog for it too. Only multi-segment paths like open /Users/me/notes are suppressed. Worth confirming that's an acceptable rough edge rather than an annoyance.
The trigger-key swap cases still used `$:4` keys. editReplacesTriggerToken is sigil-agnostic so they passed, but they modelled an input the composer can no longer produce.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: fd171da0-0bbe-44d4-97a9-d27f3648e9ea
📒 Files selected for processing (2)
src/renderer/src/components/native-chat/use-native-chat-composer-keydown.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-skills.react.test.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| draft: 'Explain /clear before continuing', | ||
| caret: 'Explain /clear '.length, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Do not preserve two separator spaces after completion.
The suffix already starts with a space. applyPickerSuggestion adds another space after /clear, so this assertion accepts Explain /clear before continuing. Update the insertion logic to avoid adding a separator when the suffix already starts with whitespace. Expect one space and place the caret immediately after /clear.
Proposed test expectation
- draft: 'Explain /clear before continuing',
- caret: 'Explain /clear '.length,
+ draft: 'Explain /clear before continuing',
+ caret: 'Explain /clear'.length,There was a problem hiding this comment.
ℹ️ This delta is test-only and clean — no new issues. The one open thread from the prior review (single-segment mid-prompt paths) is unchanged here and stays for your call.
Reviewed changes
- Mid-prompt command dispatch is now under test.
use-native-chat-composer-keydown.test.tsxgains anit.eachover all four profiled agents asserting Enter on a mid-prompt/commandcompletes the token viacompletePickerItem(neverdispatchPickerCommand) and preserves the surrounding prose. - Skill-discovery reuse is pinned.
use-native-chat-skills.react.test.tsxdrivesisSkillPickerTriggeredacross leading, mid-prompt, and dismissed states and asserts the catalog is fetched exactly once per host context. - Dismissal fixtures model the live grammar. The
editReplacesTriggerTokendismissal inputs switched from the removed$:4trigger to the live/:0//:4keys.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Review status: ready to mergeThe review/fix loop is clean after two rounds, and the opening and closing release-readiness passes found no P0/P1/P2 issues. The change removes the underlying failure mechanism: the composer derives one cursor-aware slash completion range, each item owns the agent-native token it inserts, and only prompt-leading commands can dispatch. That fits the existing editor persistence and send-classification ownership without adding a parallel flow. I pushed
Hidden-renderer Electron QA passed on the exact final head with
Mobile, Windows/WSL runtime, and SSH runtime QA are inapplicable to this renderer grammar change; it changes no mobile behavior, platform execution path, or remote wire contract. The requested Grok QA worker could not enter the task because Grok Build reported exhausted credits, so a Codex Electron worker ran the same desktop validation and attached the evidence above. Verdict: clean and ready to merge. |

ELI5
Typing
/in native chat only did something if/was the very first character you typed. Say "validate it with /electron" and nothing came up. And the box behaved differently depending on the agent: Claude put skills under/, Codex hid them under$. Now/works everywhere, for every agent, and shows the same one list of commands and skills.What Changed
/is the composer's only trigger. It opens one grouped commands + skills menu for every agent with a known grammar, at the start of the draft and mid-prompt after whitespace.$trigger is removed. Nobody has to learn a different prompt box per agent./menu now lists skills, which it never did before./electronfor Claude and$electronfor Codex — the form that agent actually invokes./reviewcommand and a$reviewskill stay as separate rows./, soopen /Users/me/notesstays prose.Why
Two problems. The picker's trigger was anchored to draft position 0, so mid-sentence skill references — the way people actually write them — produced nothing. And the composer's grammar was per-agent, which means every new agent we support is another prompt-box behavior to design, explain, and maintain.
One typed grammar, per-agent invocation. The translation happens when a row is accepted, not at send time, and that placement is load-bearing: the PTY lane branches on the literal draft text to decide typed-vs-pasted delivery, send classification is shared with mobile and reads the same plain text, and the draft cache persists the composer document across pane switches. Translating later would desync all three. Because the accepted token is agent-native, invocation still works on both agents: a Codex skill lands as
$electronand is pasted (the existing delivery test pins this), a Codex command still dispatches typed into the TUI, and Claude is unchanged.Deliberate deviations worth a reviewer's attention:
$popup is gone. Typing$nameby hand still sends and classifies exactly as before — only the autocomplete surface for it is removed.$token can appear in a/menu row for Codex, because that row shows what will be inserted. The composer pill hides the sigil once accepted. Easy to change to a bare name if reviewers prefer.Linked Issue
No issue — reported directly.
Visual Proof
Validated on
f6f6095in the real desktop Codex native-chat composer through Playwright CDP with a disposable local profile and hidden renderer. Keyboard input opened the slash picker at draft start and after whitespace, displayed Commands and Skills together, and accepted a Codex skill as its native$skill-creatorpill. Enter completed mid-prompt/modto/model, preserving the surrounding prose without sending; draft text/document caches and a chat/terminal round trip confirmed the skill token.Before typing · Draft-start slash menu · Grouped commands and skills
Mid-sentence skill menu → Inserted skill pill
Mid-prompt command menu → Completed draft with surrounding prose
Scope: desktop Codex composer only; provider execution, other agents, mobile, and remote/platform-specific flows were not exercised.
Testing
Automated, all green:
pnpm test src/renderer/src/components/native-chat/ src/shared/native-chat-agent-profiles.test.ts— 126 files, 1271 testspnpm test src/shared/— 688 files, 7633 teststsc -p config/tsconfig.tc.web.json,config/tsconfig.node.json,config/tsconfig.tc.cli.json— cleanpnpm run check:code-quality:changed— 0 findings;oxfmt --checkcleanpnpm buildnot run locally; leaving that to CITests deliberately rewritten because they encoded the old per-agent grammar, not because they broke:
keeps Codex commands under slash and skills under dollar→ now asserts one/menu with both kinds and per-item tokenskeeps Codex dollar skills separate from slash commands(profiles) → now assertsskillPrefixonly governs the written token$-trigger derivation block → now asserts$is inert and Codex skills come from/Left alone on purpose, because they pin delivery rather than menu policy:
types Codex slash composer sends instead of pasting themandkeeps Codex skill sends pasted.Review
Worth challenging: whether accept-time translation is the right ownership model versus a host-announced grammar; whether showing
$electronin a/menu is the right row text; and whether removing the$popup needs a deprecation path.Agent skill upstream boundary
Notes
/, which they previously never did.$autocomplete surface. Hand-typed$namestill works.Checklist