Skip to content

[SDK] Expose Ask User Variant Session Option - #2432

Open
MRayermannMSFT wants to merge 3 commits into
mainfrom
mrayermannmsft-sdk-ask-user-variant
Open

[SDK] Expose Ask User Variant Session Option#2432
MRayermannMSFT wants to merge 3 commits into
mainfrom
mrayermannmsft-sdk-ask-user-variant

Conversation

@MRayermannMSFT

@MRayermannMSFT MRayermannMSFT commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What

Adds typed askUserVariant create and cold-resume options across Node, Python, Go, .NET, Rust, and Java. Omission preserves legacy behavior, while Node E2E coverage verifies the structured tool schema.

Why

github/copilot-agent-runtime#15446 added structured ask-user selection, but SDK clients could not request it. This PR was stacked on #2430 for the stable 1.0.81 runtime update and is now rebased directly onto main after #2430 merged.

@github-actions

This comment has been minimized.

Base automatically changed from update-copilot-1.0.81 to main August 27, 2026 23:09
@MRayermannMSFT
MRayermannMSFT force-pushed the mrayermannmsft-sdk-ask-user-variant branch from 819dc05 to 702aaad 比较 August 27, 2026 23:13
@github-actions

This comment has been minimized.

@MRayermannMSFT
MRayermannMSFT marked this pull request as ready for review August 27, 2026 23:30
@MRayermannMSFT
MRayermannMSFT requested a review from a team as a code owner August 27, 2026 23:30
Copilot AI balanced review requested due to automatic review settings August 27, 2026 23:30
@MRayermannMSFT MRayermannMSFT added the post-to-slack Post PR to reviewers Slack channel label Aug 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

Review tier: Balanced
Findings: 5 Low severity

新建议题s introduced by this change (5)
Severity Finding
Low severity rust/​src/​types.rs — Introducing the elicitation-backed variant makes the existing public rustdoc contradictory:…
Low severity go/​types.go — The adjacent OnUserInputRequest comment still says that this handler enables ask_user
Low severity python/​README.md — The preceding on_user_input_request entry now overstates that it enables ask_user; for the new…
Low severity dotnet/​README.md — The preceding OnUserInputRequest entry now claims that it enables ask_user regardless of the…
Low severity java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​SessionConfig.java — This new variant makes the existing setOnUserInputRequest Javadoc at lines 919–923 inaccurate:…
What changed in this PR

Exposes the runtime’s selectable ask_user behavior across all six SDKs.

Changes:

  • Adds typed create/cold-resume options and JSON-RPC forwarding.
  • Preserves legacy behavior when omitted and adds validation/serialization tests.
  • Documents usage and verifies the structured schema through Node E2E coverage.
File Description
CHANGELOG.md Records the new session option.
dotnet/​README.md Documents .NET usage.
dotnet/​src/​Client.cs Forwards the option over RPC.
dotnet/​src/​Types.cs Defines the enum and configuration property.
dotnet/​test/​Unit/​ClientSessionLifetimeTests.cs Tests request serialization.
dotnet/​test/​Unit/​CloneTests.cs Tests configuration cloning.
go/​README.md Documents Go usage.
go/​client.go Validates and forwards the option.
go/​client_test.go Tests forwarding, omission, and validation.
go/​types.go Defines Go API and wire fields.
java/​README.md Documents Java usage.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​SessionRequestBuilder.java Copies the option into requests.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​AskUserVariant.java Defines the Java enum.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​CreateSessionRequest.java Adds the create wire field.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​ResumeSessionConfig.java Exposes the resume option.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​ResumeSessionRequest.java Adds the resume wire field.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​SessionConfig.java Exposes the create option.
java/​sdk/​src/​test/​java/​com/​github/​copilot/​ConfigCloneTest.java Tests configuration cloning.
java/​sdk/​src/​test/​java/​com/​github/​copilot/​SessionRequestBuilderTest.java Tests enum and request serialization.
nodejs/​README.md Documents Node usage.
nodejs/​src/​client.ts Forwards the option over RPC.
nodejs/​src/​index.ts Exports the public type.
nodejs/​src/​types.ts Adds the shared configuration option.
nodejs/​test/​client.test.ts Tests create/resume forwarding.
nodejs/​test/​e2e/​ui_elicitation.e2e.test.ts Verifies the structured tool schema.
python/​README.md Documents Python usage.
python/​copilot/​__init__.py Exports the public type alias.
python/​copilot/​client.py Validates and forwards the option.
python/​test_client.py Tests forwarding, omission, and validation.
rust/​README.md Documents Rust usage.
rust/​src/​types.rs Defines the enum and configuration fields.
rust/​src/​wire.rs Adds create/resume wire fields.
rust/​tests/​session_test.rs Tests request forwarding.
Suppressed comments (1)

go/types.go:1936

  • The resume config's adjacent OnUserInputRequest comment still says that it enables ask_user unconditionally. Under AskUserVariantElicitation, requests are delivered to OnElicitationRequest instead, so scope this comment to the legacy variant.
	// AskUserVariant selects the model-facing shape of the ask_user tool.
	// The zero value preserves legacy behavior. AskUserVariantElicitation also
	// requires OnElicitationRequest so the host can answer structured forms.
	AskUserVariant AskUserVariant

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust/src/types.rs
Comment thread go/types.go Outdated
Comment thread python/README.md Outdated
Comment thread dotnet/README.md Outdated
Comment thread java/sdk/src/main/java/com/github/copilot/rpc/SessionConfig.java
@github-actions

This comment has been minimized.

@MRayermannMSFT
MRayermannMSFT force-pushed the mrayermannmsft-sdk-ask-user-variant branch from 2a45198 to c8e4437 比较 August 28, 2026 07:00
@github-actions

This comment has been minimized.

MRayermannMSFT and others added 3 commits August 29, 2026 00:00
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The in-process transport does not expose current tool metadata for introspection, so keep the runtime schema assertion on the stdio cells where that RPC is supported.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@MRayermannMSFT
MRayermannMSFT force-pushed the mrayermannmsft-sdk-ask-user-variant branch from c8e4437 to 5c44dda 比较 August 29, 2026 07:00
@github-actions

Copy link
Copy Markdown
Contributor

✅ Cross-SDK Consistency Review — PR #2432

Feature: Selectable ask_user session behavior (askUserVariant / ask_user_variant)

All six SDK implementations are consistently updated in this PR:

SDK Type SessionConfig ResumeSessionConfig Wire serialization Tests
Node.js/TS AskUserVariant = "legacy" | "elicitation" askUserVariant? omitted when undefined
Python AskUserVariant = Literal["legacy", "elicitation"] ask_user_variant= omitted when None
Go type AskUserVariant string + consts AskUserVariant field omitempty ✅ + input validation
.NET enum AskUserVariant { Legacy, Elicitation } AskUserVariant? omitted when null
Java enum AskUserVariant { LEGACY, ELICITATION } setAskUserVariant() Jackson @JsonProperty
Rust enum AskUserVariant { Legacy, Elicitation } (#[default] = Legacy) .with_ask_user_variant() skip_serializing_if = "Option::is_none"

API semantics are consistent across all SDKs:

  • Omitting the option preserves legacy behavior (nothing sent on the wire)
  • "legacy" / LEGACY / Legacy selects the existing Q&A flow
  • "elicitation" / ELICITATION / Elicitation selects structured form flow
  • Both createSession and resumeSession (cold resume) accept the option
  • All SDKs document pairing elicitation with the elicitation handler

Input validation is present in Go (explicit validation function) and Python (ValueError check). Other SDKs rely on the type system to enforce valid values — this is appropriate for each language's idioms.

No cross-SDK consistency issues found. 🎉

Generated by SDK Consistency Review Agent for #2432 · sonnet46 50.4 AIC · ⌖ 5.53 AIC · ⊞ 6.6K ·

注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

post-to-slack Post PR to reviewers Slack channel

项目

None yet

Development

Successfully merging this pull request may close these issues.

2 participants