Skip to content

feat(module): own bounded live transport and relay runtime - #34

Merged
senamakel merged 88 commits into
mainfrom
shrink-core-relay-runtime-7414
Oct 12, 2026
Merged

senamakel merged 88 commits into
mainfrom
shrink-core-relay-runtime-7414

Conversation

@senamakel

@senamakel senamakel commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

A voice relay turn currently needs generic queue/deadline/progress coordination in its host. This adds compiled TinyVoice relay operations that own slot scheduling, acknowledgment while queued or awaiting admission, ordered selected deltas, and deferred completion. Host callbacks retain the saved native brain, current policy, model/thread choices, persistence and product delivery.

The host binds an unpredictable reserved handle to an existing saved context before start. Unknown or revoked contexts cannot manufacture native execution. Callbacks replay retained events and deduplicate stable effect delivery IDs; cleanup is bounded, idempotent and stops only registered work. The additive contract is 1.8 with exactly 47 module methods.

Validation

  • Actual missing RelayConfigure bus regression RED → GREEN.
  • Deterministic pending-admission acknowledgment and rejected-admission wire termination regressions RED → GREEN; 17 native relay lifecycle/order fixtures.
  • Full native module suite: 181 passed. Owner library/bus suites: 116 + 7 passed, 20 doc tests passed.
  • Fresh default native cdylib loaded through TinyBus: exact 47-method manifest; a real host fixture task streams and completes, lost effect replies deduplicate, late completion remains deferred, revoked context starts zero tasks, repeated starts/releases and shutdown remain safe.
  • Instrumented loaded artifact + native coverage: relay actor 94.72%, relay table 93.91%; all six existing live runtime files ≥90%. Every owner workspace file passes its 90% gate.
  • Strict workspace/module Clippy, formatting, warning-denied workspace/module documentation, release-version script, workflow YAML and shell syntax pass.

Review regressions

At 28170a0, three actual RED → GREEN native tests reproduce and fix the new review findings: exhausted effect acknowledgments no longer send contradictory effects under another delivery ID; the execution slot remains held until native cleanup finishes; stalled effect delivery is canceled within the remaining overall turn budget. An additional deterministic fixture proves unconfirmed cleanup closes slot admission instead of starting queued native work. Final timeout notifications follow stopped native work under a separate bounded callback budget; registered host context remains available for those terminal effects. The final full suite and strict gates passed locally and hosted checks passed at28170a0.

Canonical reconciliation and host adoption

This branch includes the complete generic live provider/socket runtime originally proposed in closed, unmerged PR33, followed by the relay coordinator. The module owns provider event projection, bounded duplex transport and session polling, context admission, cancellation and relay scheduling. Host callbacks retain policy, credentials and native brain/product effects. The combined contract is 1.8 with exactly 47 methods.

PR32 and TinyBus50 have actually merged. The branch preserves canonical TinyVoice fc4f104 (including provider contracts and uniform module CI), uses merged TinyBus10579d4, and retains canonical TinyAgents3ed8fce. Canonical reusable CI/release workflows remain; their hooks run the existing live per-file coverage and release-version fixtures. Closed PR33 is not a merge prerequisite because its runtime source is included here.

Fresh checks after preserve-merge7ea715c pass: 181 native module units; 116 library + 7 bus + 20 docs + 5 provider API tests; root/module strict Clippy and warning-denied docs; release/version/native-portability fixtures; actual default-feature 47-method cdylib loader; workspace 90% per-file coverage and all eight live/relay runtime files ≥90%. Relay actor94.72%, table93.91%. Rust tests/Clippy/docs/default artifact used the canonical stable toolchain; coverage scripts used their normal toolchain. New-head hosted checks are pending. No OpenHuman source or release pin is promoted here; child tinyhumansai/openhuman#7414 remains incomplete until an actual released, admitted module is adopted and its host adapter is verified.

senamakel and others added 30 commits October 11, 2026 19:58
Add the tinyagents repository as a git submodule under vendor so it can be
consumed alongside the existing vendored dependencies.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Document the intended design and rollout plan for the live module
runtime so the implementation work has a shared reference.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that parsing a live start frame keeps the default
input sample rate and carries the thread and client identifiers through
the reply.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a PrepareLiveInput bus method and bump the contract version to 1.7 so
hosts can parse portable live control frames without applying host policy.
A new LiveProtocol error reports frames that violate the control protocol.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ice-module/Cargo.toml,crates/ti

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The live websocket control types now live under a live submodule instead of a
single file, and the module service advertises the PrepareLiveInput method so
hosts can reach it. The verify_module example exercises a start frame to confirm
the default sixteen kHz input rate is preserved.

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

The verify_module example now calls a dedicated verify_live_input function instead of inlining the live start framing check, and the service module registers the new live submodule. This keeps the example's main flow readable and gives the live projection code a place to live.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add the wire types the host uses to drive a live session: provider
connection material, provider configuration, the start request, session
commands and the handle request. Credentials and configuration are kept
out of Debug output so secrets do not leak into logs.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Live tool declarations now include a prefer_markdown flag so the host's
compact result rendering preference survives the trip to the provider, and
the live service gains a callback module to hold that plumbing.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The ready projection test now compares the whole mapped frame against an expected value instead of destructuring a single field, so any change to the other fields of the ready frame is caught as well.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Live sessions now carry a host-selected tool-call cap and string lease
identities, and a new FinishLiveContext method lets the host idempotently
revoke a known context and cancel its work. Tool callback requests and
replies are also rejected when their serialized form exceeds one mebibyte,
so oversized payloads fail dispatch instead of being relayed.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that a live reservation can be created before the
provider starts and then released, verifying the reserved and closed
states along with the handle id length.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Wire up the new actor, prepare, and table modules in the live service and
re-export the session table for use by the runtime.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Session teardown now waits for the actor to acknowledge that host context
cleanup finished, and reports an error if the worker exits unexpectedly or
the acknowledgement never arrives. Startup validation also rejects connect
and tool timeouts above their upper bounds so oversized values cannot stall
a session indefinitely.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add LiveReserve, LiveStart, LiveSend, LiveRead, LiveRelease and LiveShutdown
methods to the Voice interface, backed by a shared live session table wired to
the bus connection at setup. This lets clients reserve, drive and tear down
bounded live sessions through the module rather than only preparing input
frames.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The start path now checks the session's closed flag and the lease's
cancelled flag before admitting a reservation, so a session that was
shut down or cancelled can no longer be started. Visibility of the
session methods was also widened to the service module to match their
actual callers.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a test module for the live session table and enables tokio's
test-util feature in dev-dependencies so tests can control time.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The two shutdown tests now hold the session lease in a local binding
before passing it to the blocked task, so the lease outlives the call
instead of being dropped as a temporary.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that aborting an in-flight release does not detach the
owned provider worker, so the worker is still dropped when the lease goes away.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Shutdown now stops all admitted sessions in parallel via a JoinSet so the
deadline no longer scales with session count, and cleanup futures are aborted
if the caller cancels. Provider worker handles are wrapped so dropping a
cleanup future aborts the task instead of detaching it.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Wire the callback tool's test file into the module tree so its tests are
compiled and run.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a test module for the live actor and switches the callback test
fixture to the connection's serve_at helper, which is the current API.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Live event projection now rejects oversized session ids, provider errors and
remote close reasons before they reach the host, and context cleanup takes the
tool port directly so repeated or late finish calls only revoke a known host
context once. Tests cover the unresponsive-host timeout and idempotent
revocation paths, and the module docs now list the 41 methods under contract
1.7.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The verify_module example now runs a live runtime check against the bus,
using tokio-tungstenite and futures-util as dev-dependencies. The bus
constants are imported from tinyvoice_bus instead of tinyvoice_module so
the example exercises the same names the module serves.

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

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a CancelLiveTool callback and a fresh invocation id on ExecuteLiveTool so
the module can tell the host to revoke exactly one known invocation when its
native dispatch future is dropped, rather than leaving host work detached.
Cancellation is bounded and best effort, so hosts must still cancel their own
invocation leases on endpoint or context teardown.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The live verification example now uses tokio's async mutex for its call
and finish counters instead of std's blocking mutex, and the output
checker became async to match. This keeps the fixture from blocking the
runtime while it holds the lock.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
senamakel and others added 10 commits October 11, 2026 22:08
Add actor tests for native completion fallback outcomes, release
timeouts on unresponsive hosts, revoked authority, scheduler drops, and
late or unknown finish requests. Also guard start against invocation
ids that have already finished so a completed context cannot be
reopened.

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

The fixture brain now blocks start on a cancellable notify instead of a
pending future, so tests can release a held start and assert the actor
observes the cancellation. The acknowledgment deadline test now propagates
the release error and checks the admission stopped flag, and the revoked
authority test asserts an error effect is emitted.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The relay actor now emits a bounded generic error effect when coordination
fails, instead of only signalling a lost brain, so callers see a terminal
failure rather than a stalled turn. Documentation and the module manifest
were updated to contract 1.8 with the five new relay methods, and the
relay table gained a test module.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The verify_module example now runs a relay runtime check alongside the
existing live verification, exercising the relay path through the new
relay_runtime module.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a spec describing how the compiled module coordinates admitted local-brain turns through RelayHost callbacks, covering scheduling, selected progress, the acknowledgment clock that starts before queueing, and deferred completion. Link it from the module and README docs, and wire up the relay runtime test module.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that when the overall deadline expires, both a queued
and an active turn are finished with a Lost outcome rather than a fabricated
native completion. The active case also checks that the native invocation is
dropped, while the queued case never starts one.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The coverage script now takes a prefix and expected file count so it can
enforce the same 90% line threshold for the relay runtime sources as it
already did for the live runtime. The verify_module example was
restructured to group the portable runtime checks behind a single helper
and to extract the per-context relay verification into its own function,
keeping the example readable as more runtimes are added.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Link the new relay module runtime specification from the specs README so the module-owned queue, acknowledgment deadlines and saved native context callbacks are discoverable alongside the other accepted specs.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted the turn timeout value in the relay runtime test to use an
underscore digit separator, matching the style used elsewhere. No
behaviour change.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reword the relay coordinator step to name the portable queue, acknowledgment and completion coordinator and point at its contract and regression proof in the relay module runtime spec. The host-owned product model, progress filtering and delivery choices are now stated explicitly.

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

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 55 billable files and costs up to $13.75.

Or wait 16 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6faea493-60c3-479a-bc40-51721972f6e3

📥 Commits

Reviewing files that changed from the base of the PR and between fc4f104 and 7ea715c.


⛔ Files ignored due to path filters (1)
  • crates/tinyvoice-module/Cargo.lock is excluded by !**/*.lock

📒 Files selected for processing (55)
  • .github/scripts/check-live-module-coverage.sh
  • .gitmodules
  • MODULE.md
  • README.md
  • crates/tinyvoice-bus/src/lib.rs
  • crates/tinyvoice-bus/src/live/mod.rs
  • crates/tinyvoice-bus/src/live/session.rs
  • crates/tinyvoice-bus/src/live/session_tests.rs
  • crates/tinyvoice-bus/src/live/transport.rs
  • crates/tinyvoice-bus/src/live/transport_tests.rs
  • crates/tinyvoice-bus/src/names/mod.rs
  • crates/tinyvoice-bus/src/relay.rs
  • crates/tinyvoice-bus/src/relay/runtime.rs
  • crates/tinyvoice-bus/src/relay/runtime_tests.rs
  • crates/tinyvoice-bus/src/version/mod.rs
  • crates/tinyvoice-module/Cargo.toml
  • crates/tinyvoice-module/examples/verify_module.rs
  • crates/tinyvoice-module/examples/verify_module/live.rs
  • crates/tinyvoice-module/examples/verify_module/relay_runtime.rs
  • crates/tinyvoice-module/src/lib.rs
  • crates/tinyvoice-module/src/service/live/actor.rs
  • crates/tinyvoice-module/src/service/live/actor_tests.rs
  • crates/tinyvoice-module/src/service/live/callback.rs
  • crates/tinyvoice-module/src/service/live/callback_tests.rs
  • crates/tinyvoice-module/src/service/live/fixtures/start.json
  • crates/tinyvoice-module/src/service/live/mod.rs
  • crates/tinyvoice-module/src/service/live/prepare.rs
  • crates/tinyvoice-module/src/service/live/prepare_tests.rs
  • crates/tinyvoice-module/src/service/live/projection.rs
  • crates/tinyvoice-module/src/service/live/projection_tests.rs
  • crates/tinyvoice-module/src/service/live/table.rs
  • crates/tinyvoice-module/src/service/live/table_tests.rs
  • crates/tinyvoice-module/src/service/live/transport.rs
  • crates/tinyvoice-module/src/service/live/transport_tests.rs
  • crates/tinyvoice-module/src/service/mod.rs
  • crates/tinyvoice-module/src/service/mod_tests.rs
  • crates/tinyvoice-module/src/service/relay.rs
  • crates/tinyvoice-module/src/service/relay_runtime/actor.rs
  • crates/tinyvoice-module/src/service/relay_runtime/actor_tests.rs
  • crates/tinyvoice-module/src/service/relay_runtime/mod.rs
  • crates/tinyvoice-module/src/service/relay_runtime/table.rs
  • crates/tinyvoice-module/src/service/relay_runtime/table_tests.rs
  • crates/tinyvoice/src/error/mod.rs
  • crates/tinyvoice/src/lib.rs
  • crates/tinyvoice/src/live/mod.rs
  • crates/tinyvoice/src/live/mod_tests.rs
  • docs/plans/live-module-runtime.md
  • docs/specs/README.md
  • docs/specs/live-module-runtime.md
  • docs/specs/module-capture.md
  • docs/specs/relay-module-runtime.md
  • scripts/check-coverage.sh
  • scripts/test-features.sh
  • vendor/tinyagents
  • vendor/tinybus

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

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

@senamakel

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T19:33:17.351942Z 21130ad Manual request
ℹ️ 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21130ad505

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/tinyvoice-module/src/service/relay_runtime/actor.rs Outdated
Comment thread crates/tinyvoice-module/src/service/relay_runtime/actor.rs Outdated
Comment thread crates/tinyvoice-module/src/service/relay_runtime/actor.rs
senamakel and others added 8 commits October 11, 2026 22:38
…ne cancellation

Adds actor tests for three relay runtime edge cases: a lost commit
acknowledgment must not emit contradictory new effects, the native execution
slot stays reserved until finish confirms stopped work, and the overall
deadline cancels stalled effect delivery before the callback retry budget is
exhausted. The Brain fixture gains hooks to hold or fail apply and to gate
finish so these paths can be exercised deterministically.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The relay actor now keeps its scheduler permit alive past the turn and only
releases it once the host confirms the finish, closing the semaphore when
confirmation fails so a lost completion cannot silently free capacity. Delivery
tracking also records whether an effect group is still unacknowledged, so a
missing completion is reported as a loss rather than an invented native error.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The delivery now records the turn expiry so the apply retry loop can bail out
once the deadline has passed, and the callback timeout is capped by that
expiry. This prevents a second apply attempt from running past the turn
timeout when the first attempt consumed most of the budget.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Expiry now records the terminal effects on the delivery instead of applying
them immediately, so the turn budget is not extended while the brain is
still executing. The effects are applied once native cleanup completes,
and a test covers the unconfirmed-cleanup path closing slots rather than
starting queued work.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The expiry branch of the coordination select now calls lose with only the
request, delivery, streamed, and foreground_closed values, matching the
function's current signature.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The expiry path in the relay coordinator now records lost effects and returns
success instead of propagating a result from lose, which no longer returns one.
This keeps the registered context available so bounded terminal timeout effects
can still be delivered after finish stops native work, and the runtime spec
documents the new admission and cleanup ordering.

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

The relay actor test fixture used separate boolean flags to model
acknowledgment loss, pending effects, and finish release waits, which made
mutually exclusive states representable. These are now expressed as
EffectMode and FinishMode enums so each fixture can only select one
behaviour at a time.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel senamakel changed the title feat(module): own relay queue and bounded turn coordination feat(module): own bounded live transport and relay runtime Oct 11, 2026
@senamakel
senamakel changed the base branch from shrink-core-live-runtime-7414 to main October 11, 2026 22:25
@senamakel
senamakel marked this pull request as ready for review October 11, 2026 22:25
@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.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@senamakel senamakel self-assigned this Oct 12, 2026
@senamakel
senamakel merged commit e5c7d1a into main Oct 12, 2026
14 checks passed
@senamakel
senamakel deleted the shrink-core-relay-runtime-7414 branch October 12, 2026 05:13
@tinysweeper

tinysweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

⚠️ Review failed for 7ea715c681e3. the review of #34 did not finish within 900s

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