Skip to content

Add optional response contract to Rust SDK messages - #2744

Draft
ellismg wants to merge 1 commit into
mainfrom
ellismg-optional-response-sdk-contract
Draft

ellismg wants to merge 1 commit into
mainfrom
ellismg-optional-response-sdk-contract

Conversation

@ellismg

@ellismg ellismg commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add MessageOptions.response_optional: Option<bool> and with_response_optional(bool) and forward responseOptional through high-level Session::send.
  • Expose the same optional flag in generated SendRequest, SendMessageItem, and UserMessageData types. Explicit false is serialized; unset values remain omitted.
  • Preserve existing response requirements by default. Runtime permits silent completion only for explicitly optional inputs; required messages in a combined turn still require output, and execution/provider errors are unaffected.

Runtime dependency

Requires the paired runtime optional-notification-response implementation: https://github.com/github/copilot-agent-runtime/pull/22365 (validated runtime commit beea6d004ef). SDK transports the flag; runtime enforces behavior. App opts in only for My Copilot routine idle notifications; error, plan-ready, and direct user requests remain required.

Generated source

Regenerated Rust with unchanged pinned CLI 1.0.87-0 schemas plus only the authoritative responseOptional property additions from the runtime producer. Preserves upstream structured-output fields. No CLI pin or TypeScript SDK changes.

Validation

  • Failing-first missing-API tests confirmed before implementation.
  • Five focused true/false/omitted/default/idle-completion tests pass.
  • Full Rust session target: 151 passed; formatting and whitespace checks pass.
  • App coordinator reports 20 focused Rust tests and six real-stack empty-turn E2Es passing with SDK 2e77fb6c and runtime beea6d004ef.

Expose response_optional and its builder on MessageOptions, forwarding explicit true and false while omitting None. Cover high-level and generated session.send serialization and idle-only completion.

Regenerate Rust types from pinned CLI 1.0.87-0 schemas with only the authoritative responseOptional property additions from the rebased runtime producer (SendRequest, SendMessageItem, UserMessageData), avoiding unrelated unpublished schema drift. Preserve upstream structured response support.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant