Cli - Support remote slash command discovery and execution#12169
Cli - Support remote slash command discovery and execution#12169eshurakov wants to merge 1 commit into
Conversation
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Fix these issues in Kilo Cloud Files Reviewed (5 files)
Previous Review Summaries (3 snapshots, latest commit 918194b)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 918194b)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit b2f1c53)Status: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Fix these issues in Kilo Cloud Files Reviewed (2 files)
Previous review (commit bde06ff)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Fix these issues in Kilo Cloud Files Reviewed (5 files)
Reviewed by gpt-5.6-sol · Input: 112.8K · Output: 17.4K · Cached: 935.3K Review guidance: REVIEW.md from base branch |
bde06ff to
b2f1c53
Compare
b2f1c53 to
918194b
Compare
918194b to
1ad95c0
Compare
| await services.command({ | ||
| sessionID: input.sessionID, | ||
| command: input.command, | ||
| arguments: input.arguments, |
There was a problem hiding this comment.
WARNING: Preserve the client's selected agent
The request schema has no agent, and this call consequently leaves SessionPrompt.command() to use cmd.agent ?? input.agent; for commands without a configured agent that means the default agent, not the agent active in the remote session. A remote /review or other generic command submitted from Plan mode can therefore run with different tools and permissions than the same command through the existing VS Code path, which explicitly forwards agent. Please carry a bounded agent identity through this protocol (or resolve the session's active agent server-side).
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| command: input.command, | ||
| arguments: input.arguments, | ||
| ...(input.messageID ? { messageID: MessageID.make(input.messageID) } : {}), | ||
| ...(input.model ? { model: `${input.model.providerID}/${input.model.modelID}` } : {}), |
There was a problem hiding this comment.
WARNING: Do not flatten an unrestricted structured provider ID
The wire model deliberately keeps providerID and modelID separate, but this conversion joins them with / and SessionPrompt.command() later splits at the first slash. RemoteModelCatalog and ProviderV2.ID accept arbitrary non-empty provider IDs, so a catalog entry such as { providerID: "gateway/team", modelID: "deployment/v1" } is reinterpreted as provider gateway and model team/deployment/v1. Please either preserve the structured identity through execution or reject provider IDs containing the delimiter at the protocol boundary.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ...(input.messageID ? { messageID: MessageID.make(input.messageID) } : {}), | ||
| ...(input.model ? { model: `${input.model.providerID}/${input.model.modelID}` } : {}), | ||
| ...(input.variant !== undefined ? { variant: input.variant } : {}), | ||
| }) |
There was a problem hiding this comment.
WARNING: Forward attached file parts with slash commands
The strict request schema cannot represent CommandInput.parts, and this execution object never forwards them. The established VS Code command path includes selected file/image parts, while SessionPrompt.command() appends those parts to every non-subtask command; remote clients must therefore either fail strict validation when they send attachments or silently run the command without the context the user selected. Please include a bounded file-parts field in the remote contract and pass it through here.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| } | ||
|
|
||
| function errorName(error: unknown) { | ||
| return error instanceof Error ? error.name : typeof error |
There was a problem hiding this comment.
WARNING: Do not treat Error.name as redacted metadata
Error.name is writable and can contain arbitrary plugin/provider data, so a thrower can set it to a credential-bearing value and this helper will log that value after the ACK. The new test only puts the secret in message while assigning a fixed safe name, so it does not exercise this leak path. Please log a fixed generic label or another value that is not controlled by the thrown instance.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
What
Adds remote slash command support to the session WebSocket protocol so remote clients (VS Code extension, Agent Manager) can discover and run workspace slash commands — including session compaction.
Why
Remote sessions previously had no way to list or invoke slash commands defined in the workspace. This wires the existing
Commandservice into the remote protocol via two new commands:list_commandsandsend_command.How
RemoteCommandmodule (packages/opencode/src/kilo-sessions/remote-command.ts): defines the protocol schemas (with per-field size caps), builds a safe catalog response (skipping malformed entries, truncating by count/byte budget), and resolves execution against real services.compactis handled as a local alias for the compaction flow.RemoteSenderdispatcheslist_commands/send_command, running each against the exact session directory via the existingprovideboundary.send_commandvalidates the command still exists in the catalog before ACKing; failures after the ACK are logged with only the error class (no message leakage), while pre-ACK failures return a safe error string.remote-command.test.tsand extendedremote-sender.test.ts(directory isolation, stale-command rejection, missing-session, post-ACK leak prevention).A changeset (
minor) is included.