-
Notifications
You must be signed in to change notification settings - Fork 7
Take openhuman-embed by pinned git rev so hosts can patch it #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b838c98
6a6a76b
8f5f234
b0195c7
0d7f0bb
e5aa837
10149e1
392e100
aa535f8
af1d2ce
db4a39e
d8a21e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/sh | ||
| # Assert the `rev` of the git `openhuman-embed` dependency in Cargo.toml equals | ||
| # the commit recorded for the `vendor/openhuman` submodule. The `[patch]` in | ||
| # Cargo.toml builds this workspace against the submodule; a consumer without | ||
| # that patch builds against the rev. If they drift, the two build different | ||
| # OpenHuman trees and nothing else would say so. | ||
| set -eu | ||
| cd "$(dirname "$0")/../.." | ||
| rev=$(sed -n 's/^openhuman-embed = { git = "https:\/\/github.com\/tinyhumansai\/openhuman", rev = "\([0-9a-f]*\)".*/\1/p' Cargo.toml) | ||
| sub=$(git ls-tree HEAD vendor/openhuman | awk '{print $3}') | ||
| if [ -z "$rev" ] || [ -z "$sub" ]; then | ||
| echo "assert-openhuman-pin: could not read the rev ($rev) or the submodule pointer ($sub)" >&2 | ||
| exit 1 | ||
| fi | ||
| if [ "$rev" != "$sub" ]; then | ||
| echo "assert-openhuman-pin: Cargo.toml pins openhuman-embed at $rev but vendor/openhuman records $sub" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "assert-openhuman-pin: $rev" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,17 +44,39 @@ wildcards = "deny" | |
| # manifest sets `publish = false`. A wildcard on anything from a registry is | ||
| # still denied, which is what this check exists for. | ||
| allow-wildcard-paths = true | ||
| # `openhuman` is a revision-pinned git dependency patched to the recorded | ||
| # submodule. Its public manifest uses `workspace = true` for its internal | ||
| # crates, which cargo-deny classifies as wildcard dependencies even though the | ||
| # resolved graph is fixed by Cargo.lock and assert-openhuman-pin.sh. Skip only | ||
|
senamakel marked this conversation as resolved.
|
||
| # this exact package's manifest-level wildcard finding; its dependency tree | ||
| # remains subject to every ban check. | ||
| skip = [ | ||
| { name = "openhuman", version = "0.63.29" }, | ||
| ] | ||
|
Comment on lines
+53
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the supply-chain job, this does not suppress the AGENTS.md reference: AGENTS.md:L436-L438 Useful? React with 👍 / 👎. |
||
| # Crates that must never enter the dependency graph. | ||
| deny = [] | ||
|
|
||
| [sources] | ||
| unknown-registry = "deny" | ||
| unknown-git = "deny" | ||
| allow-registry = ["https://github.com/rust-lang/crates.io-index"] | ||
| # Examples take OpenHuman, tinyinference, tinytools, and tinyjevclient as | ||
| # revision-pinned git dependencies rather than published versions. Nothing under | ||
| # crates/* depends on their transports; `.github/scripts/assert-pure.sh` checks | ||
| # the normal/build graph. See AGENTS.md's supply-chain boundary. | ||
| # Examples take tinyinference, tinytools, and tinyjevclient as revision-pinned | ||
| # git dependencies rather than published versions; nothing under crates/* | ||
| # depends on their transports, and `.github/scripts/assert-pure.sh` checks the | ||
| # normal/build graph for the pure crates. See AGENTS.md's supply-chain | ||
| # boundary. | ||
| # | ||
| # OpenHuman is the one exception: `openhuman-embed` is also a revision-pinned | ||
| # git dependency of `tinyhivemind-openhuman`, a library crate, per | ||
| # `docs/adr/0020-openhuman-embed-is-a-git-dependency-patched-locally.md`. | ||
| # `[patch]` in the root `Cargo.toml` redirects that source onto the | ||
| # `vendor/openhuman` submodule this repository already vendors and tests | ||
| # against, so every build here still compiles the vendored tree, not a fresh | ||
| # git fetch. `.github/scripts/assert-openhuman-pin.sh`, run in the `rust` CI | ||
| # job, reads the `rev` pinned in `Cargo.toml` and the `vendor/openhuman` | ||
| # submodule's commit and fails the build if they disagree — the supply-chain | ||
| # guarantee this exemption relies on is that check, not an absence of library | ||
| # dependents. | ||
| allow-git = [ | ||
| "https://github.com/tinyhumansai/openhuman", | ||
| "https://github.com/tinyhumansai/tinyinference", | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| # 13. A vendored crate may back an example and never a library crate | ||||||
|
|
||||||
| - **Status:** Accepted — implemented | ||||||
| - **Status:** Accepted — implemented; amended by [ADR 0020](0020-openhuman-embed-is-a-git-dependency-patched-locally.md) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '1,140p' docs/adr/README.md
sed -n '1,115p' docs/adr/0013-a-vendored-crate-is-an-example-dependency.md
sed -n '1,125p' docs/adr/0020-openhuman-embed-is-a-git-dependency-patched-locally.md
rg -n -i 'immutable|Accepted-and-superseded|ADR status|amend' docs README.md CONTRIBUTING.md AGENTS.md .github 2>/dev/nullRepository: tinyhumansai/tinyhivemind Length of output: 17947 Restore ADR 0013's status to
Suggested change
🤖 Prompt for AI Agents |
||||||
| - **Date:** 2026-09-09 | ||||||
|
|
||||||
| ## Context | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # 20. `openhuman-embed` is a git dependency, patched locally | ||
|
|
||
| - **Status:** Accepted | ||
| - **Date:** 2026-09-20 | ||
| - **Amends:** [ADR 0013](0013-a-vendored-crate-is-an-example-dependency.md) | ||
|
|
||
| ## Context | ||
|
|
||
| [ADR 0013](0013-a-vendored-crate-is-an-example-dependency.md) drew the line at | ||
| library crates: a vendored, outside-the-workspace crate may back an example and | ||
| never a dependency of `tinyhivemind-core`, `tinyhivemind-hive`, or | ||
| `tinyhivemind`, because this repository is itself vendored — a consumer takes | ||
| `crates/*` as path dependencies — and a vendored dependency of a vendored | ||
| dependency becomes a nested submodule in every consumer. | ||
|
|
||
| `tinyhivemind-openhuman` is the exception that decision named without solving: | ||
| it is a library crate, and it must name `openhuman_embed::Agent` to bind | ||
| already-built OpenHuman agents into a hive. `openhuman-embed` cannot be an | ||
| example-only dev-dependency the way `tinytools` and `tinyinference` are, | ||
| because the type it names has to be the same type a consuming host's own agent | ||
| handles are built with — a host binding one of its own `Agent` values into a | ||
| `tinyhivemind-openhuman` adapter is exactly the point of the crate. | ||
|
|
||
| A consumer of this repository — OpenCompany is the first — vendors this | ||
| repository as a submodule *and* independently vendors its own OpenHuman | ||
| checkout, because OpenCompany's own runtime is built against it directly, not | ||
| only through this adapter. Two checkouts of the same crate compiled into one | ||
| binary are two `Agent` types and two copies of OpenHuman's process-wide state, | ||
| which is a linker-level bug, not a style objection. | ||
|
|
||
| `openhuman-embed = { path = "vendor/openhuman/crates/openhuman-embed" }` — the | ||
| form ADR 0013 would otherwise require — cannot be resolved onto a different | ||
| tree by a downstream consumer. Cargo's `[patch]` table can redirect a git or | ||
| registry source onto a local path; it has no mechanism to redirect a path | ||
| source onto a different path. A path dependency here is therefore not just the | ||
| form ADR 0013 asks for done slightly wrong: it is the one form that forecloses | ||
| the fix a consumer would need. | ||
|
|
||
| ## Decision | ||
|
|
||
| `openhuman-embed` is a **git dependency pinned by revision** in the root | ||
| `Cargo.toml`'s `[workspace.dependencies]`, consumed by `tinyhivemind-openhuman` | ||
| — a library crate — same as any other dependency there. This repository's own | ||
| build patches that source onto the vendored `vendor/openhuman` submodule it | ||
| already carries and tests against: | ||
|
|
||
| ```toml | ||
| [workspace.dependencies] | ||
| openhuman-embed = { git = "https://github.com/tinyhumansai/openhuman", rev = "…", default-features = false } | ||
|
|
||
| [patch."https://github.com/tinyhumansai/openhuman"] | ||
| openhuman-embed = { path = "vendor/openhuman/crates/openhuman-embed" } | ||
| ``` | ||
|
|
||
| `.github/scripts/assert-openhuman-pin.sh`, run from the `rust` CI job, fails | ||
| the build when the pinned `rev` and the `vendor/openhuman` submodule pointer | ||
| disagree — the two must name the same tree, or this repository's own tests | ||
| would pass against a different OpenHuman than the `rev` promises to a | ||
| consumer. | ||
|
|
||
| A consumer that vendors its own OpenHuman checkout adds the identical shape of | ||
| `[patch]` entry in its own root manifest, pointed at its own vendored path. | ||
| That entry is what actually unifies the `Agent` type across the two trees — | ||
| the git dependency only names *which* OpenHuman revision both sides agree to | ||
| patch onto their own copy of. This repository's own `examples/openhuman` | ||
| integration target needed the same entry for the same reason once | ||
| `openhuman-embed` stopped being a path dependency: it is a separate Cargo | ||
| workspace (its own `[workspace]` table) that reaches `openhuman-embed` | ||
| transitively through `tinyhivemind-openhuman`'s `openhuman-embed.workspace = | ||
| true`, and `field.workspace = true` copies the dependency *spec* — now a git | ||
| source — across a workspace boundary without carrying the root workspace's | ||
| `[patch]` table with it. Its own `Cargo.toml` now repeats the same patch entry | ||
| this repository's root manifest declares, at the relative path its own | ||
| directory needs. Any consumer with the same shape of transitive reach to | ||
| `openhuman-embed` — a path dependency on a crate that inherits the dependency | ||
| from a *different* workspace's `[workspace.dependencies]` — needs the same | ||
| patch in that workspace's own manifest, not only in the workspace that first | ||
| declared the dependency spec. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - **This repository's own build is unaffected in substance.** The `[patch]` | ||
| table means every `cargo` invocation here still compiles | ||
| `vendor/openhuman/crates/openhuman-embed`, the same tree it compiled when | ||
| the dependency was a path. `cargo metadata --locked` and the existing | ||
| `Cargo.lock` needed no update for this change, because a patched-to-path | ||
| package resolves and locks identically to a plain path dependency. | ||
| - **A consumer gets a real choice instead of a forced fork.** Without this | ||
| change, a host vendoring both this repository and OpenHuman had no supported | ||
| way to make `tinyhivemind-openhuman`'s `openhuman_embed::Agent` the same type | ||
| as its own. With it, the host's `[patch]` table is the whole fix, and no | ||
| change to this repository is required to add one. | ||
| - **The dependency-policy line ADR 0013 drew — git dependencies only in | ||
| example dev-dependencies — has a second exception now, and it is the last | ||
| one this reasoning permits.** The exception is not "git dependencies are | ||
| fine in library crates"; it is narrowly this: a library crate that must | ||
| share a type with a consumer's own vendored copy of the same upstream crate | ||
| cannot take that dependency as a path, because `[patch]` cannot retarget a | ||
| path. Any future case must show the same shared-type, patch-only-fixes-it | ||
| shape or it is a plain policy violation, not a second exception. | ||
| - **A silent rev/submodule drift becomes a CI failure, not a silent split | ||
| build.** `.github/scripts/assert-openhuman-pin.sh` is the enforcement; it | ||
| runs in the `rust` job on every push. | ||
| - **`assert-pure.sh` is unaffected.** `tinyhivemind-openhuman` was never in | ||
| `pure_crates`; it already carries a transport-shaped dependency | ||
| (`openhuman-embed` binds a running agent), and this change does not move it | ||
| across that boundary. |
Uh oh!
There was an error while loading. Please reload this page.