Repository navigation
feat(native-chat): describe slash commands from the provider's own report - #19928
Conversation
…port The Claude session reports a description and argument hint for every command it can run, but the catalog kept only the name, so the `/` picker described the handful of commands our curated map covers and left the rest — `/goal` included — with a blank row. Carry `description`/`argumentHint` through the catalog and the session wire (both optional, so mixed-version hosts are unaffected), and let a reported description win over the curated one, which stays as the fallback for the name-only report shape. The curated maps are untouched, so structured dispatch still claims exactly the commands it claimed before.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Carry provider row text through the catalog —
claude-slash-command-catalog.tsnow extractsdescription/argumentHintfrom descriptor-shaped frames viadescriptorDetails+rowText(non-strings, blanks, and over-length values dropped rather than truncated; whitespace collapsed to one line; map capped atMAX_COMMANDS), and re-attaches the text across name-only streaminitframes through adetailsmap. - Prefer reported text in the picker —
sessionSlashCommandSuggestionsprefers the reporteddescriptionand falls back to the curated map, with no additions toCLAUDE_COMMANDS/CODEX_COMMANDS(preserving structured-dispatch behavior). - Wire type —
AgentSessionSlashCommandgains optionaldescription/argumentHint; additive host→client fields, safe for mixed-version clients and hosts. - Change detection — the catalog's equality check now compares the text too, so a description-only refresh still produces a new array reference and republishes through the subscribers' reference-equality check.
Verified: the detai merge order, the name-only-frame retention, the wholesale-replace semantics of descriptor frames (a later report that omits a description clears it), and the bounded/type-checked text extraction all hold up against the raw diff and surrounding code. The new tests assert exact objects (no loose truthiness/snapshot absorption), and the targeted suites pass (33/33).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe wire type now supports optional provider-authored descriptions and argument hints. The slash-command catalog validates, normalizes, stores, and propagates this text across descriptor and name-only frames. Text-only changes now trigger updates. Session suggestions prefer reported descriptions and use curated descriptions as a fallback. Picker rows render sanitized argument hints. Tests cover filtering, reclassification, malformed text, rendering, and precedence. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Provider-authored command text is validated, propagated, and rendered with covered fallback and clearing behavior. No current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description thoroughly explains the problem, implementation, testing, visual behavior, compatibility impact, and remaining failures. However, it omits the required linked issue reference under “Fixes #”.
✨ 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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 2ca5992b-286d-49df-bf8a-d117a8cd1a8f
📒 Files selected for processing (6)
src/main/claude/claude-slash-command-catalog.test.tssrc/main/claude/claude-slash-command-catalog.tssrc/main/claude/claude-structured-session-commands.test.tssrc/shared/agent-session-wire.tssrc/shared/native-chat-slash-commands.test.tssrc/shared/native-chat-slash-commands.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
`argumentHint` was carried to the renderer but nothing read it. Show it beside the command token — `/goal <objective>` over the description — so a row says how the command is invoked, not just what it does. It sits at the row's existing 11px muted tier, subordinate to the description, and truncates in a min-width-0 flex row; the picker also caps the hint at 80 characters, so a provider cannot swamp the row.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Render the provider's argument hint beside the command token —
NativeChatAutocompleteMenus.tsxlays the token andargumentHintout in amin-w-0flex row, showing the hint in the row's existing 11px muted tier so it truncates rather than pushing the row wide. - Plumb the hint into the picker, capped at 80 chars —
native-chat-picker-items.tsaddsargumentHintto the command picker item viasanitizePickerText, andsessionSlashCommandSuggestionspasses the wire field through unchanged when present. - Cover the chain end-to-end — a new renderer test drives a wire entry through
sessionSlashCommandSuggestionsandbuildNativeChatPickerItemsinto the rendered option, asserting the hint text, the hintless-row fallback, and the 80-char cap; the shared suite's "reported text the curated catalog never claims" case now also asserts the hint survives.
Verified: the render narrows on item.kind === 'command' (the union's only member carrying argumentHint), the cap math in the test matches sanitizePickerText(..., 80) exactly, and the mobile composer builds its rows from the curated catalog, so the new optional field is inert there.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Normalized descriptor name handling — a shared
commandNamevalidator (trim, length, and no-whitespace) now backs bothnames()anddescriptorCatalog(), so a malformed descriptor name is rejected before it can consume theMAX_COMMANDSbudget. - Single validated pass for names and text —
descriptorCatalogreturns{ names, details }from one dedupseenset, replacing the priordescriptorNames+descriptorDetailspair whose name and detail budgets could disagree. - Merged duplicate descriptors — repeated names within one frame now combine non-empty fields (
previous?.description ?? rowText(...)) instead of the last descriptor overwriting earlier text. - Bounded raw length before collapsing —
rowTextrejects over-length values before the whitespace-collapse regex runs, so a pathological input never reaches the regex.
Verified the budget-accounting fix (the new "malformed descriptor names" test would fail against the prior details.size counter), the duplicate-merge order, and that the shared seen set keeps name/detail caps consistent. New tests assert exact objects with no loose truthiness or snapshot absorption.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Review statusPASS WITH RISK — no proven code findings remain.
|
|
Update: all required PR checks are now green, including package (macOS and Windows), typecheck, static analysis, the 8 Node 24 test shards, and cross-version wire compatibility. The only skipped jobs are path-gated checks unrelated to this data-only native-chat change. |
Electron CDP validationPASS on PR HEAD 384fa7a.
Unverified in this run: sending a command, the Codex lane, mobile, SSH, and Windows/WSL. |
|
Correction: replacement Electron validation completed successfully after the earlier provider-limit block.
Remaining unverified: sending a command, Codex-specific behavior, mobile, SSH, and Windows/WSL. |
Electron send-path validationValidated the exact PR head (384fa7a) in an isolated background profile through the real Claude structured-chat UI.
|




Before / After
In a Claude native chat, typing
/lists the commands that session actually loaded — 48 of them on this machine. Before this PR, 45 of those 48 rows were a bare command name with no explanation, because Orca described them from a hand-written 5-entry map instead of the text Claude already sends./goal,/code-review's arguments,/effort's options — none of it reached the picker.After, the picker shows what the provider reports: 38 of the 48 commands carry a one-line description — every one of them the provider's own text, including the three the curated map used to answer for — and 19 also show the argument sketch beside the token (
/debug [issue description],/code-review [low|medium|high|xhigh|max] [--fix] [--comment] …). Nothing else about the row changed, and skill rows are untouched.The same list, filtered to
/g—/goalgoes from a bare token to an explained row:Counted from the rendered picker in both apps (same Mac, same Claude install, same session report of 67 entries = 48 commands + 19 skills):
/pickerProblem
Native chat renders Claude's slash commands from the catalog the session reports, but the descriptions came from a hand-written map (
CLAUDE_COMMANDSinsrc/shared/native-chat-slash-commands.ts) that covers 5 commands. A real session reports far more — 67 entries here — so most rows,/goalamong them, rendered with a blank description. Only 3 of the 5 curated names were even in what this session reported.The data was already arriving and being dropped: the provider's descriptors carry
name,descriptionandargumentHint, anddescriptorNames()insrc/main/claude/claude-slash-command-catalog.tskept only.name.Fix
Carry the provider's own text through to the picker:
claude-slash-command-catalog.ts— descriptor-shaped sources (control initialization,commands_changedwithcommands) now contributedescription/argumentHint, bounded the same way names already are: non-strings, blanks, and values over 200 (description) / 100 (argument hint) characters are dropped rather than truncated, whitespace is collapsed to one line, and the map is capped atMAX_COMMANDS. A descriptor frame replaces the text wholesale, so a later report that omits a description clears it.initmessage carriesslash_commandsas plain strings, and it is what classifies commands vs skills — without this it would wipe the descriptions the control seed just supplied. Change detection now compares the text too, so a description-only refresh still republishes.agent-session-wire.ts—AgentSessionSlashCommandgains optionaldescription/argumentHint. Nothing is renamed or made required, so old clients and old hosts are unaffected.native-chat-slash-commands.ts—sessionSlashCommandSuggestionsprefers the reported description and falls back to the curated map. No entries were added toCLAUDE_COMMANDS/CODEX_COMMANDS: that map also drives which commands the structured dispatcher claims, so growing it would change dispatch behaviour. Keeping description sourcing separate from it is the point of the change.The
terminal_slash_commandshide-list and skill classification are unchanged, and a terminal-only command stays hidden however well the provider describes it (covered by a test).argumentHintis rendered too, beside the command token —/debugreads/debug [issue description]on the token line, with "Enable debug logging for this session and help diagnose issues" below it. It uses the row's existing 11px muted tier — subordinate to the description, no new tokens or sizes — sits in amin-w-0flex row so it truncates instead of pushing the row wide, and the picker caps it at 80 characters before it reaches the DOM. The mobile composer is deliberately untouched (no file undermobile/is changed): it builds its rows from the curated catalog, not the session report, so a hint would never be populated there.Visual proof
Both screenshots above are the real app, driven over CDP with the window kept off screen:
5c8dbd0), Orca dev instance on a fresh profile, real Claude structured native chat in a folder workspace,/typed into the composer. No message was sent; the catalog arrives with the session.12f2c6b(an ancestor of this branch's base721a269, i.e. without these commits), same folder workspace, same Claude, same 48-command report.The row counts in the table above were read out of the rendered DOM of each instance, per picker group.
What the screenshots do not show: the hint's 80-character cap and description truncation (asserted in the render test, not reproducible with the text this Claude reports), the Codex lane, and mobile.
Ablation
Argument hint rendering (second commit): reverted the three source files that carry and render the hint, test kept — 1 failed / 6 passed in
NativeChatAutocompleteMenus.test.tsx. Restored: 7 passed. The test drives the real chain — a wire entry throughsessionSlashCommandSuggestionsandbuildNativeChatPickerItemsinto the rendered option — and asserts both the hint text and that an over-long hint arrives capped.Description sourcing (first commit): reverted only the three source files, tests kept: 8 failed / 21 passed. Restored: 29 passed / 0 failed (
claude-slash-command-catalog.test.ts+native-chat-slash-commands.test.ts). The one new test that passes in both states is the "describes nothing when the session reported names only" case, which asserts the unchanged string-only behaviour.New coverage: descriptor text preserved; over-long / wrong-type / blank / multi-line text bounded; text carried across the name-only stream init; description-only change detected and later cleared; string-only reports still description-free; hide-list unchanged; reported description beating the curated one; curated fallback intact.
Two pre-existing tests were updated because they now legitimately carry descriptions (
claude-slash-command-catalog.test.tsdescriptor reload, and theclaude-structured-session-commands.test.tscontrol-initialization seed, which now proves the text survives the stream init end-to-end through the adapter).Gates
pnpm test src/main/claude/claude-slash-command-catalog.test.ts src/shared/native-chat-slash-commands.test.ts src/main/claude/claude-structured-session-commands.test.ts— 3 files, 33 tests passed.pnpm tc— exit 0.pnpm run check:code-quality:changed— passed, 0 new findings across 9 changed files (code quality, type-aware, React Doctor).pnpm test src/renderer/src/components/native-chat …— 130 files, 1355 tests passed.pnpm test src/main/claude src/shared— 8457 passed. The remaining failures are pre-existing: the same files fail with this change fully reverted at the base commit (remote-runtime-shared-control-connection,feature-interactions,claude-tui-resume-real-binary.integration,claude-structured-real-cli), andclaude-agent-sdk-exit-proof/claude-stream-json-connection/claude-agent-sdk-import-boundaryfail non-deterministically under load in both states (a different test name each run).