Skip to content

Link tinymemory-bus and add the TinyMemory module client seam - #5647

Closed
senamakel wants to merge 6 commits into
tinyhumansai:mainfrom
senamakel:tinymemory-bus
Closed

Link tinymemory-bus and add the TinyMemory module client seam#5647
senamakel wants to merge 6 commits into
tinyhumansai:mainfrom
senamakel:tinymemory-bus

Conversation

@senamakel

@senamakel senamakel commented Aug 20, 2026

Copy link
Copy Markdown
Member

What changed and why

TinyMemory ships as a loadable TinyBus module — a cdylib exporting one object
with 89 members on it. The host can load that binary but cannot use anything
out of it, so the member names, the payload types and the error-name table have
to arrive as an ordinary library. They now do.

  • vendor/tinymemory submodule, pinned at the v1.1.0 tag — the release
    that introduced tinymemory-bus. Pinned at a tag rather than a main commit
    because a TinyMemory release is also what publishes the per-platform module
    archives and their checksum.toml; the library the host links has to be the
    one those archives were built from.
  • tinymemory-bus = { path = "vendor/tinymemory/crates/tinymemory-bus" }. This
    is the only piece of TinyMemory the host links: no engine, no storage, no
    traits, no async runtime. Seven pure-Rust dependencies (serde,
    serde_json, chrono, sha2, uuid, anyhow, thiserror).
  • src/openhuman/memory/driver/module/ — the client seam.

The client seam

MemoryModule binds the module's object over a tinybus::Proxy.
MemoryModule::call is public and reaches every member: pass a name from
tinymemory_bus::names::methods and the positional arguments as a tuple. Typed
wrappers cover the driver-level members (DriverId, Capabilities, Health,
Shutdown, OpenStore) and the mandatory core family (Store, Get,
Forget, List, Namespaces) — what a host needs to bind a driver and prove
it answers. The remaining families are one call each and get wrappers as the
driver seam grows into them.

OpenStore returns an object path, not a value — a sibling store under the
same workspace exporting the identical interface — so MemoryModule::at binds
one. OBJECT_PATH is the root object, not the only one.

The error mapping is the part worth reviewing

A TinyBus failure is a name plus prose. MethodFailed is the one that reached
the driver, and tinymemory_bus::wire::from_wire maps it back — the same table
the module mapped out through
, which is what stops the two ends drifting into
disagreeing about what a name means. The case that matters is PathEscape: it
reports a symlink or traversal that left the workspace sandbox, and flattening
it into Invalid would turn a security-relevant refusal into a caller mistake.

Everything that is not a MethodFailed never reached the driver, so it is
reported as the transport fact it is rather than flattened into Other:

TinyBus error becomes why
Timeout MemoryError::Timeout
NameHasNoOwner, Transport, Io Unreachable module not up yet — retryable
UnknownMethod/Object/Interface, IncompatibleVersion Backend version skew; the arguments were fine, so not Invalid
unrecognised error name Other a newer module may name an error this build has no variant for; answering Invalid would send a caller into a rewrite loop over correct input

Public API / behavior changes

Additive only. Nothing existing is touched: the diff is 7 files, and the only
edit to pre-existing code is memory/driver/mod.rs gaining pub mod module;
and a doc paragraph.

module is not a MemoryProvider impl and is not wired into driver
selection. It cannot be yet, and the module docs say so: embedded implements
the tinycortex_api contract this build pins, while module speaks the
tinymemory-bus vocabulary the loadable module was built against. At the
current TinyCortex pin those are unrelated types. They converge when the
TinyCortex pin moves to a revision that re-exports tinymemory-api.

Deliberately no [patch] entry yet

The natural companion would be:

[patch."https://github.com/tinyhumansai/tinymemory"]
tinymemory-api = { path = "vendor/tinymemory/crates/tinymemory-api" }
tinymemory-bus = { path = "vendor/tinymemory/crates/tinymemory-bus" }

It is not here, and that is deliberate rather than forgotten. The vendored
TinyCortex pin (ce98837) still defines the memory contract itself in
tinycortex-api; only newer revisions re-export tinymemory-api and pull it in
by git. Adding the patch now would make cargo warn about a patch matching
nothing in the graph.

It has to land in the same change that bumps the TinyCortex pin. Without it the
git copy and this path copy resolve as two distinct crates and MemoryEntry
from one is not MemoryEntry from the other — the exact failure TinyMemory's
own root manifest documents and patches around. The comment above the dependency
in Cargo.toml says this so the next person to move the pin finds it.

Validation

  • cargo build --lib — pass
  • cargo test --lib memory::driver::module — pass, 6 new tests
  • cargo fmt -- --check — pass
  • cargo clippy --lib --all-features — pass, no findings

cargo clippy --all-targets fails to compile tests/subconscious_fullstack_e2e.rs
(await in the non-async fn harness_with). Pre-existing and unrelated
the file is byte-identical to main (diff <(git show main:...) ... is empty)
and nothing in this PR can affect it. Not fixed here; raising rather than
widening scope.

Related

Depends on tinyhumansai/tinymemory#74, merged and released as v1.1.0.

Summary by CodeRabbit

  • New Features

    • Added support for connecting to TinyMemory as an external memory module.
    • Added memory operations for stores, entries, listings, namespaces, metadata, health checks, and lifecycle management.
    • Added support for targeting the root module or a specific store.
  • Bug Fixes

    • Improved handling and reporting of memory, transport, timeout, and contract errors.
  • Tests

    • Added coverage for error mapping and transport failure scenarios.

senamakel and others added 6 commits August 21, 2026 01:32
Add the tinymemory git submodule and register its tinymemory-bus crate as a path dependency in Cargo.toml. This provides the wire vocabulary for the TinyMemory TinyBus module, allowing the host to link only the payload types and member names without pulling in the engine, storage, or async runtime.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The module file for the memory driver was missing from the repository, causing compilation failures. This change restores the file to its expected state, ensuring the driver module can be properly built and used.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a doc comment for the newly exposed `module` submodule, explaining that it communicates with TinyMemory over TinyBus rather than through the in-process tinycortex engine. The note clarifies that the two drivers are not yet interchangeable because they implement different API contracts, and that convergence will happen once TinyCortex re-exports the tinymemory-api.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The Cargo.lock file is updated to include the new tinymemory-bus crate at version 0.1.0, which is now a dependency of the project. This change ensures the lock file reflects the addition of this crate and its dependencies to the workspace.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted the inline `matches!` macro calls in the driver error round-trip test to use multi-line layout, improving code readability without changing any test logic or behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the tinymemory submodule to the v1.1.0 release commit and documented in Cargo.toml that the submodule is pinned to this release tag rather than a main branch commit. This ensures the vendored crate matches the same version used to publish the per-platform module archives and their checksum.toml, guaranteeing that the library the host links against is the one those archives were built from.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel requested a review from a team August 20, 2026 23:08
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d28dcfe-ce37-4c22-971e-cef884ed8026

📥 Commits

Reviewing files that changed from the base of the PR and between 60775aa and 2c374fa.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • .gitmodules
  • Cargo.toml
  • src/openhuman/memory/driver/mod.rs
  • src/openhuman/memory/driver/module/mod.rs
  • src/openhuman/memory/driver/module/mod_tests.rs
  • vendor/tinymemory

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The PR vendors the TinyMemory bus contract and adds a public MemoryModule client. The client supports typed driver and store operations, maps TinyBus failures to MemoryError, and includes error-mapping tests.

Changes

TinyMemory module driver

Layer / File(s) Summary
Wire contract and driver wiring
.gitmodules, vendor/tinymemory, Cargo.toml, src/openhuman/memory/driver/mod.rs
The repository adds the TinyMemory submodule, pins the vendored tinymemory-bus dependency, and exports the module driver.
Module client and typed operations
src/openhuman/memory/driver/module/mod.rs
MemoryModule binds TinyBus objects and provides typed driver, store, entry, listing, and namespace operations.
Transport error mapping and validation
src/openhuman/memory/driver/module/mod.rs, src/openhuman/memory/driver/module/mod_tests.rs
TinyBus failures map to distinct MemoryError variants. Tests cover wire errors, transport failures, unknown members, and message preservation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to 2c374

The PR adds the TinyMemory client boundary and pins the dependency to the intended release. It is mergeable with explicit owner awareness that the repository’s signing or provenance policy for the vendored dependency still needs confirmation.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MemoryModule
  participant TinyBus
  participant TinyMemoryModule
  Client->>MemoryModule: invoke typed operation
  MemoryModule->>TinyBus: call member with serialized arguments
  TinyBus->>TinyMemoryModule: deliver TinyBus request
  TinyMemoryModule-->>TinyBus: return wire response
  TinyBus-->>MemoryModule: return response
  MemoryModule-->>Client: deserialize typed result
Loading

Suggested reviewers: al629176

Poem

A rabbit hops where TinyBus flows,
Typed calls bloom in tidy rows.
Errors keep their names and sound,
Stores and namespaces gather round.
The module door swings open wide.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: linking tinymemory-bus and adding the TinyMemory module client seam.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 3 files. (3 skipped: 3 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch tinymemory-bus

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@tinysweeper tinysweeper 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.

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out · 667 embedded · openrouter/openai/text-embedding-3-small

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant