Repository navigation
Run hive seats on OpenClaw through a shared Gateway - #142
Merged
Merged
Conversation
Two seats run the pinned openhuman-core through the process runner, registered with a real coordinator and served hive tools by a real tinyhivemind-mcp server, one bearer each. A loopback model reads each rendered turn, posts, retries the same call, then completes. The test checks each seat posts once under its own name, the retry returns the first result, the episode settles, and no process is left after stop. Opted into with THM_OPENHUMAN_CORE, like the crate's other live tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude Code speaks only Anthropic's Messages API, so the kind gets its own model API and a new capability row: provider anthropic with an explicit endpoint and no credential, which it alone accepts. An openai endpoint is rejected for it by the spec; every other row matches codex's. ADR 0037 records the decision as proposed until a conformance run on the pinned release backs it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
One minimal ACP client drove Claude Code, Codex and OpenClaw against the spike's scripted model and MCP stub. Each called the hive tool as the right seat, cancelled, resumed after a restart and replayed nothing, once Claude Code's built-in tools and Codex's auto review were turned off. OpenClaw reports no per-turn usage over ACP and costs about 2 GB with its Gateway; the adapters roughly double a Codex seat's memory. Co-Authored-By: Claude Opus 5.5 <[email protected]>
One harness client for every agent that speaks the Agent Client Protocol over stdio, on the host's supervised JSON lines. What differs between agents is an Agent descriptor of data: command, environment, files, session metadata and mode. Claude Code and Codex have descriptors, with the settings the ACP runs found each needs: Claude Code's built-in tools and tool search off, Codex in read-only mode with a direct-tool catalog. A permission request for a host tool is allowed by the client, since the tool server judges hive tools; any other goes to the seat's approver. Live tests on the pinned agents run a Claude Code seat, a Codex seat, and a mixed hive of OpenHuman, Claude Code and Codex in one episode with a real coordinator and tool server: each seat posts once as itself though it retries, and the episode settles. ADR 0038 records the decision as proposed until the conformance suite runs on each agent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An OpenHuman, a Claude Code and a Codex seat each write a file with the host's write_file executable tool, which runs in the seat's own workspace under the host's access gate. A read-only seat's write is refused by the host and writes nothing. Agents' own tools stay off, as the harness spec requires. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The edit test now has every editing seat retry its write, try a path that climbs out of its workspace and an absolute one, and runs the Claude Code and Codex seats supervised under a host approver that records every request. It checks that a retried write runs once and returns the first result, that both escapes are refused and nothing lands outside a workspace, that the approver judges exactly the supervised seats and is not asked again for a retry, and that a seat the approver denies writes nothing. Editing seats post once, so an OpenHuman seat's turn stays within its eight model calls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
From review of tinyhumansai#140: - refuse an agent whose initialize lacks protocol version 1 or HTTP MCP, and resume a session only when the agent offers loadSession; - keep a session as the seat's before setting its mode, so a failed session/set_mode is retried on it; - keep a process until its stop succeeds, so a failed stop can be retried; - close a turn's route before its last drain, and on drop answer what it still holds; answer a cancelled turn's permission requests `cancelled`; - treat a prompt result without a stopReason as a broken protocol; - hold a seat id from start to the end of stop, stopping what a dropped start began before freeing it; - fill templates in one pass and TOML-escape values in .toml files; - give write_codex_catalog a typed CatalogError; - bound every wait in the connection tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
From review of tinyhumansai#140: the replay row measured only a new agent starting, not a loaded interrupted session, so it and ADR 0038 now say so; the conclusion names Claude Code's CLI outliving its adapter; the spike client decodes stdout as UTF-8 and fails its calls once the agent closes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test writes a script and runs it at once. When another test forks a child in between, the child holds the script open for writing until it execs, and running the script fails with ETXTBSY: about one run in twenty of the crate's unit tests on a busy machine. The test now tries again while the script is busy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
OpenHuman appends how long a tool call took (`[took 0.1s]`) to its result, so a retry the host answers from its record can still read differently from the first call when the first was slow. Under load the edit test failed on exactly that. The scripted model now drops that suffix, as it already drops Codex's timing prefix, before it compares. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A lead on each harness in turn is the only starter: it asks the seats on the other two harnesses in one conversation, each answers there through its own model API, the lead completes on a later turn showing both answers, and a member nobody asked never runs. The round is two wide; at the default width of one, an ask naming two seats fails the episode. The scripted model now gives every response and tool call a fresh id. Claude Code joins a response's stored parts by id and interrupts a tool call whose id its session has seen, so with fixed ids a seat's second turn looped until the episode's turn wall. Co-Authored-By: Claude Opus 5.5 <[email protected]>
OpenClaw's ACP bridge refuses MCP servers per session, so a seat's tool
server goes into the config of the Gateway the bridge connects to: one
Gateway agent per seat, with that seat's server and bearer, allowed only
that server's tools. The new `openclaw` module writes that config and
supervises the Gateway as an `Instance`, ready once it listens, and
`Agent::openclaw` runs a seat's bridge on its Gateway agent's session.
The client gains what that needs: `Agent::session_mcp`, false for an
agent given its tools elsewhere, which then opens sessions with no MCP
servers and need not offer HTTP MCP at `initialize`; and a `{seat}`
template value. The bridge reports no per-turn usage, which the client
already treats as optional.
The live tests now start a hive's Gateway once every seat's tools are
served: an OpenClaw seat alone, a hive of all four harnesses, an
OpenClaw writer in the edit test, and lead-only episodes where OpenClaw
leads and where it is asked. The edit test moves to `hive/edit.rs`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Gateway was taken as ready once its port accepted a connection. It listens before its startup work settles, and a bridge that connected in that window exited during `initialize`: about one full live run in five failed starting an OpenClaw seat. OpenClaw's own probe for this is `GET /readyz`, which answers 200 once the Gateway is usable, so `Gateway::start` now waits for that. Ten full live runs then passed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reached
This review includes 56 billable files and costs up to $14.00. Or wait 59 minutes for your next included review. View limit details
|
11 tasks done
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.
Summary
Follows #140 and #141, both merged. This PR's diff is its own two commits:
Run hive seats on OpenClaw through a shared GatewayWait for the OpenClaw Gateway to be usable, not just listeningOpenClaw becomes a hive seat over ACP, beside OpenHuman, Claude Code and Codex.
OpenClaw's ACP bridge (
openclaw acp) rejects tool servers passed when a session opens. So each seat's tools go into the config of the Gateway the bridge connects to: one Gateway agent per seat, holding that seat's tool server and bearer token, and allowed only that server's tools. All of OpenClaw's built-in tool groups are denied, and tool search and code mode are off. ADR 0038 said OpenClaw's descriptor would follow "with its shared Gateway supervised beside the bridge"; this is it.Related issue
None. Listed as a follow-up in #140.
API or behavior changes
New public API in
tinyhivemind-acp:openclawmodule:GatewayPlanbuilds the Gateway config from the seats' tool servers. ItsDebughides the token.Gatewayruns the Gateway as a supervisedInstance. It counts as ready onceGET /readyzanswers 200, not merely once its port accepts connections.GatewaySeat.Agent::openclawruns a seat's bridge on its Gateway agent's session, and reads the Gateway token from a file rather than its arguments.Agent::session_mcp(new field): when false, sessions open with no tool servers, and the agent needn't advertise HTTP tool-server support atinitialize. Claude Code and Codex keeptrue, so their behaviour is unchanged.{seat}(the seat's id) is a new template value, andAgent::argsare now documented as templated, which they already were.Every seat of a Gateway is in its plan when it starts; a seat added later needs a new Gateway. OpenClaw reports no per-turn token usage, which the client already treats as optional.
What this found
initialize, failing about one full live run in five. OpenClaw's own docs give/healthzas liveness and/readyzas usable readiness. After switching to/readyz, 10 full live runs passed in a row.docs/specs/harnesses.mdstill describes OpenClaw through the Gateway's own WebSocket protocol. ADR 0038 now says ACP. Updating the spec fits with its pending split, which Run hive seats on Claude Code and Codex over ACP, beside OpenHuman #140 deferred.Validation
Run on Linux (all-in), against the pinned agents (OpenClaw 2026.10.33, the version the bridge reports):
cargo fmt --all -- --check: OKcargo clippy -p tinyhivemind-acp --all-targets --all-features -- -D warnings: OK. Only the ACP crate,AGENTS.mdand ADR 0038 changed; the workspace-wide commands ran on Run hive seats on Claude Code and Codex over ACP, beside OpenHuman #140.RUSTDOCFLAGS="-D warnings" cargo doc -p tinyhivemind-acp --no-deps --all-features: OKcargo test -p tinyhivemind-acp --all-featureswith every live agent set: 30 unit tests, plus all 12 live tests passing in 10 full runs in a row, with no agent or Gateway process left afterwards.Tests
src/openclaw/test.rs):acceptwithsession_mcpoff.tests/hive/edit.rs, sohive.rsstays under 700 lines. The existing tests keep their three harnesses, so they run without OpenClaw installed.Deliberately untested in unit tests: a Gateway that becomes ready, and stopping it. Both need a real Gateway, and the live tests cover them. As with #140's seat code, CI runs no live agents, so
src/openclaw/mod.rswill be under the 90% per-file line coverage gate. That gate is currently hidden bymain's failingdeepswe_hivestep. A fake ACP agent for the coverage gap is the open follow-up from #140.Documentation
src/README.md.src/openclaw/README.md.src/agent/README.md.tests/README.mdandtests/hive/README.md.AGENTS.md.Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description🤖 Generated with Claude Code