Repository navigation
fix(native-chat): list the slash commands and skills a structured Claude session actually loaded - #19127
Conversation
…ude session actually loaded The chat composer's `/` menu was built from a curated five-command catalog plus a host disk scan of skill roots. Neither is what the running session can do: the session reports its own `/` surface, which carries this repo's `.claude/commands`, the skills that only reach it through plugin roots, and a hide-list of commands that mean nothing outside a terminal UI. On one local session the menu offered 6 commands and 17 skills where the session reported 62 commands and 33 skills. Read that surface per session and let it drive the picker: - A per-session catalog seeded from the frame that proves the session and kept current by every later report, exposed over a new `agentSession.commands` read. - The report is the authority on WHICH skills exist; the disk scan stays the source of scope and description for the names both know about, so a skill the session never loaded is no longer offered and one it loaded from a root the scan cannot see now is. - A host that predates the read answers `method_not_found` and the composer keeps its curated catalog, so mixed versions and the PTY lane are unchanged.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (11)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe change replaces command revision tracking with session-reported command collections. Claude now parses and updates command catalogs, which flow through structured session events, reducer state, subscribers, RPC, and renderer state. Native chat uses reported commands and skills for autocomplete and picker construction. Empty reports remain authoritative, unknown commands remain selectable, terminal commands are filtered, and unsafe names are rejected. Tests cover catalog parsing, publication, wire propagation, renderer updates, RPC exposure, and picker behavior. Merge Risk: ⚪ Minimal · up to The command catalog reaches the renderer correctly, and no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the implementation and validation, but it does not follow the required template. It omits the required section headings, issue link, visual proof or explicit N/A, checklist confirmations, AI disclosure, boundary statement, and review notes. Resolution Update the description to include all required template sections. Add a valid Linked Issue entry, provide visual proof or state N/A with a reason, complete the Testing checklist with tested platforms, provide the AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections, and retain the existing implementation and validation details under the appropriate headings.
✨ 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: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: ac7bc37f-a285-436c-bd99-29207414af1b
📒 Files selected for processing (24)
src/main/claude/claude-slash-command-catalog.test.tssrc/main/claude/claude-slash-command-catalog.tssrc/main/claude/claude-structured-dispatch.test.tssrc/main/claude/claude-structured-options.test.tssrc/main/claude/claude-structured-session-adapter.tssrc/main/claude/claude-structured-session-publication.tssrc/main/claude/claude-structured-session-state.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adapter-router.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adapter.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host.tssrc/main/runtime/rpc/methods/structured-agent-session.tssrc/main/runtime/runtime-rpc/runtime-rpc-mobile-method-allowlist.tssrc/renderer/src/components/native-chat/NativeChatComposer.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsxsrc/renderer/src/components/native-chat/native-chat-composer-state.test.tssrc/renderer/src/components/native-chat/native-chat-composer-state.tssrc/renderer/src/components/native-chat/native-chat-composer-types.tssrc/renderer/src/components/native-chat/native-chat-picker-items.tssrc/renderer/src/components/native-chat/use-native-chat-composer-catalog.tssrc/renderer/src/components/native-chat/use-native-chat-picker-state.tssrc/renderer/src/components/native-chat/use-structured-agent-session.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.
There was a problem hiding this comment.
Important
Adding the agentSession.commands RPC read breaks two surface-enumeration ratchets that CI runs, so this fails to merge as-is. Both are mechanical manifest updates — details in the inline comment.
Reviewed changes
- Per-session command catalog — a
ClaudeSlashCommandCatalogseeded from thesystem/initframe that proved the session and refreshed by latersystem/init/system/commands_changedframes, producingAgentSessionSlashCommand[]. - New
agentSession.commandsread — wired through the RPC method → host → router → adapter (readCommands), mirroringagentSession.options, and added to the mobile RPC allowlist. - Renderer catalog switch —
useNativeChatComposerCatalogdrives the/menu from the session's own report when present, falling back to the curated catalog on an older host; the disk scan only enriches the skills the session actually loaded. - Picker merge — the report is authoritative on which skills exist: unreported scanned skills drop out, reported-but-unlocated skills render without a scope badge and sort last.
- Tests — catalog parsing/change detection, picker merge, and suggestion merge.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| .filter((entry) => entry.kind === 'command') | ||
| .map((entry) => { | ||
| const description = described.get(entry.name) | ||
| return { name: entry.name, ...(description ? { description } : {}) } |
There was a problem hiding this comment.
Session-reported command names now flow through verbatim with no display-safety check. Skill names from the same report are gated by isTokenSafe (in mergeNativeChatSkills), but command names go straight into the picker and draft — and native-chat-picker-items.ts still says they're inserted verbatim because "the catalog is curated", which is no longer true for this path. A reported command from a plugin/.claude/commands with control or bidi characters would pass the main-side names() filter (whitespace + length only) and spoof a row. Consider routing reported command names through isTokenSafe (or isSafeDisplayCharacter) before mapping them into suggestions.
The structured method count, the mobile allowlist, and the cross-version call table each enumerate the agentSession surface on purpose, so an additive method has to be declared in all three rather than counted around.
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta — the surface-ratchet registration is complete and correct.
Reviewed changes
- Registered
agentSession.commandson all three surface ratchets —src/main/runtime/mobile-rpc-allowlist.test.ts("exposes only the mobile structured agent-session surface"),src/main/runtime/rpc/methods/structured-agent-session.test.ts(toHaveLength(19 → 20)), andtests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts(STRUCTURED_CALLSentry plusstructuredHostStub().readCommands). This closes out the CI breakage from the prior review. - Verified
mobile-rpc-allowlist.test.tsandstructured-agent-session.test.tsgreen locally; the cross-version harness can't execute here (shallow clone carries no release tags), but the manifest entry mirrors the source method exactly.
The command-name display-sanitization concern raised on the prior review remains open and is unchanged by this commit, which is why this delta is not approved.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
the model provider had a temporary upstream failure. The provider refused or dropped the request mid-run — nothing in your repo or your credentials is at fault. Re-trigger Pullfrog; if it keeps happening, check the provider's status page.
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: dd808b8b-03b3-4ed2-ae1e-ae95560c7942
📒 Files selected for processing (19)
src/main/claude/claude-slash-command-catalog.test.tssrc/main/claude/claude-slash-command-catalog.tssrc/main/claude/claude-structured-session-adapter.tssrc/main/claude/claude-structured-session-commands.test.tssrc/main/claude/claude-structured-session-state.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adapter.tssrc/main/native-chat/agent-session-wire/structured-agent-session-command-publication.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host.tssrc/main/native-chat/agent-session-wire/structured-agent-session-subscribers.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-subscribers.tssrc/renderer/src/components/native-chat/native-chat-composer-state.test.tssrc/renderer/src/components/native-chat/native-chat-composer-types.tssrc/renderer/src/components/native-chat/use-native-chat-picker-state.tssrc/renderer/src/components/native-chat/use-structured-agent-session.test.tsxsrc/renderer/src/components/native-chat/use-structured-agent-session.tssrc/shared/agent-session-wire.tssrc/shared/structured-agent-session-coalescer.tssrc/shared/structured-agent-session-reducer.test.tssrc/shared/structured-agent-session-reducer.ts
💤 Files with no reviewable changes (1)
- src/main/claude/claude-structured-session-state.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/renderer/src/components/native-chat/use-structured-agent-session.test.tsx
- src/renderer/src/components/native-chat/native-chat-composer-types.ts
- src/renderer/src/components/native-chat/use-native-chat-picker-state.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
| return replacePage(event.page, event.fence, event.handoff, event.backgroundTasks) | ||
| return { | ||
| ...replacePage(event.page, event.fence, event.handoff, event.backgroundTasks), | ||
| commands: event.commands |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve commands when a snapshot or reset omits the field.
The wire contract defines an omitted commands field as unchanged. This assignment replaces an existing catalog with undefined on such a frame. The picker can then leave the provider catalog and use its fallback after a snapshot or reset. Preserve state.commands when event.commands === undefined; only replace it for an array or null.
Proposed fix
- commands: event.commands
+ commands: event.commands !== undefined ? event.commands : state.commands📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| commands: event.commands | |
| commands: event.commands !== undefined ? event.commands : state.commands |
QA evidence (Grok worker, read-only)Head tested: Structured Claude Chat was created in a throwaway local repo. Until a completed turn,
Fallback (disk scan; not a catalog pass)After session catalogFocused unit tests: 6 files / 109 passed. Coordinator owns the final status comment. Not calling merge-safe: catalog is empty until the first completed turn, |
QA addendum (supersedes first-turn-gap wording)Head: Pre-turn: After first SSH structured launch is local-only ( Pre-turn fallbackPost-turn catalog (no restart) |
|
Precision on pre-turn RPC: |
|
Source review and rendered QA completed at
Provider limitation: Claude 2.1.261 supplies classified catalog metadata only when the first turn starts. Its early initialize descriptors include terminal-only commands without hide/type metadata, so the existing fallback remains until the classified report arrives. Pre-turn authoritative catalog availability is not claimed. Live Windows/Linux/WSL/mobile and mixed-version pairing were not exercised. Direct SSH/WSL structured chat is currently gated to the PTY path; no SSH end-to-end pass is claimed. Idle reload is covered by automated tests rather than a separate provider reload demo. Working tree is clean. PR left unmerged. Review-session bookkeeping is incomplete: the local Orca orchestration runtime became unavailable after QA cleanup, so final QA/readiness worker settlement could not be confirmed. Reports and screenshot evidence are preserved; no worker exit is inferred from connection loss. |
|
Resolved the conflicts with main and pushed Independent conflict review was clean. All 96 focused tests, full typecheck, lint, formatting, and commit hooks passed. Working tree is clean; PR remains unmerged. |
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. The per-session slash-command catalog is now also published over the subscription stream (live updates), and that path is correct and well-covered. Approval is still held on the pre-existing sanitization-asymmetry thread on
src/shared/native-chat-slash-commands.ts(session-reported command names flow verbatim while reported skill names are gated byisTokenSafe), which this delta does not touch.
Reviewed changes
- Published the catalog over the subscription stream —
AgentSessionSubscribersgained areadCommandshook and now attaches an additivecommandsfield tosnapshot/batch/resetevents, detecting catalog changes by reference (ClaudeSlashCommandCatalogreturns a stable array until it actually changes, so "omit when unchanged" holds). - Threaded
commandsthrough the reducer and coalescer —StructuredAgentSessionState.commandsmerges catalog-only checkpoints without disturbing transcript/submission identity, andmergeBatchpreserves the field across coalesced frames. - Wired the adapter trigger — a
messageframe that changes the catalog callssession.events?.publish(), so subscribers emit the new commands even with no journal advance; the reconnect path re-sends the catalog on checkpoint.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. Seeding the catalog from the
initializecontrol response and marking those nameskindUnspecifiedis correct and well-covered, including a real-CLI handshake test. Approval is still held on the pre-existing sanitization-asymmetry thread onsrc/shared/native-chat-slash-commands.ts(session-reported command names flow verbatim while reported skill names are gated byisTokenSafe), which this delta does not touch.
Reviewed changes
- Seeded the catalog before the first stream init —
ClaudeSlashCommandCatalognow takes aninitializationargument and populatescommandsfrom the SessionStartinitializeresponse, so the picker is driven by real membership during the pre-init window instead of falling back to the curated list. - Added an unclassified membership state —
AgentSessionSlashCommandandSlashCommandSuggestiongain an additivekindUnspecified?: true, set for control-seeded and descriptor-only reloads until a stream init withslash_commandssupplies skill classification. - Resolved unclassified names against the disk scan —
buildNativeChatPickerItemstreats unclassified names that match a discovered skill as skills (with description/scope) and keeps the rest as commands, without re-reviving scanned skills the session never reported. - Republished classification becoming authoritative —
observenow compareskindUnspecifiedtoo, so a name whose kind flips from unspecified to classified triggers a live update even when name and kind are otherwise unchanged.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
QA evidence (Grok, Electron CDP) — supersedes fallback-only reportHead tested (recorded at hidden rebuild): Restored the earlier unpublished session, closed it, and launched a fresh structured Claude Chat. No prompt yet: Selecting Before first turnSkill Enter + safe text (same session)SSH (bounded attempt, not a remote catalog pass)Throwaway Linux Docker Not claimed: authoritative empty skill list, idle |
Follow-up smoke (open-picker Enter completion)Head: Typed |
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. The merge of
maininto the branch is clean — the catalog implementation is byte-for-byte unchanged since the last review — and the only new change is a two-line test-fixture completion. Approval remains held on the pre-existing sanitization-asymmetry thread onsrc/shared/native-chat-slash-commands.ts, which this delta does not touch.
Reviewed changes
- Merged
main(2e8fa3f) into the branch — pulled infirst-work-branch-rename(#19138), the packaged-browser E2E workflow, and the structured status-feed work. The overlappingstructured-agent-session-host.tsresolved correctly:readCommands(PR) andnow/onStatusChanged(main) are both present. - Completed merged journal fixtures — added the now-required
lastActivityAt: () => 1to twoAgentSessionJournalmocks insrc/main/agent-hooks/first-work-branch-rename.test.ts.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Review complete at Same-model/effort review loops and the start/end readiness audits completed with no remaining proven in-scope findings. The focused fixes preserve authoritative empty catalogs, deliver idle changes and reconnect clearing through the existing stream, parse real provider reload descriptors, and seed the catalog before the first prompt. Known skills retain Enter completion. No additional polling, command RPCs, or stream opcode was introduced. Concurrent main updates were integrated normally; CI also required two missing methods in test fixtures, with no production workaround. Validation: regression ablations reproduced the failures; final checks passed 111 integration tests, 13 real-release cross-version tests, full typecheck, and changed-code quality. All CI checks are complete: 19 successful, 9 skipped. Grok rebuilt hidden Electron from the final commit and verified a fresh session reports the project command and skill before any prompt, with First Enter completes the draft: Second Enter invokes the skill: Coverage limits: SSH login to the throwaway Linux host worked, but Orca connection was blocked by the dev build's missing Linux ARM64 relay package; structured Chat also currently has a local-only launch gate. No live remote-catalog pass is claimed. Empty-catalog and idle-reload behavior are covered by automated tests, not live screenshots. Native mobile/Windows/WSL and live mixed-version pairing were not exercised. |
Main centralised the launch gate in structured-native-chat-launch-route, where it re-added the client-side codex+win32 refusal. Delete that blocker there instead, so the renderer and orchestration both stop guessing; createSupport still answers. Drops the now-unread platform input end to end. Also dedupes two shadowed lastActivityAt keys that arrived from main in #19127 and fail tsc; the later value already won, so behaviour is unchanged.
…ude session actually loaded (stablyai#19127)
…ude session actually loaded (stablyai#19127)
…ude session actually loaded (stablyai#19127)
























The Claude Chat UI slash picker previously combined a curated command list with a disk skill scan, so it missed commands and skills loaded by the active session and could offer skills that session never loaded.
The picker now uses the session's reported catalog, including the initialization response available before the first prompt. Disk discovery enriches matching skills with descriptions and scope, and preserves their token-completion behavior when the provider has not yet classified an entry. Explicit provider classification takes precedence. An empty catalog is authoritative; an unavailable catalog preserves the existing fallback.
Idle reloads and reconnects update the mounted picker through optional metadata on the existing session stream. Reload parsing accepts the provider's command descriptors, reported terminal-only entries are excluded, and unchanged catalogs are omitted from ordinary output frames. This reuses existing initialization and subscription paths without additional command RPCs, polling, or stream opcodes.
Validation:
Grok validated hidden Electron on final commit
d5a8f8f009: the real catalog contains the project command and skill before any prompt and excludes unsupported help. Enter on a selected skill completes the draft with zero history items; a second Enter invokes it successfully. Screenshots are attached in the review comments.Final verification includes 111 integration tests, 13 real-release cross-version tests, full typecheck, changed-code quality, and 19 successful CI checks (9 skipped). The review and final readiness audit have no remaining proven in-scope findings.
Live SSH catalog QA was attempted but blocked by the dev build's missing Linux ARM64 relay package and the current local-only structured Chat launch gate. Empty-catalog and idle-reload behavior have automated coverage; native mobile/Windows/WSL and live mixed-version pairing were not exercised.