Skip to content

Consolidate PopupQuestion and AskYesNo into one question#2194

Open
GeorgeNgMsft wants to merge 4 commits intomainfrom
dev/georgeng/simplify_question
Open

Consolidate PopupQuestion and AskYesNo into one question#2194
GeorgeNgMsft wants to merge 4 commits intomainfrom
dev/georgeng/simplify_question

Conversation

@GeorgeNgMsft
Copy link
Copy Markdown
Contributor

@GeorgeNgMsft GeorgeNgMsft commented Apr 14, 2026

Simplify client interaction API: unify askYesNo + popupQuestion into question

Summary
Merges two overlapping client interaction methods — askYesNo (boolean yes/no prompt tied to a request) and popupQuestion (multi-choice popup outside a request) — into a single unified question(requestId, message, choices, defaultId?, source?) method.
question always returns a choice index; callers that need a boolean use thin askYesNo()/popupQuestion() wrappers on SessionContext that convert to/from index.
requestId is now RequestId | undefined, allowing questions to be asked both inside and outside a request context without a separate method.
PendingInteractionType shrinks from three variants (askYesNo, proposeAction, popupQuestion) to two (question, proposeAction), simplifying the discriminated union used across the RPC layer.
Updates all callers: CLI enhanced console, shell renderer, dispatcher command server, shared dispatcher, service worker connection, onboarding test handler, and related tests/docs.
Fixes a regression where the question prompt was not appearing in the shell.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR consolidates the previous askYesNo and popupQuestion interaction flows into a single question interaction that returns a numeric choice index, while preserving higher-level ergonomic wrappers.

Changes:

  • Replaces askYesNo / popupQuestion in ClientIO and pending-interaction types with a unified question(...) => Promise<number> API.
  • Updates dispatcher/server/client RPC wiring and interaction management to use question + defaultId.
  • Updates CLI/Shell implementations and tests to render/handle unified question prompts and responses.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ts/packages/shell/src/renderer/src/main.ts Replaces renderer-side askYesNo/popupQuestion stubs with unified question handler.
ts/packages/shell/src/main/instance.ts Main process intercept now implements question via dialog.showMessageBox.
ts/packages/dispatcher/types/src/pendingInteraction.ts Unifies pending interaction union into question + proposeAction.
ts/packages/dispatcher/types/src/displayLogEntry.ts Aligns pending-interaction log entry fields with unified question shape.
ts/packages/dispatcher/types/src/clientIO.ts Replaces askYesNo/popupQuestion with question(requestId?, message, choices, defaultId?, source?).
ts/packages/dispatcher/rpc/src/clientIOTypes.ts Updates RPC invoke surface to question and removes popup/yesno calls.
ts/packages/dispatcher/rpc/src/clientIOServer.ts RPC server delegates question to clientIO.question.
ts/packages/dispatcher/rpc/src/clientIOClient.ts RPC client invokes question instead of askYesNo/popupQuestion.
ts/packages/dispatcher/dispatcher/src/context/pendingInteractionManager.ts Stores defaultId for question cancellation/timeout behavior.
ts/packages/dispatcher/dispatcher/src/context/interactiveIO.ts askYesNoWithContext now calls clientIO.question and maps index↔boolean.
ts/packages/dispatcher/dispatcher/src/execute/sessionContext.ts popupQuestion wrapper now delegates to question.
ts/packages/dispatcher/dispatcher/src/displayLog.ts logPendingInteraction updated to log unified question fields.
ts/packages/cli/src/enhancedConsole.ts CLI prompt parsing/rendering now uses unified question handling and index responses.
ts/packages/agentServer/server/src/sharedDispatcher.ts Server now creates and broadcasts question pending interactions.
ts/packages/agentServer/docs/multi-client-interactions.md Documentation updated to describe the unified question interaction type.
Various test files Tests updated to use question requests/responses and numeric indices.
Comments suppressed due to low confidence (1)

ts/packages/cli/src/enhancedConsole.ts:1

  • The fallback branch formats any non-numeric entry.response as a yes/no (truthy -> yes), which will misrepresent proposeAction responses (typically objects) as "yes". Change the fallback to stringify non-question responses (e.g., String(entry.response)), and only apply yes/no formatting when you can positively identify a binary question (e.g., pending.choices equals [\"Yes\",\"No\"] and response is numeric).
// Copyright (c) Microsoft Corporation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GeorgeNgMsft GeorgeNgMsft marked this pull request as ready for review April 14, 2026 20:35
@GeorgeNgMsft GeorgeNgMsft removed this pull request from the merge queue due to a manual request Apr 14, 2026
@GeorgeNgMsft GeorgeNgMsft added this pull request to the merge queue Apr 14, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Apr 15, 2026
@GeorgeNgMsft GeorgeNgMsft added this pull request to the merge queue Apr 15, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants