You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add agentId envelope field on session events for sub-agent attribution
The wire-protocol schema added top-level `agentId?: string` to every
session event envelope in commit f8cf846 ("Derive session event
envelopes from schema") for sub-agent attribution. Every other SDK
carries it; Rust silently drops it at the deserialization boundary.
Concretely: the schema describes `agentId` as "Sub-agent instance
identifier. Absent for events from the root/main agent and session-
level events." Without the field, Rust consumers can't distinguish
events emitted by a sub-agent from events emitted by the root agent.
Adds:
- `pub agent_id: Option<String>` on `types::SessionEvent` (hand-
authored consumer-facing).
- `pub agent_id: Option<String>` on
`generated::session_events::TypedSessionEvent` via codegen update
in `scripts/codegen/rust.ts`.
- `#[serde(rename = "agentId", skip_serializing_if = "Option::is_none")]`
via the existing container `rename_all = "camelCase"` (covered) plus
skip-on-None for clean wire output.
Round-trip tests cover both struct shapes — sub-agent event with the
field set, root-agent event without — to lock the parity in place
against future schema changes or codegen regressions.
Caught by a fresh parity audit against Node/Python/Go/.NET as part of
the post-main-merge gap review.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments