Repository navigation
Conversation
Route RPC questionnaires through the existing select and input fallback, and propagate cancellation signals to pending answers. Reject empty or whitespace freeform answers, responses that do not match an offered option label, duplicate question ids, and duplicate option labels with explicit errors. Render error results separately from user cancellation, and ignore late dialog responses after an abort. Update RPC documentation and regression coverage. Fixes stepfun-ai#253
li-xiu-qi
force-pushed
the
feat/rpc-clarify-user
branch
from
October 26, 2026 17:33
f0325a6 to
934d590
Compare
li-xiu-qi
marked this pull request as ready for review
October 26, 2026 17:42
li-xiu-qi
requested review from
MelodyVAR,
Uking-xxx,
ZouR-Ma and
liuedcson
as code owners
October 26, 2026 17:42
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.
Fixes #253
Problem
RPC mode already speaks the extension dialog protocol:
ctx.ui.select()andctx.ui.input()are translated intoextension_ui_request/extension_ui_responsemessages, andctx.hasUIistruebecause those methods are functional. Despite that,clarify_userrefused to run in RPC:executeQuestionnaireaccepted onlymode === "tui", so every RPC call failed withError: clarify_user requires an interactive UI.A second correction was needed on the same gate. The RPC context does expose
custom(), but it returnsundefinedand cannot render a native TUI dialog. Gating only ontypeof ctx.ui.custom === "function"would therefore send RPC down the native-dialog path and lose the question entirely.Changes
tuiandrpcinexecuteQuestionnaire;printandjsonkeep returning the "requires an interactive UI" error.ctx.mode === "tui"andctx.ui.customis callable. RPC reuses the existingexecuteFallback, so no new protocol messages are introduced.ctx.signalto the fallbackselect/inputcalls, so both a client-side cancellation and an Agent abort end a pending question. Late responses are dropped by the existing RPC pending map.#253regression suite.Behavior and compatibility
selectandinputrequests with the same shape.values, and freeform answers are preserved; a freeform answer still arrives as a follow-upinputrequest.details.cancelled: true; clients should display the error text rather than treating it as a user cancellation.tuimode.Validation
Final HEAD is
934d590dedc452f40b230ab1fca6d31dc43e3687.cd packages/coding-agent && pnpm exec vitest --run test/suite/regressions/253-rpc-clarify-user.test.ts: 10 tests passed.cd packages/coding-agent && pnpm exec vitest --run test/suite/regressions/253-rpc-clarify-user.test.ts test/step-capabilities-extension.test.ts test/rpc.test.ts test/rpc-jsonl.test.ts test/rpc-prompt-response-semantics.test.ts test/rpc-client-clear-queue.test.ts test/rpc-client-clone.test.ts test/rpc-client-process-exit.test.ts: 7 files passed and 1 skipped; 27 tests passed and 18 skipped.pnpm run checkpasses.renderResultassertion proving the empty-freeform error path renders the error text rather than "Clarification cancelled".Limitations
GitHub CI on Ubuntu with Node 22 passed for the final head:
build-check-testandCheck commit attributionare both successful.The native TUI dialog still ignores an empty editor submission instead of returning the new explicit RPC error. That is pre-existing TUI behavior outside this PR's RPC scope; RPC clients need no additional integration because the protocol frames are unchanged.