Skip to content

Comments

Include handler_agent_id in command websocket events#48

Merged
willwashburn merged 1 commit intomainfrom
sdk-fixes
Feb 21, 2026
Merged

Include handler_agent_id in command websocket events#48
willwashburn merged 1 commit intomainfrom
sdk-fixes

Conversation

@willwashburn
Copy link
Member

Changed

  • Added optional agent_id parsing for websocket message payloads.
  • Added handler_agent_id parsing for command.invoked websocket events.
  • Added websocket parity tests covering agent_id and handler_agent_id fields.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for tracking agent identifiers in websocket events by introducing handler_agent_id for command invocations and agent_id for message payloads. The changes ensure parity between TypeScript and Rust SDK implementations while maintaining backward compatibility where appropriate.

Changes:

  • Added required handler_agent_id field to command.invoked event schemas and transformations
  • Added optional agent_id field to message payload types in Rust SDK (MessageEventPayload, MessageUpdatedPayload, ThreadReplyPayload, DmEventPayload)
  • Added comprehensive parity tests in Rust SDK to validate the new fields

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/types/src/events.ts Added required handler_agent_id field to CommandInvokedEventSchema
packages/server/src/engine/wsTransform.ts Updated command.invoked transformation to include handler_agent_id
packages/server/src/engine/tests/wsTransform.test.ts Updated test to verify handler_agent_id is correctly transformed
packages/sdk-rust/src/types.rs Added optional agent_id to message payloads and required handler_agent_id to CommandInvokedEvent
packages/sdk-rust/tests/parity.rs Added tests for agent_id deserialization and handler_agent_id requirement
packages/sdk-rust/Cargo.toml Bumped version to 0.2.4
packages/sdk-rust/CHANGELOG.md Added changelog entry for 0.2.4 release

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}

#[test]
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test verifies that agent_id can be deserialized when present, but doesn't verify that it's truly optional. Consider adding a test case that deserializes a message.created event without the agent_id field to ensure the serde(default) annotation works correctly and the field is genuinely optional.

Suggested change
#[test]
#[test]
fn ws_message_created_allows_missing_agent_id() {
let event = serde_json::from_value::<WsEvent>(json!({
"type": "message.created",
"channel": "general",
"message": {
"id": "m_2",
"agent_name": "bob",
"text": "hi",
"attachments": []
}
}))
.expect("failed to parse ws message.created without agent_id");
match event {
WsEvent::MessageCreated(msg) => {
assert_eq!(msg.message.agent_id.as_deref(), None);
assert_eq!(msg.message.agent_name, "bob");
}
other => panic!("unexpected event variant: {other:?}"),
}
}
#[test]

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

Preview deployed!

Environment URL
API https://pr48-api.relaycast.dev
Health https://pr48-api.relaycast.dev/health
Observer https://pr48-observer.relaycast.dev

This preview shares the staging database and will be cleaned up when the PR is merged or closed.

Run E2E tests

npm run e2e -- https://pr48-api.relaycast.dev --ci

Open observer dashboard

https://pr48-observer.relaycast.dev

@willwashburn willwashburn merged commit 223db73 into main Feb 21, 2026
7 checks passed
@willwashburn willwashburn deleted the sdk-fixes branch February 21, 2026 22:23
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