feat(agent-relay): raise max clients to 128 and wire id_range_step#765
Open
appcypher wants to merge 5 commits into
Open
feat(agent-relay): raise max clients to 128 and wire id_range_step#765appcypher wants to merge 5 commits into
appcypher wants to merge 5 commits into
Conversation
Raise relay MAX_CLIENTS from 16 to 128 and extend the handshake to carry the per-client correlation ID range size on the wire, so the SDK no longer needs to know MAX_CLIENTS. Before, the SDK computed its assigned ID range with a hardcoded `u32::MAX / 16` that mirrored the relay's `ID_RANGE_STEP`. The two sides had no way to stay in sync: changing MAX_CLIENTS on the relay without patching the SDK would make the SDK trespass into neighbor slots' ID ranges, causing silent cross-client frame misrouting via `client_slot = frame.id / ID_RANGE_STEP` in the ring reader. Wire change: handshake bytes go from `[id_offset: u32 BE][ready_frame]` to `[id_offset: u32 BE][id_range_step: u32 BE][ready_frame]`. The SDK reads both values and derives `id_start = id_offset + 1` and `id_max = id_offset + id_range_step` from what it was actually told. A new `id_start` field on `AgentClient` replaces the recomputed wrap boundary so the wrap path no longer references the constant either. At MAX_CLIENTS = 128, each client gets `u32::MAX / 128 ≈ 33.5M` correlation IDs per connection, with slot reset on reconnect — ample headroom for any realistic SDK lifetime. Future changes to MAX_CLIENTS are now a one-line edit in `relay.rs` with no SDK rebuild. Python, Node-TS, and Go SDKs are FFI bindings to this Rust client and require no separate update.
- Reword the tagline to "the easiest way to give your agent their own computer". - Drop one extra `<br />` above the YC badge and add two below for consistent spacing.
a22c246 to
cb35737
Compare
Send the client's assigned correlation ID range as explicit start and exclusive end bounds during the relay handshake. This keeps the client contract focused on the allocation it may use instead of exposing the relay's range-step calculation. Validate the range on the SDK side and reject client frames in the relay when their IDs fall outside the assigned interval.
toksdotdev
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Raise the agent relay's
MAX_CLIENTSfrom 16 to 128 and have the relay tell each SDK its assigned correlation-ID range size during the handshake, so the SDK no longer has to hardcode it.Description
MAX_CLIENTSin the relay goes from 16 to 128, giving each connected client about 33.5M correlation IDs.[id_offset: u32 BE][ready_frame]to[id_offset: u32 BE][id_range_step: u32 BE][ready_frame].id_range_stepoff the wire and derives its allocation range from that, instead of duplicatingu32::MAX / 16.MAX_CLIENTSever changed without a matching SDK patch.id_startfield onAgentClientcleans up the wrap path so it no longer references the constant either.mcpandskillssubmodule pointers and a small README copy tweak (separate chore commit).Test Plan
cargo check -p microsandbox-runtime -p microsandboxexits 0cargo test -p microsandbox-runtime --libpasses