Skip to content

refactor(core): move the python worker to tinyruntime, module resolution to tinybus and mic capture to tinyvoice - #6794

Merged
senamakel merged 31 commits into
tinyhumansai:mainfrom
senamakel:vendor-extract-w2-runtime
Sep 30, 2026
Merged

senamakel merged 31 commits into
tinyhumansai:mainfrom
senamakel:vendor-extract-w2-runtime

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

Wave 2 moves three pieces of code out of the OpenHuman core: the Python worker process machinery goes to tinyruntime, module-resolution and cache-path helpers go to tinybus, and microphone capture goes to tinyvoice. Net change is −1.8k lines (161 added, 1,992 deleted).

Stacked on #6789 (→ #6786 → #6785 → #6781). The base is main because upstream branch creation is restricted.

Python worker → new crate tinyruntime-pyserver (tinyruntime#19)

  • What moved: the persistent spaCy/Kompress worker. That covers the wire and status types, server.py, and the PythonServer lifecycle (spawn, handshake, one restart-and-retry, status, idle). It also covers the shared-worker cache ServerSlot (rebuild on backend change or idle, with a 5-minute back-off).
  • Linking: it is a plain library crate that OpenHuman links directly. It adds no bus members, so the pinned v0.2.7 module is untouched.
  • Seam: a ServerLaunch value (interpreter, script, backend ids, env, timeouts) plus a lazy launch future. Config mapping, PythonBootstrap, venv provisioning, and the spaCy/Kompress callers stay in OpenHuman.
  • Wire compatibility: wire and status field names are unchanged, pinned by literal-JSON tests.
  • Pin: oh-pyserver-on-v0.2.7. The three tinyruntime exemptions now expect v0.2.7-6-g1be38d24.

Module resolution and cache helpers → vendor/tinybus (tinybus#30)

  • What moved: modules/resolution.rs becomes tinybus::module::resolution (feature modules). is_safe_path_component, artifact_dir and prune_stale_versions move into module/cache.rs.
  • Seam: the helpers take (root, id, version, host_key) strings instead of ModuleRecord.
  • Stays in OpenHuman: ModuleRecord pins and digests, the compiled registry, and the admission/ABI checks.
  • Pin: tinybus has no registry record, so this is a gitlink bump only.

Microphone capture → tinyvoice::capture (feature capture, tinyvoice#17)

  • What moved: voice/audio_capture.rs and the device side of always_on/capture.rs. No unsafe was needed.
  • Features: OpenHuman's voice feature now enables tinyvoice/{hotkey,capture}. The core's own optional cpal dependency is dropped, and feature forwarding still passes.
  • Seam: PermissionCheck = fn() -> Result<(), String>, which runs on the capture thread before the device opens. Both of OpenHuman's permission policies stay host-side.
  • Stays in OpenHuman: RecordingResult and the finalize step through modules::voice.
  • Pin: oh-capture-on-v0.1.8, which is stacked on refactor(core): move tool/harness leaves, cwd jail, flow helpers and hotkey into vendor crates #6786's hotkey pin. The tinyvoice exemption now expects v0.1.8-14-geb8b8730.
  • Coverage gate change: two files that open a real cpal device can't run in CI, so they are excluded from tinyvoice's coverage gate.
  • Not tested on hardware: the device flows have not been exercised against a real microphone.

Verification

  • Compile: cargo check --tests -p openhuman -p openhuman-cli --features "$(bash scripts/ci/product-features.sh)" passes. The app manifest and openhuman-embed/openhuman-tinyhumans --tests also compile.
  • Full lib suite (product features): 10350 passed, 1 failed. The failure is the known connected_integrations_cache_is_keyed_per_credential; see refactor(core): move time/goals tools, conversation store and composio execute into vendor crates #6785.
  • Vendor crates: fmt and clippy -D warnings are clean on all three.
    • tinyruntime-pyserver: 35 tests, at least 96% per-file line coverage.
    • tinybus: 346 tests.
    • tinyvoice: 94 tests with all features, and the default build is green.
  • CI scripts: rust:layout, check-agent-runtime-boundary, check-feature-forwarding, check-gated-test-allowlist and check-submodule-monotonic upstream/main HEAD (11 pins forward) pass. check-module-pins passes for tinyruntime and tinyvoice through their exemptions. The only failures are tinywallet and tinychannels, which come from test: drop 45 quarantined raw-coverage files, dedupe vendor-covered tests, repoint vendor pins #6781.

Merge order

Merge tinyruntime#19, tinybus#30 and tinyvoice#17 (which follows tinyvoice#16), then cut releases for tinyruntime and tinyvoice so their exemptions can be removed. This PR merges after #6789.

senamakel and others added 29 commits September 30, 2026 09:40
Updated the pinned commit for the vendor/tinybus submodule to incorporate upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the pinned commit for the tinybus vendored dependency to include recent changes, as indicated by the new subproject commit hash.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the pinned commit of the vendor/tinybus subproject to incorporate upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the ops module attempted to access a resolution that did not exist, it would panic instead of returning a proper error. This change adds a check for the missing resolution and returns an appropriate error result, ensuring the system handles this case gracefully rather than crashing.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The ops module and its associated test file were no longer being used by any other part of the codebase, so they have been removed to eliminate dead code and reduce maintenance burden. The module was also removed from the modules index to prevent compilation errors.

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

The `is_safe_path_component` and `artifact_dir` functions were moved from the local `ops` module into the `tinybus` library, along with the `prune_stale_versions` logic. The tests that exercised these functions directly are removed because the same coverage now lives in the `tinybus` test suite. The remaining test for registry entries was updated to call the new location. The memory tests were also updated to use the renamed `resolution::global` and `table.mark_in_flight` APIs.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the pinned commit for the vendored tinyruntime subproject to incorporate upstream fixes and improvements.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the pinned commit for the tinyruntime vendored dependency to incorporate upstream fixes or improvements.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the pinned commit of the tinyruntime vendored dependency to incorporate upstream fixes and improvements.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the pinned commit of the tinyruntime vendored dependency to include recent upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the vendored tinyruntime library to the latest version to incorporate upstream bug fixes and performance improvements.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a new Python server runtime module that allows the core runtime to spawn and communicate with a Python subprocess for executing user-provided Python code. This change adds the server process management, protocol definitions for message passing, type definitions, and corresponding unit tests, enabling safe and isolated code execution within the runtime environment.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The core crate now depends on tinyruntime-pyserver, the library that provides the persistent Python worker used by runtime::python_server for spaCy and Kompress processing. This is a pure library dependency with no bus or module registration, carrying only serde, tokio, and tracing.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the pinned commit for the tinyvoice vendored dependency to incorporate upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the pinned commit for the tinyvoice vendored dependency to include the latest upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the pinned commit for the tinyvoice vendored subproject to include recent changes. The new commit hash reflects the latest upstream state.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The tinyvoice submodule pointer has been advanced to include the latest upstream changes, keeping the vendored dependency in sync with the project's requirements.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the pinned commit of the tinyvoice vendored dependency to incorporate upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the pinned commit for the tinyvoice vendored subproject to incorporate upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the audio capture buffer reaches capacity, the system now discards the oldest samples instead of failing silently. This prevents audio processing from stalling during prolonged recording sessions while maintaining real-time performance.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the audio capture device returns an empty buffer, the system now returns an empty result instead of panicking. This prevents crashes on devices that occasionally deliver zero-length audio frames during initialization or silence periods.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the audio capture device is not available, the system now returns an error instead of panicking. This allows the caller to handle the failure gracefully and retry or fall back to an alternative input method.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the dependency specifications in the Cargo.toml file to align with the latest compatible versions, ensuring the project builds against current releases and avoids potential deprecation issues.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The cpal audio library dependency was removed from the crate that previously depended on it and added to the tinyvoice crate, which is the actual consumer of this audio playback functionality.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the module-pin-exemptions.json to reflect new submodule pins for tinyruntime and tinyvoice. The tinyruntime pin now includes the new tinyruntime-pyserver crate, and the tinyvoice pin adds the `capture` cargo feature alongside the existing `hotkey` feature. Both changes are backward-compatible with the published registry artifacts, as they only add new library crates or off-by-default features without modifying existing module, contract, or bus source code.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds README documentation for the core modules, voice subsystem, and python server runtime to improve project onboarding and clarify the purpose of each component.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add documentation for the voice module and its always-on submodule to clarify their purpose and usage within the openhuman-core crate.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The lockfile is updated to reflect the removal of the `cpal` dependency from the main application crate and its addition to the `tinyvoice` crate, alongside the introduction of a new `tinyruntime-pyserver` dependency.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test now calls `tinybus::module::artifact_dir` directly instead of the deprecated `ops::artifact_dir` wrapper, ensuring the test exercises the current public API and will continue to work after the wrapper is removed.

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

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 6e181a59-c2a2-44e3-9560-a033793578f6

📥 Commits

Reviewing files that changed from the base of the PR and between d4c9fd0 and 49979a1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (27)
  • crates/openhuman-core/Cargo.toml
  • crates/openhuman-core/src/modules/README.md
  • crates/openhuman-core/src/modules/desktop.rs
  • crates/openhuman-core/src/modules/memory_tests.rs
  • crates/openhuman-core/src/modules/mod.rs
  • crates/openhuman-core/src/modules/ops.rs
  • crates/openhuman-core/src/modules/ops_tests.rs
  • crates/openhuman-core/src/modules/resolution.rs
  • crates/openhuman-core/src/modules/resolution_tests.rs
  • crates/openhuman-core/src/runtime/python_server/README.md
  • crates/openhuman-core/src/runtime/python_server/kompress.rs
  • crates/openhuman-core/src/runtime/python_server/mod.rs
  • crates/openhuman-core/src/runtime/python_server/protocol.rs
  • crates/openhuman-core/src/runtime/python_server/protocol_tests.rs
  • crates/openhuman-core/src/runtime/python_server/server.py
  • crates/openhuman-core/src/runtime/python_server/server.rs
  • crates/openhuman-core/src/runtime/python_server/server_tests.rs
  • crates/openhuman-core/src/runtime/python_server/types.rs
  • crates/openhuman-core/src/voice/README.md
  • crates/openhuman-core/src/voice/always_on/README.md
  • crates/openhuman-core/src/voice/always_on/capture.rs
  • crates/openhuman-core/src/voice/audio_capture.rs
  • crates/openhuman-core/src/voice/audio_capture_tests.rs
  • scripts/ci/module-pin-exemptions.json
  • vendor/tinybus
  • vendor/tinyruntime
  • vendor/tinyvoice
 ______________________________________________________________________________________________________________________________________________________________
< Find bugs once. Once a human tester finds a bug, it should be the last time a human tester finds that bug. Automatic tests should check for it from then on. >
 --------------------------------------------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Comment @coderabbitai help to get the list of available commands.

@tinysweeper

tinysweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

⚠️ Review failed for 5799027c01f8. pull request exceeds review limits: 322 changed files (limit 500), 65923 changed lines (limit 50000)

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel merged commit ee49cef into tinyhumansai:main Sep 30, 2026
26 of 29 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.

1 participant