feat(command): add noReply flag to skip LLM dispatch for display-only commands#27521
Open
PeterPonyu wants to merge 1 commit into
Open
feat(command): add noReply flag to skip LLM dispatch for display-only commands#27521PeterPonyu wants to merge 1 commit into
PeterPonyu wants to merge 1 commit into
Conversation
… commands Some plugins emit panels/confirmations via `command.execute.before` and have no need for an assistant turn after. Without a way to signal that intent, the command path always dispatches the LLM, wasting a round-trip per display-only command. Adds optional `noReply` to the command schema. When set, the dispatch path forwards `noReply: true` to `prompt()` which already short-circuits at prompt.ts:1387. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
1 task
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Related: #26022 (existing tracked issue for the same mechanism — that one targets
chat.message, this PR targetscommand.execute.before; same underlyingPromptInput.noReplyshort-circuit).The companion issue I filed for this PR (#27520) was auto-closed by the compliance bot at 13:07 today for a title-prefix template mismatch (needed
[FEATURE]:); see the bot's comment there for the cross-reference to #26022.Type of change
What does this PR do?
Adds an optional
noReplyflag to the command schema. When set, the command dispatch path forwardsnoReply: truetoprompt(), which already short-circuits at the existingif (input.noReply === true) return messageguard.Why this matters: a plugin I maintain ships display-only slash commands (panels, confirmations) where the model has nothing useful to say after the command output. Today the command dispatch always invokes the LLM for the next assistant turn, wasting a round-trip. The plugin side can't suppress this —
command.execute.beforeonly returns{ parts },chat.messageonly returns{ message, parts }, andsession.abortfrom a hook races the runner becoming busy.The patch is opt-in and additive. Existing commands without
noReplykeep their current behavior.How did you verify your code works?
bun run typecheckclean (14/14 tasks)bun test test/session/prompt.test.ts— 53 pass / 0 fail on the cherry-picked branchnoReply: truecommand both show zeroservice=llm streamlines. On an unpatched build, the post-command window contains the dispatch.Screenshots / recordings
Not a UI change.
Checklist