Skip to content

Expose local cross-session discovery and delivery - #2616

Open
dfrysinger wants to merge 5 commits into
mainfrom
dfrysinger/cross-session-runtime-admission
Open

Expose local cross-session discovery and delivery#2616
dfrysinger wants to merge 5 commits into
mainfrom
dfrysinger/cross-session-runtime-admission

Conversation

@dfrysinger

@dfrysinger dfrysinger commented Sep 11, 2026

Copy link
Copy Markdown

Summary

  • add source-bound Node and Rust APIs for listing active local messageable sessions
  • add exact-target cross-session delivery with typed refused, not-delivered, and ambiguous terminal errors
  • keep authenticated recipient admission inside the runtime rather than exposing caller-controlled provenance through the SDK
  • ensure generated session-scoped TypeScript calls always overwrite any caller-provided source session ID

Runtime dependency

This SDK surface consumes the local transport, provenance, target-claim, and recipient-admission contract in github/copilot-agent-runtime#19586. The runtime owns wire security and recipient admission. The SDK exposes only source-bound discovery and delivery so CLI and App consumers do not implement separate local protocols. Same-computer discovery and delivery do not require remote control or remote export.

The unreleased discovery and delivery wire types live in the hand-written SDK facades until the runtime schema reaches the SDK pinned CLI release. Generated files remain reproducible from that pinned release.

Validation

  • Node typecheck and formatting
  • 70 focused Node tests for discovery, delivery, event types, and source identity
  • Rust compile check
  • 2 Rust discovery tests
  • 4 Rust delivery tests
  • deterministic pinned-schema generation and whitespace checks

dfrysinger and others added 3 commits September 1, 2026 21:22
Add a hand-written typed `Session::admit_authenticated_cross_session_input`
for the runtime's private direct-host-only
`session.lifecycle.admitAuthenticatedCrossSessionInput` method. The public
request types carry only caller-variable fields; the wire `version`, `kind`,
`origin`, and `integrity` discriminators are stamped by private wire types
during request conversion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5b6a7c90-1ad5-47e3-83a3-a87b895fb13c
Add session-bound Node and Rust SDK operations for listing active local peers and sending an exact-ID message through the runtime contract. Preserve typed refused, not-delivered, and ambiguous outcomes without retrying an uncertain delivery.

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

Copilot-Session: ea23a388-a87d-436d-8110-4f7f543141d6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ea23a388-a87d-436d-8110-4f7f543141d6
Copilot AI balanced review requested due to automatic review settings September 11, 2026 00:21
@dfrysinger
dfrysinger requested a review from a team as a code owner September 11, 2026 00:21
Comment thread nodejs/test/session-list-messageable-sessions.test.ts Fixed
Comment thread nodejs/test/session-send-session-message.test.ts Fixed
@github-actions

This comment has been minimized.

@github-actions github-actions Bot 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.

Generated by SDK Consistency Review Agent for #2616 · copilot · sonnet50 · 110.6 AIC · ⌖ 13.3 AIC · ⊞ 8.3K

Comment thread rust/src/session.rs Outdated
/// [`Client::call`](crate::Client::call)). If the caller's future is
/// dropped after the frame is enqueued, the admission still lands and
/// the runtime processes it normally.
pub async fn admit_authenticated_cross_session_input(

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.

Cross-SDK consistency: admit_authenticated_cross_session_input (backed by session.lifecycle.admitAuthenticatedCrossSessionInput, plus the new CrossSessionInput/CrossSessionPresentation/CrossSessionRecipientContext types) is added only to the Rust SDK. Since this is documented as usable by "a host embedding the SDK in-process (or over the direct local transport)", Node.js hosts embedding the SDK in-process would plausibly want the same capability, but no equivalent was added to nodejs/src/session.ts in this PR. If this omission is intentional (e.g., Node hosts don't embed the runtime the same way), consider noting that in the PR description; otherwise this looks like a parity gap worth tracking for the Node SDK, and eventually Python/Go/.NET/Java if this capability becomes broadly useful.

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

🟡 Changes recommended

Unresolved critical code-generation, compatibility, re-export, and API-boundary issues remain.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 2 High severity

New issues introduced by this change (2)
Severity Finding
High severity rust/​src/​session.rs — Keep the private admission producer out of the public API
High severity rust/​src/​types.rs — Preserve the public rpc type import path
What changed in this PR

Adds local cross-session discovery and exact-target delivery APIs for Node and Rust, with source binding, typed delivery errors, and authenticated admission.

Changes:

  • Adds generated and high-level discovery/delivery APIs.
  • Adds authenticated admission models and typed terminal errors.
  • Updates bindings, exports, code generation, and focused tests.
File Summary / review notes
scripts/​codegen/​typescript.ts Ensures bound source session IDs override caller parameters.
rust/​tests/​session_test.rs Tests admission, discovery, delivery, and failure outcomes.
rust/​src/​types.rs Adds admission models and wire conversion. Critical (1 vote): preserve the public github_copilot_sdk::rpc::PermissionDecisionSource facade. Nit (1 vote): use an explicit named conversion instead of From.
rust/​src/​session.rs Adds Rust discovery, delivery, and admission APIs. Critical (2 votes): keep authenticated admission behind an internal host adapter. Nit (1 vote): add experimental notices to the public methods.
rust/​src/​lib.rs Preserves structured RPC error data.
rust/​src/​generated/​session_events.rs Adds cross-session event types and fields. Critical (1 vote each): preserve the stable permission-source re-export and apply compatibility protection such as #[non_exhaustive] to extended public event structs.
rust/​src/​generated/​rpc.rs Adds generated Rust RPC methods.
rust/​src/​generated/​api_types.rs Adds generated request and result types.
rust/​src/​errors.rs Adds typed delivery error variants.
nodejs/​tsconfig.test.json Updates test TypeScript configuration.
nodejs/​test/​session-send-session-message.test.ts Tests delivery and terminal error behavior.
nodejs/​test/​session-list-messageable-sessions.test.ts Tests discovery and source binding.
nodejs/​src/​types.ts Exposes cross-session types.
nodejs/​src/​session.ts Adds Node discovery, delivery, and typed errors. Nit (1 vote): document targetSessionId explicitly.
nodejs/​src/​index.ts Exports new public Node APIs.
nodejs/​src/​generated/​session-events.ts Adds generated cross-session event types.
nodejs/​src/​generated/​rpc.ts Adds generated cross-session RPC bindings. Critical (1 vote): regenerate all schema-derived language outputs or explicitly change the generation contract, since the shared codegen check currently lacks corresponding Python, Go, and .NET definitions.

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

Comment thread rust/src/session.rs Outdated
Comment on lines +759 to +762
pub async fn admit_authenticated_cross_session_input(
&self,
request: AdmitAuthenticatedCrossSessionInputRequest,
) -> Result<(), Error> {
Comment thread rust/src/types.rs Outdated
PermissionDecisionReject, PermissionDecisionSurface, PermissionDecisionUserNotAvailable,
PermissionResponseCapability,
};
pub use crate::generated::session_events::PermissionDecisionSource;
Define unreleased discovery and delivery wire types in the SDK facade while leaving generated bindings reproducible from the pinned CLI schema. Replace unreachable compile assertions with callable type checks.

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

Copilot-Session: ea23a388-a87d-436d-8110-4f7f543141d6
@github-actions

Copy link
Copy Markdown
Contributor

SDK Consistency Review

This PR adds a new cross-session messaging feature (sendSessionMessage / listMessageableSessions) to the Node.js and Rust SDKs only. The Node.js and Rust implementations are consistent with each other:

Aspect Node.js Rust
List messageable sessions session.listMessageableSessions(params?) session.list_messageable_sessions(params: Option<...>)
Send message session.sendSessionMessage(params) session.send_session_message(params)
Result types ListMessageableSessionsResult, SendSessionMessageResult, MessageableSession same names (Rust structs)
Error handling SendSessionMessageError with code: SendSessionMessageErrorCode ("refused" | "not-delivered" | "ambiguous") parsed from the RPC error envelope SessionErrorKind::SendSessionMessage { code: SendSessionMessageErrorCode, message_id } parsed the same way (Refused/NotDelivered/Ambiguous)
Delivery modes SessionMessageDelivery = "idle" | "steering" | "queued" mirrored

Naming/casing follows each language's conventions correctly (camelCase in TS, snake_case in Rust), and the error-classification logic (session_message_refused, session_message_not_delivered, session_message_ambiguous envelope kinds, and the specific "refused" sub-codes) is duplicated faithfully between the two implementations.

Cross-SDK gap

No equivalent API was found in Python (python/copilot/), Go (go/), .NET (dotnet/src/), or Java (java/sdk/src/main/java/) — confirmed via search for sendSessionMessage/send_session_message/SendSessionMessage, listMessageableSessions/list_messageable_sessions/ListMessageableSessions in those trees (no matches).

This looks like new, still-experimental (@experimental) surface area rather than a bug fix, so it's plausible the remaining SDKs are intentionally being rolled out in follow-up PRs. If that's not the plan, consider tracking parity work (e.g. a follow-up issue) for:

  • Python: create_session-adjacent module exposing list_messageable_sessions() / send_session_message()
  • Go: ListMessageableSessions / SendSessionMessage methods on the session type, with an idiomatic Go error (likely a typed error or errors.Is-compatible sentinel) instead of exceptions
  • .NET: ListMessageableSessionsAsync / SendSessionMessageAsync with a custom exception type analogous to SendSessionMessageError
  • Java: listMessageableSessions / sendSessionMessage returning CompletableFuture, with a checked/unchecked exception mirroring SendSessionMessageErrorCode

No other consistency issues were found — the scripts/codegen/typescript.ts change (reordering { sessionId, ...params }{ ...params, sessionId }) is a Node.js-only codegen ordering fix reflected correctly and consistently across the whole regenerated nodejs/src/generated/rpc.ts, and doesn't need mirroring elsewhere since it's TypeScript-codegen-specific.

Generated by SDK Consistency Review Agent for #2616 · copilot · sonnet50 · 42.5 AIC · ⌖ 12.3 AIC · ⊞ 8.3K ·

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.

3 participants