Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(plans): update controller parser migration plan

Steven Enamakel602657cb09d9
diff --git a/docs/plans/2026-10-20-controller-parser-migration.md b/docs/plans/2026-10-20-controller-parser-migration.md
index 6d6d056387..180ba93ff3 100644
--- a/docs/plans/2026-10-20-controller-parser-migration.md
+++ b/docs/plans/2026-10-20-controller-parser-migration.md
@@ -49,7 +49,7 @@ impl BoundRegisteredController {
The signatures above are a design target, not a claim that all current handlers fit `typed` directly. For example, `threads::schemas::handlers::handle_upsert` parses first, then checks user-surface thread and parent ids, then invokes the operation. Its bound `run` function must retain those checks between decode and operation. `integrations::composio::schemas::handlers_tools::handle_execute` loads config first, parses `tool`/`arguments`/`connection_id` second, then calls the operation; use `after_gate` with config as `G`, and preserve the existing readers and error order. `modules::schemas::handle_computer_status` reads `load` before loading config and checking the computer component; use `typed` with a parser returning the bool, then keep config load and component check in `run`. Thus the parser observation is side-effect-free, while runtime ordering stays exactly where it is today.
-Registration compatibility is explicit. Keep today's public `RegisteredController { schema, handler: fn(...) }` name, fields, and struct-literal construction unchanged as the deprecated legacy adapter. Introduce a distinct constructor-only `BoundRegisteredController`; it has public read-only schema access and a private bound handler. Keep today's `ControllerExtension { group, controllers: Vec<RegisteredController>, namespaces }` and `register_controller_extension` unchanged. Add `BoundControllerExtension { group, controllers: Vec<BoundRegisteredController>, namespaces }` and `register_bound_controller_extension`. Internally store `GroupedController { group, entry: ControllerEntry }`, where `ControllerEntry::{Legacy(RegisteredController), Bound(BoundRegisteredController)}` dispatches each variant through its own invoke path. Migrate in-repository providers and snapshot consumers to the bound entry/snapshot API namespace by namespace; do not silently label the old projection complete. During rollout, contract tests report legacy rows explicitly. In the final state the raw built-in/internal and each owner extension snapshot reject `Legacy` entries. This preserves existing external struct literals while exposing migration debt and a constructor-only path for complete coverage.
+Registration compatibility is explicit. Keep today's public `RegisteredController { schema, handler: fn(...) }` name, fields, and struct-literal construction unchanged. Introduce a distinct constructor-only `BoundRegisteredController`; it exposes a read-only schema and private bound handler. Keep today's `ControllerExtension { group, controllers: Vec<RegisteredController>, namespaces }` and `register_controller_extension` unchanged. Add `BoundControllerExtension { group, controllers: Vec<BoundRegisteredController>, namespaces }` and `register_bound_controller_extension`. Internally store `GroupedController { group, entry: ControllerEntry }`, where `ControllerEntry::{Legacy(RegisteredController), Bound(BoundRegisteredController)}` dispatches each variant through its own invoke path. Add crate-internal `ControllerEntry::legacy` and `ControllerEntry::bound` conversions so a domain's `all_registered_controllers` can migrate one registration at a time without changing public legacy constructors. Migrate in-repository providers and snapshot consumers namespace by namespace; do not silently label the old live projection complete. During rollout, contract tests report legacy rows explicitly. In the final state the raw built-in/internal and each owner extension snapshot reject `Legacy` entries. This preserves existing external struct literals while exposing migration debt and a constructor-only path for complete coverage.
The concrete registration diff for the first typed vertical slice is:
@@ -80,7 +80,7 @@ The final closure only receives already parsed input. The constructor owns the s
The test-only fixture for each registration contains only an independent method literal, independent required names, and explicit valid JSON examples. The verifier joins fixtures to registered controllers by method, rejects duplicates/empty inventories/missing or extra rows, checks handler/schema method identity, nonempty descriptions, and exact required declarations, then verifies each example with both `validate_params` and `controller.decode_params`. Required-field deletion/optional mutants alter cloned schemas and must fail against independent literal expectations. Existing error/default/value tests remain wherever they express behavior beyond this parser acceptance boundary. Business operation success, state-dependent validation, and environment-dependent checks stay in focused owner tests.
-The core owns built-in and internal controllers. `openhuman-tinyhumans` owns its hosted extension and its own contract sweep; the core must not depend upward or mutate a process-global extension registry in parallel tests. Feature-gated rows are guarded by the same feature and each supported relevant build configuration runs its contract suite. No vendor module implementation is imported to construct a host test.
+The core owns built-in and internal controllers. `openhuman-tinyhumans` owns two additional RPC extension inventories: `hosted::extension()` in `DomainGroup::Hosted`, and the separate `voice::schemas::hosted_voice_controllers()` extension in `DomainGroup::Voice` (`voice.agent_signed_url`, `voice.cloud_transcribe`). `openhuman-rpc` owns the `http_host::extension()` inventory in `DomainGroup::Platform`. Each owner has a local contract test over the exact extension object it constructs; core must not depend upward or mutate a process-global extension registry in parallel tests. Feature-gated rows are guarded by the same feature and each supported relevant build configuration runs its contract suite. No vendor module implementation is imported to construct a host test.
## Migration rules
@@ -96,9 +96,9 @@ Each step is a separately reviewable change on `epic/8089-test-ownership`; keep
Files: `crates/openhuman-core/src/core/all.rs`, `all_invoke.rs`, a sibling bound-registration test file (declared with the repository's sibling `*_tests.rs` rule), `schema_test_support.rs`, its sibling `schema_test_support_tests.rs`, and `all_schema_contract_tests.rs`; first owner migration: `crates/openhuman-core/src/threads/schemas.rs`, `threads/schemas/handlers.rs`, and `threads/schemas_tests.rs`.
-First add a typed constructor test with a test parser and side-effect counter: `invoke` must call the parser and typed runner in order; `decode_params` must call that exact parser and must not call the gate or runner. Test parser errors propagate unchanged. Then implement the private erased `BoundHandler` and internal `ControllerEntry` dispatch; preserve the outer `try_invoke_registered_rpc` domain/surface gate before any parser runs. Keep old `RegisteredController`/`ControllerExtension` construction working through the named legacy adapter while migrating in-repo struct literals to the new constructor. The final built-in and hosted registries must contain no legacy entries, and the completeness test must fail if any are present.
+First add a typed constructor test with a test parser and side-effect counter: `invoke` must call the parser and typed runner in order; `decode_params` must call that exact parser and must not call the gate or runner. Test parser errors propagate unchanged. Then implement `BoundHandler` and internal `ControllerEntry` dispatch; preserve the outer `try_invoke_registered_rpc` domain/surface gate before any parser runs. Do not change or rename legacy `RegisteredController` or `ControllerExtension` fields/literals. Add `BoundRegisteredController`, `BoundControllerExtension`, and new APIs alongside them. Add a generic `push_entries` path that accepts mixed `ControllerEntry`s while the existing `push(Vec<RegisteredController>)` converts legacy entries. Keep both APIs building during rollout. The final raw built-in/internal and all three owner extension inventories must contain no legacy entries, and their completeness tests must fail if any remain.
-The first production vertical slice is `threads.upsert`. In `threads/schemas/handlers.rs`, extract `parse_upsert(params) -> Result<UpsertConversationThreadRequest, String>` from the existing generic `parse::<...>` use, and `run_upsert(ctx, request)` that retains thread-id checks before `ops::thread_upsert`. In `threads/schemas/registry.rs`, change the provider's return element to the internal `ControllerEntry` enum; replace only the `upsert` literal with `ControllerEntry::Bound(RegisteredController::typed(schema, parse_upsert, run_upsert))` and wrap sibling literals as `ControllerEntry::Legacy(LegacyController { ... })`. `push` accepts entries during rollout and dispatch continues through the same `GroupedController`; this mixed vector is explicit, detectable debt, not complete coverage. Independently fixture `threads.upsert`, its exact required keys, and a valid request. The registry contract test calls `controller.decode_params`, not a fixture callback. Add runner regressions for missing/extra/duplicate rows, empty inventory, empty examples, wrong fixture identity, schema rejection, parser rejection, required key removal, and required-to-optional mutation. Keep current memory/wallet fixed assertions until replaced by complete rows.
+The first production vertical slice is `threads.upsert`. In `threads/schemas/handlers.rs`, extract `parse_upsert(params) -> Result<UpsertConversationThreadRequest, String>` from the existing generic `parse::<...>` use, and `run_upsert(ctx, request)` that retains thread-id checks before `ops::thread_upsert`. In `threads/schemas/registry.rs`, replace only the `upsert` literal with `ControllerEntry::Bound(BoundRegisteredController::typed(schema, parse_upsert, run_upsert))` and convert sibling literals using `ControllerEntry::legacy(RegisteredController { ... })`. The provider returns `Vec<ControllerEntry>` for this staged namespace; its other entries remain explicitly legacy. `push_entries` preserves those variants and runtime dispatch continues through `GroupedController`; this mixed vector is explicit, detectable debt, not complete coverage. Independently fixture `threads.upsert`, its exact required keys, and a valid request. The registry contract test calls `controller.decode_params`, not a fixture callback. Add runner regressions for missing/extra/duplicate rows, empty inventory, empty examples, wrong fixture identity, schema rejection, parser rejection, required key removal, and required-to-optional mutation. Keep current memory/wallet fixed assertions until replaced by complete rows.
TDD proof: first demonstrate the fixture contract rejects a deliberately removed/optional `threads.upsert` required schema field (nonzero selected test count); restore it and show green. Separately, temporarily alter the production `parse_upsert` to reject a valid example and prove the ordinary registry contract turns red; restore and rerun green. Do not call `run_upsert` in either contract test.
@@ -114,17 +114,21 @@ Only after the binding seam is proven, migrate the existing voice, MCP registry,
Files: core registration owners under `crates/openhuman-core/src/**/schemas*.rs` and registration lists, `core/all.rs`, `all_invoke.rs`, test support, and each owner's sibling tests.
-For each domain, migrate a small complete namespace (roughly 5–20 controllers) from bare registrations to `RegisteredController::typed`, `after_gate`, or another explicitly order-preserving constructor. A handler with no input still binds an explicit empty-map parser; a handler that ignores params must state that behavior in its decoder. Extract named pure parsers only for actual runtime reads, not merely to make tests pass. Keep handler-specific checks in the typed runner at the original point relative to config, identity, permissions, feature gates, and operations. Each namespace change includes its complete independently authored method/required/example rows and replaces its owner schema-only assertions only after those rows and behavior oracles pass.
+For each domain, migrate a small complete namespace (roughly 5–20 controllers) from bare registrations to `BoundRegisteredController::typed`, `after_gate`, or another explicitly order-preserving constructor. A handler with no input still binds an explicit empty-map parser; a handler that ignores params must state that behavior in its decoder. Extract named pure parsers only for actual runtime reads, not merely to make tests pass. Keep handler-specific checks in the typed runner at the original point relative to config, identity, permissions, feature gates, and operations. Each namespace change includes its complete independently authored method/required/example rows and replaces its owner schema-only assertions only after those rows and behavior oracles pass.
-Keep the central `all_registered_controllers()` snapshot authoritative and make a completeness check reject any legacy registration after each migration wave. Do not let fixture rows determine the selected registry slice. Feature-gated groups use matching compile-time guards and enabled/disabled Cargo builds. Apply required-field mutants to every row after each namespace wave. Migrate in ownership batches for review: threads/sessions/profiles; agent runs/workflows; security; config/tools/inference; artifacts/skills/integrations/MCP; cron/channels/voice; desktop/platform/storage/web3/flows/memory/sandbox/health. These are candidate ordering groups, not large one-PR tasks: split each so the PR has one vertical namespace or a few tightly related ones and remains buildable. Keep the per-domain old/new line and assertion ledger.
+Use `builtin_controller_snapshot()` in `core/all_schema_contract_tests.rs` as the test corpus: it chains raw `registry()` plus `internal_registry()` directly, before ambient `DomainSet`, `visible`, or surface filtering. Keep public `all_registered_controllers()` behavior unchanged; it is a live filtered product API, not the universal test source. Do not let fixture rows determine the selected registry slice. Feature-gated groups use matching compile-time guards and enabled/disabled Cargo builds. Apply required-field mutants to every row after each namespace wave. Migrate in ownership batches for review: threads/sessions/profiles; agent runs/workflows; security; config/tools/inference; artifacts/skills/integrations/MCP; cron/channels/core voice; desktop/platform/storage/web3/flows/memory/sandbox/health. These are candidate ordering groups, not large one-PR tasks: split each so the PR has one vertical namespace or a few tightly related ones and remains buildable. Keep the per-domain old/new line and assertion ledger.
-### 4. Migrate the hosted extension without a legacy coverage hole
+### 4. Migrate each extension owner without a legacy coverage hole
-Files: `crates/openhuman-core/src/core/all.rs` extension types and registration, `crates/openhuman-tinyhumans/src/hosted/mod.rs`, each `hosted/**/schemas.rs` owner, and hosted test support/tests.
+Files: `crates/openhuman-core/src/core/all.rs` extension types and registration; `crates/openhuman-embed/src/runtime/seams.rs`; `crates/openhuman-tinyhumans/src/runtime.rs`, `install.rs`, `hosted/**`, `voice/schemas.rs`; `crates/openhuman-rpc/src/http_host/**` and host setup/tests.
-Preserve the current public `ControllerExtension` literal as a deprecated adapter over legacy controllers during the incremental migration, and add a parallel `BoundControllerExtension` whose `controllers: Vec<RegisteredController>` must all be constructor-bound. Add `register_bound_controller_extension` and store both forms internally as one `GroupedController` enum/entry. Tinyhumans' `extension()` switches to the bound type only after each hosted domain is converted; core's final completeness check rejects any legacy entry. This makes the in-repo rollout incremental and keeps the old extension entry point available for external callers temporarily. Do not add a required field to `ControllerExtension`.
+Preserve the current `RegisteredController`, `ControllerExtension`, and `register_controller_extension` APIs exactly. Add `BoundControllerExtension` with `Vec<BoundRegisteredController>` and a separate registration function; core stores both in `ControllerEntry` and never converts a bound entry back to a legacy handler pointer. TinyHumans' `hosted::extension()` migrates its proxy controllers through this new path. Separately migrate `tinyhumans/src/voice/schemas.rs`: its `voice.agent_signed_url` and `voice.cloud_transcribe` entries are a Voice-group extension, distinct from the Hosted-group proxy extension, and need their own fixed contract table and owner tests. Each extension constructor returns the actual bound extension object tested locally before install.
-Hosted access uses the existing host-only facade: re-export `RegisteredController`, `BoundControllerExtension`, and `register_bound_controller_extension` through `openhuman_embed::__host`, which `openhuman-tinyhumans` already consumes. Keep `decode_params` exposed only through that doc-hidden host surface. Core cannot import tinyhumans, and `cfg(test)` helpers in core are not available to tinyhumans as a dependency, so hosted tests use a small local contract-loop over the bound entries rather than pretending core's unit-test module is shared. The hosted crate snapshots the `BoundControllerExtension` it constructs and runs that loop over exactly those entries before any global install. Each example calls that registration's own `decode_params`. Gate and hosted-auth order remains inside its bound pipeline and is never run by the test sweep. No network client, auth exchange, extension global, or hosted operation is invoked. Test full extension parity, uniqueness, independent identity/required fields, descriptions, required mutants, and parser acceptance under hosted feature configurations.
+The extension path already crosses a fixed facade chain. Add only the necessary type/function re-exports to `openhuman_embed::__host` (`crates/openhuman-embed/src/lib.rs`), relying on `openhuman-tinyhumans/src/lib.rs`'s existing `pub use openhuman_embed::__host`; RPC already reaches that same list as `openhuman_tinyhumans::__host as core_host`. Do not add a core dependency upward or bypass the facade. Preserve the existing embed builder call `.controller_extension(ControllerExtension)` and add `.bound_controller_extension(BoundControllerExtension)` in `crates/openhuman-embed/src/runtime/seams.rs`. In the TinyHumans generated `RuntimeBuilder` (`src/runtime.rs`), add a parallel bound setter and forward it to embed. Extend internal `InstallOptions`/`Wiring` preparation and `install` so the legacy `controllers: Option<ControllerExtension>` path remains intact while a `bound_controllers: Option<BoundControllerExtension>` path carries the parser binding without conversion. Migrate hosted proxies and TinyHumans voice registration separately; preserve voice registration's current boot timing and duplicate/idempotency behavior.
+
+RPC owns a third extension: `http_host::extension()` under `DomainGroup::Platform`, not Hosted or Voice. Convert `crates/openhuman-rpc/src/http_host/schemas.rs` registrations to bound constructors and `http_host::extension()` plus `register_controllers`/`ensure_registered` to the bound extension path. Update `host.rs` builder setup to call `.bound_controller_extension(...)`, and preserve the legacy builder method for callers. Keep contract tests in `crates/openhuman-rpc/src/http_host/schemas_tests.rs`; add explicit fixed required names/examples and mutants there. Add facade forwarding tests/checks through embed → tinyhumans → rpc and verify no product Cargo feature forwarding is changed unless an existing gate actually needs forwarding. Run core, tinyhumans (including `voice` and `hosted` configurations), and rpc `server`/relevant feature tests in their owning crates.
+
+The core's cfg(test) runner is not shared into dependent crate tests, so tinyhumans and rpc use a small local contract loop over their exact bound extension object. Each calls the `decode_params` method bound into its `BoundRegisteredController`; neither passes a parallel callback. Gate and hosted-auth order remains inside its bound pipeline and is never run by the test sweep. No network client, auth exchange, extension global, or hosted operation is invoked. Test full extension parity, uniqueness, independent identity/required fields, descriptions, required mutants, and parser acceptance under each owner's supported feature configuration.
### 5. Remove only proven duplicate schema-test scaffolding