Repository navigation
Preserve Rust session-message errors on the App SDK source line - #2912
dfrysinger wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7ae87499-d464-4758-9172-947a5a2d05b1
Cross-SDK Consistency ReviewThis PR modifies only the Rust SDK (
Cross-SDK comparison:
Overall the change is internally consistent within Rust; the main follow-up suggestion is to mirror the
|
There was a problem hiding this comment.
Generated by SDK Consistency Review Agent for #2912 · copilot · sonnet50 · 36.4 AIC · ⌖ 12 AIC · ⊞ 5.1K
| #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct ListMessageableSessionsRequest { | ||
| /// Optional exact session name query. Matching semantics are owned by the local host. |
There was a problem hiding this comment.
This PR extends ListMessageableSessionsRequest with a new location field (MessageableSessionLocation::Local/Remote) so cross-session messaging discovery can be scoped to local vs. remote producers, and broadens MessageableSession/SendSessionMessageRequest docs to cover remote sessions as well.
The Node.js/TypeScript SDK has a parallel listMessageableSessions/sendSessionMessage API (nodejs/src/session.ts) but its ListMessageableSessionsRequest only has name?: string — there's no location/MessageableSessionLocation equivalent. For feature parity, consider adding the same location option ("local" | "remote") to the Node.js request type and wiring it through listMessageableSessions.
Note: Python, Go, .NET, and Java don't appear to implement listMessageableSessions/sendSessionMessage at all yet, so this isn't a regression for them, just a pre-existing parity gap to be aware of for future work.
| message_id: Option<String>, | ||
| /// Stable runtime failure identifier, when reported. | ||
| failure_code: Option<String>, | ||
| }, |
There was a problem hiding this comment.
The new failure_code: Option<String> field on SessionErrorKind::SendSessionMessage (a stable runtime failure identifier parsed from the error envelope's failureCode) doesn't have an equivalent in the Node.js SDK's SendSessionMessageError (nodejs/src/session.ts), which only carries code and messageId. Consider surfacing failureCode there too (and in any future Python/Go/.NET/Java implementations) so callers across languages get the same diagnostic detail from a failed cross-session message send.
Summary
This backport lets the Rust SDK report session-message delivery failures without losing the original Runtime or transport error. It also restores the discovery location types already supported by the App, so a normal SDK sync does not remove local and remote session selection.
The SDK makes one message request. A valid Runtime failure becomes a typed delivery result with the original error available through
source(). A transport failure is ambiguous and does not invent a message ID. Malformed or unrelated RPC errors pass through unchanged. There is no retry or alternate delivery path.flowchart TD Send["Send one session-message request"] --> Result{"Request result"} Result -->|Success| Success["Return the Runtime result"] Result -->|Transport failure| Ambiguous["Return ambiguous delivery without inventing an ID"] Result -->|RPC failure| Envelope{"Valid message-failure envelope?"} Envelope -->|Yes| Typed["Return typed delivery failure and retain the original cause"] Envelope -->|No| Original["Return the original RPC error"]Source line and scope
The base is
dfrysinger/cross-session-runtime-admission, at the App's existing SDK source commit8f6a864323f1093a1cffd2ed2ff40747764305a6. This PR changes four Rust files on that line. It does not upgrade the SDK or downgrademain. The source line's earlier PR is closed and remains closed; integrating that foundation intomainis separate work.The discovery restoration copies the existing App contract into canonical SDK source. It adds no new selector or wire behavior. After this source commit is published, the App can use its normal sync script rather than editing vendor files.
This fixes SDK error handling used by the remote-messaging service work and the App integration.
Evidence and remaining acceptance
Seven focused send tests and three discovery tests pass, including original-error preservation, malformed envelopes, transport ambiguity, single-request behavior, and local/remote discovery serialization. Scoped Cargo check, Clippy, and formatting pass. Both focused source reviewers found no defects.
This is a draft source backport, not installed acceptance or release approval. Normal App intake, current Runtime integration, installed behavior, and any integration into SDK
mainremain separate gates.