Skip to content

Run OpenHuman seats as supervised processes - #139

Merged
sanil-23 merged 50 commits into
tinyhivemind-hostfrom
openhuman-process
Nov 26, 2026
Merged

sanil-23 merged 50 commits into
tinyhivemind-hostfrom
openhuman-process

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

Step 4b of the process harness plan. The new crate tinyhivemind-openhuman-process runs OpenHuman seats as supervised openhuman-core run --headless-api processes, one per seat, behind the Harness port from #136. It names no OpenHuman, openhuman-embed or tinyagents type, and assert-pure.sh checks that. It is a sibling crate, not a module of tinyhivemind-openhuman, so removing vendor/openhuman and the linked adapter later will not touch it.

Before start.

  • Refusals: a typed refusal for every provider except openai with an explicit endpoint and no credential; for more than 8 iterations, a budget, a sandbox, built-in tool groups or skills.
  • Per seat: a private workspace and a generated config.toml. Memory, search, Composio, suggestions, hooks and context compaction are off, and the OpenHuman sandbox stays on. The core token, encrypted keyring key and MCP bearer are random.

Start.

  • Warm-up: the first run uses an allowlist that matches nothing, waits out MCP warm-up and reads the hashed tool names.
  • Restart: the second run uses the exact allowlist.
  • Verification:
    • /health.pid against the child;
    • the version against the pin;
    • config_get against every leaf written;
    • the model-visible tool list, computed from every source OpenHuman v0.64.15 adds tools from. No RPC reports a custom agent's real set, so the live gate test is the observed check.

Turns.

  • Events: subscribed to /events before channel_web_chat, scoped to the returned request_id, with usage from chat_done. The 8th iteration_start is a failed turn.
  • Approvals: sent to the seat's approver with a 2-minute limit; approvals left by an earlier turn are denied first.
  • Cancel and stop: a dropped turn is cancelled by channel_web_cancel, or its instance is killed. A turn is never resubmitted.
  • Sessions: the thread is stable for the seat's life. A failed first turn leaves the seat able to start again; a thread that once existed and is gone is a resume error.

Pins. harnesses.lock records version, target, tarball sha256 and binary sha256 for v0.64.15 on x86_64 and aarch64. .github/scripts/fetch-harness.sh fetches over HTTPS only and verifies both checksums; the library never downloads.

An independent review found four important defects, all fixed with tests that failed first:

  • a failed first turn disabled the seat for good, hidden by a fake that saved the transcript too early;
  • the core token was reachable through a public Debug;
  • the tool list missed some of OpenHuman's sources;
  • concurrent starts of one seat could race.

Stacked on #136.

Related issue

None. Refs #136.

API or behavior changes

  • New crate tinyhivemind-openhuman-process.
  • Host (additive): harness::Error::Refused.
  • No change to the linked adapter.

Dependencies

reqwest 0.12 with no default features (no TLS, no HTTP/2, no proxy lookup), for loopback JSON-RPC and SSE. It was already in the lockfile.

Validation

At 6b38ad50:

  • cargo fmt --all -- --check: pass
  • cargo clippy --all-targets --all-features -- -D warnings: pass
  • cargo build --all-targets --all-features: pass
  • cargo test --all-features: 1952 passed, 0 failed, 0 ignored
  • assert-pure.sh (now guards this crate), rustdoc -D warnings: pass
  • Live: THM_OPENHUMAN_CORE=<v0.64.15 binary> THM_NODE=<node 24> cargo test -p tinyhivemind-openhuman-process --features conformance --test live: 15 passed, against the checksum-verified binary and the experiment's scripted model. The live tests stand in for CI, which has no harness binary; they skip with a message when the variables are unset.
  • Coverage, live tests included: every file of the new crate at 94% or more (run by the implementing agent)
  • fetch-harness.sh fetched and verified both targets, and refused an unknown target and a duplicate lock entry

CI will show the same red checks as #136, all already on main.

Tests

Covered:

  • Offline: a scripted fake of the RPC and SSE surface, written from the experiment logs and the vendored source, and checked against v0.64.15 behaviour; plus the host conformance suite run against a fake openhuman-core child, so supervision is real.
  • Live: the same conformance cases on the real binary; a failed-first-turn case; and a gate test that repeats the spike's result through the runner (hive tool called as the right seat, exactly that tool offered, usage reported, a dropped turn closes its model call).

Uncovered here:

Privacy risk, not solved here: v0.64.15 has a built-in Sentry address no setting removes, and resets embeddings_provider to the hosted default on load (memory is off, so nothing embeds). The live tests do not block egress. Blocking egress from seats is now a gate for the removal PR, and an upstream off switch is needed.

OpenHuman gap: approval_decide takes no reason, so a denial cannot tell the model why.

Documentation

Crate and module READMEs, crate overview with doctest, AGENTS.md, and docs/specs/harnesses.md (settled OpenHuman details, the computed tool list, approvals). The plan now records the sibling-crate decision.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

Co-authored-by: Medulla medulla@tinyhumans.ai

senamakel and others added 30 commits November 25, 2026 23:35
Register the new tinyhivemind-openhuman-process crate as a workspace member and add a default-features-off reqwest dependency for its loopback HTTP and SSE client, keeping TLS, HTTP/2 and proxy lookup out so a seat's token never reaches a proxy.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a Refused variant to the harness error enum so a seat that asks for something the harness cannot honour is reported without being started, with the client's own error preserved as the source for downcasting. The openhuman-process crate gains tokio's net and io-util features to support this.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that a refused seat renders the client's own error message and keeps the original source available for downcasting, so the wrapping behaviour stays intact.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a capability module that exposes the process crate's capabilities to the rest of the system.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a TOML-based configuration loader for the openhuman process crate, parsing config files into the existing config structures.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…uman child processes

Introduce a new crate that launches the OpenHuman runtime as a child process and manages its lifecycle, including conformance and live tests against a fake child. The lockfile gains the crate's dependency set so the workspace builds it.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The skill fixture now carries only an id, and the memory fixture is built with a full identity and settings and unwrapped instead of being silently skipped when parsing fails, so the unsupported-field assertions always run.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a fixture for the openhuman process crate so tests can exercise the process handling against a stable, reusable setup.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test fixture had a stray leading space before the second data line, which made the sample payload invalid SSE. Removing it keeps the split-anywhere test exercising well-formed frames.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Wire the new rpc module into the crate and expose the shared test support, fake surface, and fixture modules under cfg(test) so unit tests can reuse them. Also make the fake surface's tools check tolerant of read errors instead of comparing against a Result.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a turn module in the openhuman process crate to handle turn-level processing.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…rminal

The follow loop now reports whether the instance's turn is over alongside the outcome, so a failure raised while the turn keeps running no longer clears the active turn. Empty strings in the fake surface are treated as absent, matching how the real binary omits optional fields.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Wire the new error and instance modules into the crate so the process supervision code can use them.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The fake now keeps a handle to its shared state so that dropping it clears the subscriber registry, matching a process that has gone away where nothing answers and every stream ends.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The active turn now records its own thread, so cancel no longer takes the thread as a separate argument and reads it from the turn instead. This keeps the cancellation parameters together with the turn they describe.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add the instance module that lays out the state directories, writes the config and keyring key, builds the child environment, and runs the two-start discovery and verification flow so each instance gets an exact MCP tool allowlist before it is used.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…andling

Reworked the launcher to build the child process arguments in a loop and to destructure the probe result directly, which keeps the start-up path easier to follow without changing behaviour. Added tests pinning the exact environment recipe and the turn timeout floor so regressions in the sandbox configuration are caught.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a harness module to the openhuman process crate, providing the scaffolding needed to drive and manage the process.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a seat abstraction in the harness so openhuman processes can be assigned and tracked per seat. This lays the groundwork for managing process placement within the harness.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds Resume and Render error variants so a missing thread and an unrenderable turn surface as distinct failures, and expands the crate docs to describe how a seat is started, verified, and driven. Also renames the seat's active-turn helper to current and marks the fixture root as intentionally held.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The conformance placeholder is replaced by a suite that runs every host case against a fake openhuman-core child, so supervision is exercised for real, plus checks that seat refusals happen before anything starts and that start and stop are idempotent. The fake child's shared surface module is marked dead-code-allowed for the binary, and the live test file keeps its placeholder note.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The shared http module is now also used by the fake surface, so the
dead_code lint is silenced to keep the live model tests compiling
without warnings.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Move the seat builder and process helpers out of the fake subject into a shared support module so both the fake and live suites can use them. The live subject now imports the scripted model and seat helpers through crate paths instead of its own module tree.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
senamakel and others added 19 commits November 25, 2026 23:53
Adds a live test runner that drives every conformance case through the real openhuman-core binary and Node fixture, gated on THM_OPENHUMAN_CORE and THM_NODE so the suite skips with a reason when either is absent. Also adds a spike gate test that repeats the original spike's checks through the runner, and fixes the subject helper's expectations to match.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
… config

The written config now sets context.compaction_enabled to false, because 0.64.15 otherwise adds juice_retrieve to every allowlist. Verification accounts for that recovery tool when compaction is on, and tests cover both the config and the visible-tool behaviour.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a script that downloads the pinned harness artifacts and a lock file recording their versions, so CI runs against reproducible harness builds instead of whatever is fetched at run time.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Redirect stderr to /dev/null alongside stdout so a cache miss no longer prints a checksum failure message during the harness fetch step.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The purity check now treats tinyhivemind-openhuman-process as a host crate, since the process harness clients may hold a runtime and an HTTP client but must never link one.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The dependency scan matched the crate under test itself when its name shared a prefix with a forbidden adapter family, so the crate's own line is now filtered out. The failure message was also updated to mention the process harness clients alongside the host crate.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…nd tests

Document the crate's top-level layout along with its capability, config, harness, instance, rpc, and turn modules, and describe the test directories including the fake, live, and support helpers.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The harness spec and process-harness plan now record the `openhuman` client in `tinyhivemind-openhuman-process`, which passes the conformance suite offline and on the pinned 0.64.15 binary, along with the behaviours that implementing it settled. AGENTS.md lists the new crate and notes that it links no harness.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted the crate's source and test files to satisfy rustfmt, wrapping long method chains and type annotations without changing any behaviour.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…rectory

The crate's error type now lives in an `error/` module directory with its own README and test module, and the crate README points at the new location. A test was added covering the TOML writer's handling of nulls, empty arrays, mixed arrays, and nested tables.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that the start check counts tools contributed by deferred tool search, the REPL handle tools, the orchestrator summary stage, extra_tools, and subagent delegation, matching what resolved_scope adds to an allowlist.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…llowlist

The visible-tool check now looks up the configured chat agent instead of a fixed id, and mirrors 0.64.15's resolved_scope by adding deferred, delegation, recovery and REPL tools under the conditions the binary uses. This keeps the live tests honest about what the model actually sees.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a conformance case asserting that when a seat's first turn fails, the next turn starts the thread afresh and completes rather than failing to resume. The fake surface now records a user message only once a turn ends, matching 0.64.15, and a shared helper builds turn requests for the test seat.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
A turn that fails before its thread has a transcript now returns a dedicated error instead of a session id, so the next turn is not asked to resume a thread that never existed. The transcript lookup is shared between the resume check and this new check.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The Debug implementations for the config input, written config, and RPC
client now hide the bearer, prompt, and core token, since these values
carry the seat's and instance's authority and were previously printed in
full. Tests cover both the types directly and a running harness.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…d after close

Seats are now inserted into the registry before their instance starts, so a concurrent start is refused and a stop can find the seat to stop, with the entry removed again if the start fails. A seat closed while its instance was starting now stops that instance instead of leaving it running, and approvals gained a configurable timeout.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ailures

The keyring key is now rejected unless it is a regular file with mode 0600 holding 64 hex digits, and the config is chmodded to 0600 even when it already exists. Stop failures during launch are no longer swallowed but reported alongside the original error, and the harness fetch script rejects ambiguous lock entries and forbids non-HTTPS redirects.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…l limits

Update the harness, instance and turn READMEs and the harness spec to describe the behaviour settled on 0.64.15: seats are reserved by id so a second start is refused, the model-visible tool list is computed from the effective config since no RPC reports it, and approvals time out into denials while stale ones are denied before a turn starts. Also note that a failed start reports a failed stop alongside it, keyring key files must be 0600 with 64 hex digits, and a turn failing before its thread has a transcript reports no session.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Renamed the local permission helper in the keyring test to chmod with a clearer parameter name, and removed an unused AGENT_ID import from the verify module.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cad10790-795d-4f86-b636-afd7454aaa21

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-26T00:54:00.764220Z
We couldn’t complete this review. Comment @codex review to try again.
6b38ad5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Brings in #137 (harness schema) and #138 (hive tool server). Conflicts:

- Cargo.toml: both new members, and both dependency blocks (hyper and its
  helpers for tinyhivemind-mcp, reqwest for this crate).
- assert-pure.sh: host_crates now guards tinyhivemind-host,
  tinyhivemind-mcp and tinyhivemind-openhuman-process.
- docs/specs/harnesses.md: "Implemented so far" covers steps 1, 2, 3 and 4b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sanil-23
sanil-23 merged commit 44bf3b6 into tinyhivemind-host Nov 26, 2026
5 of 9 checks passed
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.

2 participants