Skip to content

fix: cargo fmt corrections for relaycast_ws.rs#639

Closed
barryonthecape wants to merge 16 commits intomainfrom
fix/formatting-601
Closed

fix: cargo fmt corrections for relaycast_ws.rs#639
barryonthecape wants to merge 16 commits intomainfrom
fix/formatting-601

Conversation

@barryonthecape
Copy link
Copy Markdown
Contributor

@barryonthecape barryonthecape commented Mar 25, 2026

Fixes format violations caught in CI for PR #601.

Changes:

  • Reformats import block in relaycast_ws.rs to respect line length
  • Splits long line in seeded_http_client function

This branch was derived from PR #601, so once merged to main it can be integrated into #601.


Open with Devin

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread src/main.rs
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.

🟡 HTTP API relay_inbound events omit injection mode despite both SDKs reading it

When a message is sent via the HTTP API with mode: "steer", the relay_inbound events emitted to the SDK (lines 2150-2161 for local delivery, lines 2214-2225 for relaycast publish) do not include the mode or injection_mode field in their JSON payload, even though the mode variable is available in scope from ListenApiRequest::Send. Both the TypeScript SDK (packages/sdk/src/relay.ts:1016: mode: event.injection_mode ?? event.mode) and the Python SDK (packages/sdk-py/src/agent_relay/relay.py:782: mode=event.get("injection_mode") or event.get("mode")) explicitly read these fields from relay_inbound events, and the TypeScript protocol type at packages/sdk/src/protocol.ts:236-237 was updated to declare them. As a result, Message.mode will always be undefined/None for messages received via onMessageReceived, even when a dashboard user explicitly specified steer mode. The actual PTY delivery is unaffected since queue_and_try_delivery_raw correctly passes mode through RelayDelivery.

(Refers to lines 2150-2163)

Prompt for agents
In src/main.rs, the two relay_inbound event emissions in the HTTP API ListenApiRequest::Send handler need to include the injection mode. There are two locations:

1. Lines 2150-2163 (local delivery succeeded path): Add "injection_mode" to the json! macro, using the mode variable from the surrounding scope. The mode variable is of type MessageInjectionMode, which implements Serialize.

2. Lines 2214-2227 (relaycast publish succeeded path): Same fix — add "injection_mode" to the json! macro.

For both locations, add a field like:
  "injection_mode": mode,

into the json!({...}) block that constructs the relay_inbound event. The mode variable is already in scope from the ListenApiRequest::Send destructuring.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

4 participants