Ox streaming client and server transport#182
Conversation
Review(Reviewed against the PR's base branch Nice addition — direct-style Ox client/server transports mirroring the ZIO ones, with good doc/example coverage. One thing worth calling out as a positive: 1. GET SSE listener reconnect is unguarded — a failed reconnect crashes the client's
|
|
Follow-up on findings #1 and #2, after checking the Ox docs — they can be addressed together, and #1 is more severe than I first stated. Per Ox's structured-concurrency semantics, in a The idiomatic fix folds both findings together. The hand-rolled retry(Schedule.exponentialBackoff(100.millis).jitter().maxInterval(30.seconds)):
openGetSseStream(lastEventId.get())
.foreach(drainSse(_, id => lastEventId.set(Some(id))))(terminating on For contrast, the server side ( 🤖 Generated with Claude Code |
| uri: Uri, | ||
| protocolVersion: ProtocolVersion, | ||
| timeout: FiniteDuration, | ||
| scope: Ox, |
There was a problem hiding this comment.
this looks fishy. If this needs to be run within a scope, use using Ox. But maybe it doesn't need to run any forks in the parent scope (perferred ;) )
| protocolVersion: ProtocolVersion, | ||
| timeout: FiniteDuration, | ||
| scope: Ox, | ||
| sessionId: AtomicReference[Option[String]], |
There was a problem hiding this comment.
there's a lot of atomics here. Maybe they could be somehow extract to an actor?
|
|
||
| class OxMcpClientHttpIntegrationSpec extends McpClientStreamingHttpIntegrationSpec[Identity, SyncBackend] with SyncToFuture: | ||
|
|
||
| override def usingBackend[A](use: SyncBackend => Identity[A]): Identity[A] = |
| supervised: | ||
| val backend = DefaultSyncBackend() | ||
| val transport = OxClientHttpTransport(backend, uri"http://localhost:8080/mcp") | ||
| val client = McpClient.bidirectional[Identity]( |
There was a problem hiding this comment.
doi you need the type param here? it should be inferred basing on the transport
| } | ||
| ``` | ||
|
|
||
| ## Bidirectional client over an Ox streaming transport |
There was a problem hiding this comment.
usually uyou only need to modify the docs in docs/, these get updated on release
DONE: