Skip to content

feat: support optional message provenance across all SDKs - #2564

Open
aurokin wants to merge 1 commit into
mainfrom
aurokin-sdk-agent-message-provenance
Open

feat: support optional message provenance across all SDKs#2564
aurokin wants to merge 1 commit into
mainfrom
aurokin-sdk-agent-message-provenance

Conversation

@aurokin

@aurokin aurokin commented Sep 8, 2026

Copy link
Copy Markdown

Summary

Fixes #2563.

Expose the runtime's existing source field through the high-level send APIs in all six SDKs. This lets applications forward agent-originated messages without losing their provenance.

SDK Public API
Node/TypeScript MessageOptions.source
Python source= on send and send_and_wait
Go MessageOptions.Source *string
.NET MessageOptions.Source
Java MessageOptions.getSource() / setSource(...)
Rust MessageOptions.source / with_source(...), plus handwritten rpc::SendRequest::with_source(...)

Source is omitted when unset and forwarded unchanged when supplied. Clone and send-and-wait paths preserve it. Billing, delivery modes, attachments, display prompts, tracing, and correlation defaults remain unchanged. Generated files, schema visibility, dependencies, and CLI pins are untouched.

The shared steering documentation distinguishes provenance, delivery urgency, and response expectations. A successful high-level send acknowledgement returns a message ID and confirms acceptance, not recipient consumption. An accepted message should not be automatically resent merely because no visible reply appears.

Validation

Targeted validation completed locally on macOS arm64:

SDK Result
Node/TypeScript 17 tests across session-source.test.ts and session-send-and-wait.test.ts; typecheck, declaration emission, ESLint, and Prettier passed
Python 16 tests in test_session.py; Ruff and ty passed
Go Six send-wire cases plus send-and-wait with and without source; go vet . passed
.NET 17 source, string-overload, typed-RPC, and clone tests on net8.0; scoped formatting passed
Java mvn verify -pl sdk -Pskip-test-harness -Dtest=MessageSourceTest,MessageAttachmentTest,ConfigCloneTest -DskipITs: 60 tests passed, including 16 provenance tests covering both delivery modes; Checkstyle, scoped Spotless, and Java 25 overlay verification passed
Rust 155 tests across session_test and api_types_test; all test targets compiled; all-target Clippy, formatting, and rustdoc passed

The Rust local-runtime regression also executed against official standalone Copilot CLI 1.0.83. Its eight cases cover high-level and typed-RPC sends, enqueue and immediate delivery, and supplied and omitted source. The test uses synthetic inference and verifies the resulting user.message provenance and correlation.

Fresh code-review passes found no significant issues in the final six-language change set. The subsequent documentation-only acknowledgement clarification was reviewed separately.

Limits

Full E2E suites and cross-platform execution were not run. The new non-Rust regressions exercise request serialization and loopback transport, not live model sessions.

This is SDK passthrough, not an end-to-end remote-provenance guarantee. Mission Control currently accepts and locally echoes source but drops it from remote HTTP delivery. No remote transport redesign or consumer-app integration is included.

Expose optional source in all six high-level SDK send APIs and preserve it through cloning and send-and-wait paths. Add a handwritten Rust typed-RPC builder, wire regressions, local runtime coverage, and documentation of acknowledgement and reply semantics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 8, 2026 01:37
@aurokin
aurokin requested a review from a team as a code owner September 8, 2026 01:37
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

SDK Consistency Review

Reviewed PR #2564, which adds an optional message provenance source field to MessageOptions/SendRequest and threads it through session.send() / send_and_wait().

Result: ✅ Consistent across all six SDKs.

SDK Field/Property Convention Serialized as Tests
Node.js/TS source?: string camelCase source (omitted if undefined) nodejs/test/session-source.test.ts
Python source: str | None = None snake_case source (omitted if None) python/test_session.py
Go Source *string PascalCase (exported) source,omitempty go/session_test.go
.NET Source (get/set) PascalCase Source (nullable, omitted) dotnet/test/Unit/ClientSessionLifetimeTests.cs, CloneTests.cs
Java getSource()/setSource() camelCase + fluent setter @JsonProperty("source") MessageSourceTest.java (new)
Rust pub source: Option<String> + with_source() builder snake_case + builder pattern source (omitted if None) rust/tests/api_types_test.rs, session_test.rs

Observations:

  • Semantics are identical everywhere: optional, defaults to unset/omitted, forwarded unchanged to the RPC layer, documented with the same accepted forms (user, system, command-<id>, schedule-<numeric-id>, agent-<id>).
  • Doc comments are consistently worded across languages (provenance ≠ response requirement, doesn't affect billing/delivery mode, remote backends may not retain it).
  • Clone/copy semantics for MessageOptions correctly propagate source in .NET, Java, and any language with a clone/copy helper.
  • docs/features/steering-and-queueing.md was updated to describe the new field, keeping cross-language docs in sync.
  • Test coverage mirrors across languages: default-omitted case, explicit value case, and interaction with mode/send_and_wait.

No API naming or behavioral inconsistencies found. Nice job keeping this feature addition uniform across the entire SDK surface.

Generated by SDK Consistency Review Agent for #2564 · copilot · sonnet50 · 32.4 AIC · ⌖ 11.9 AIC · ⊞ 9.7K ·

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

🟢 Approval recommended

The implementation consistently forwards and omits provenance as specified, with comprehensive cross-SDK regression coverage.

Review tier: Balanced
Findings: None

What changed in this PR

Exposes optional message provenance across all six SDKs while preserving existing send behavior.

Changes:

  • Adds source to high-level send APIs and Rust typed RPC.
  • Preserves source through cloning and send-and-wait paths.
  • Adds cross-language serialization, omission, delivery-mode, and runtime tests plus documentation.
File Description
rust/​src/​types.rs Adds source option and builder.
rust/​src/​session.rs Forwards source to JSON-RPC.
rust/​src/​rpc.rs Adds typed-request source builder.
rust/​tests/​session_test.rs Tests Rust wire behavior.
rust/​tests/​api_types_test.rs Tests typed request serialization.
rust/​tests/​e2e/​copilot_request_handler.rs Tests runtime propagation.
python/​copilot/​session.py Adds source keyword forwarding.
python/​test_session.py Tests Python send paths.
nodejs/​src/​types.ts Adds TypeScript source option.
nodejs/​src/​session.ts Forwards source in requests.
nodejs/​test/​session-source.test.ts Tests Node.js serialization.
go/​types.go Adds source fields.
go/​session.go Forwards source when sending.
go/​session_test.go Tests Go send paths.
dotnet/​src/​Types.cs Adds cloneable source property.
dotnet/​src/​Session.cs Serializes source in requests.
dotnet/​test/​Unit/​CloneTests.cs Tests source cloning.
dotnet/​test/​Unit/​ClientSessionLifetimeTests.cs Tests .NET send behavior.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​MessageOptions.java Adds source accessors and cloning.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​rpc/​SendMessageRequest.java Adds wire source field.
java/​sdk/​src/​main/​java/​com/​github/​copilot/​CopilotSession.java Copies source into requests.
java/​sdk/​src/​test/​java/​com/​github/​copilot/​MessageSourceTest.java Tests Java provenance behavior.
docs/​features/​steering-and-queueing.md Documents provenance semantics.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Expose optional message source provenance across SDK languages

2 participants