Skip to content

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

Commits on main

test(memory): settle the memory module before asserting a settled answer\n\n`cargo test --lib -- openhuman::memory` fails on this branch, and the\nfailure is not this branch's: two assertions race the module load.\n\nA module is loaded once per process by whichever caller asks first, and\n`modules::ops::state_of` reports `Loading` for the whole of it. Two\ncorrect answers to that transient are indistinguishable from a\nregression. `MemoryProvider::health` returns `degraded("the memory module\nis loading")`, so `bound_driver_status_reports_id_class_contract_and_\ncapabilities` reads "degraded" where it asserts "ready". A handler that\nreaches the driver refuses with "memory is still starting", so\n`search_entities_rpc_rejects_unknown_entity_kind` gets that instead of\n"unknown entity kind: bogus".\n\nBoth pass alone and both fail in the nine-hundred-test filter — with this\nbranch's four new tests skipped, which is what places the fault outside\nthem. The filter is derived from the changed paths, so it is assembled\nonly by a PR that touches memory broadly; that is why the flake surfaces\nhere rather than on main.\n\n`settle_memory_module` awaits the resolution rather than polling\n`state_of`, which is the difference between closing the window and\nnarrowing it: `Ready` and `Failed` are both terminal — tinybus keeps a\nrefused library mapped, so a resolution is never retried — so the state\ncannot return to `Loading` afterwards. The outcome is ignored on purpose,\nbecause a host with no artifact for its platform resolves to `Failed`,\nwhich is settled too. `binding::test_module_config` is the same\nconfiguration the test-build `module_provider` binds through, named so\nthe wait and the binding cannot drift apart.\n\nFilter run: 900 passed, 0 failed, three times over; 899/1 before.\n
Shanu committed 2 months ago
7f12a6b
test(memory): restore host coverage for three RPC handlers\n\n`status_list_rpc`, `sync_status_rpc` and `add_rpc` had no test naming them.\nThey are not leftovers from a removed domain — all three are registered\ncontrollers the desktop app calls, and what they lost was coverage of **host\npolicy the engine never owned**, so nothing upstream replaces it.\n\nThey were exercised only by `tests/raw_coverage/memory_threads_*` and\n`memory_sync_tree_round21_*`, 4,800-line targets that drove ~40 subjects at\nonce through an in-process engine. #6170 deleted those with the engine, which\nwas right for most of what they asserted and wrong for this.\n\n**`status_list_rpc`** degrades every failure path to an empty list — a binding\nerror, a driver that does not serve `SourceSync`, and a driver call that fails.\nIts comment says this is inherited and deliberate: "this surface renders a\nstatus table, and every caller of it today treats 'no rows' as 'nothing\nsyncing'". Two of the three are covered here; the third needs a poisoned\nbinding cache, which no seam exposes.\n\n**`sync_status_rpc`** filters to ACTIVE slack connections and answers a fixed\nzero-value shape because per-connection detail is no longer readable. The four\nzeros are asserted individually rather than as a struct compare, since each is\na separate promise and a literal would hide which one broke. The log line is\nasserted too: the zeros are indistinguishable from "a connection that has\nsynced nothing yet", so without it the shape is a silent lie.\n\n**`add_rpc`** mints the `src_<uuid>` id and applies per-kind caps before the\nregistry sees the entry. `apply_kind_defaults` is `tinymemory-sources`' and\nupstream's to test; what belongs here is that this handler *calls* it, so an\nadd whose caps the user left unset cannot reach the registry uncapped.\n\nEvery assertion is mutation-tested — the behaviour broken, the test watched go\nred, the behaviour restored:\n\n degradation → surface the driver error → red\n filter → drop the is_active check → red\n shape → change per_channel_cursors → red\n defaults → skip apply_kind_defaults → red (left: None, right: Some(10))\n\nThat is the issue's own acceptance criterion, and it is there because #6170\nshipped three assertions that could not fail — two of them passing without the\ndriver being reached at all.\n\nTwo fixtures worth naming. `sync_status_rpc` needs connections back, so it uses\nwiremock against `config.api_url`, the pattern `file_storage/tools_tests.rs`\nalready sets for `/agent-integrations/*` — local only, no egress. `add_rpc`\nwrites through a process-global config loader, so its test pins\n`OPENHUMAN_WORKSPACE` while holding the crate's `TEST_ENV_LOCK`, which is\n`documents_tests.rs`'s existing pattern and serialises rather than races.\n\nCloses #6172\n
Shanu committed 2 months ago
fd812a4
f371db1
test(memory): make the entity-RPC assertions able to fail\n\nBoth CodeRabbit findings were right, and chasing the second exposed a third\nproblem underneath it.\n\n`delete_chunk_does_not_report_a_silent_success_without_the_family` accepted\neither `Err` or `Ok { deleted: false }`, because I wrote it without checking\nwhich the handler does. It returns `Err`, and the branch I allowed is precisely\nthe one `admin_tests` exists to forbid — a caller reading "nothing was removed"\nconcludes the content was already gone. It now requires the error.\n\nThe clamp test asserted that a log line existed and that the result was empty.\nBoth are true whether or not the handler clamps anything, so it could not fail.\n`EntityAwareDriver` now records every `limit` it is handed, and the test\nasserts `[MAX_LIST_LIMIT, 1]` for inputs `[u32::MAX, 0]` — measured where a\nclamp is observable, which is the value the driver receives.\n\nThat change immediately failed with `left: []`. Not because the driver was\nunbound — a probe confirmed `driver_id="entity-aware-test-driver"` — but\nbecause the line recording the limit had never landed: `cargo fmt` split the\nreturn type across lines before my edit ran, the search string stopped\nmatching, and a no-match replace silently does nothing.\n\nThe consequence is the part worth keeping. The two `kind` tests beside it\nassert an **empty list**, which is exactly what an unreached driver also\nproduces, so they had been passing without the driver being called at all — and\nonly the clamp assertion could tell. That is the same vacuous-pass shape this\nbranch has been finding all the way up the stack, this time in a test I wrote\nin the course of fixing it. Both now assert the driver was reached, so an empty\nlist means "the handler asked and got nothing" rather than "nobody asked".\n
Shanu committed 2 months ago
397c1f6
fix(agent): keep synthesised delegates out of the durable registry\n\nReview follow-up for #6162 (CodeRabbit precedence finding + the\nmaintainer's correction on #6145).\n\nThe synthesised delegation set and the durable registry were ordered\ndifferently on different surfaces: `tool_specs` (and the first-wins\nspec dedup) listed durable tools first, while turn dispatch registered\nthe synthesised set first. A durable tool that owned a delegate's name\nwas therefore advertised under its own schema and executed as the\ndelegate. The ordering was also load-bearing for a reason the PR did\nnot state: `from_config` still appended the build-time delegates into\n`tools`, so after the first refresh the durable Arc held stale delegate\ninstances that only the synthesised-first order kept off the wire —\nand that the prompt catalogue listed twice.\n\n- `AgentBuilder::synthesized_tools`: the factory hands the build-time\n delegates to the builder as their own set; `build()` keeps them in\n `Agent::synthesized_tools`, advertises them, classifies them in the\n policy session and seeds the refresh mask. `Agent::tools` never holds\n a delegate again.\n- `builder::drop_synthesized_name_collisions`: a synthesised name a\n durable tool already owns is dropped, at build time and on every\n refresh, so the two sets are disjoint by construction and a durable\n tool wins on every surface. Filtering before the mask also closes a\n latent bug: the unfiltered mask let the next refresh's spec `retain`\n withdraw the durable tool's own spec.\n- Dispatch enumerates durable then synthesised, the same order as\n `tool_specs` and `Agent::all_tool_refs`.\n- `pformat::build_registry_from_refs` so the P-Format registry still\n covers both sets.\n- Docs and the PR narrative corrected per the maintainer's trace: the\n connect direction was invisible (the fail-closed policy filter hid the\n spec-without-instance), the revoke direction left a withdrawn\n delegate registered and callable. `AgentToolSource` mentions removed.\n\nTests: revoke-direction regression (instance and policy decision go\nwith the spec while an in-flight turn holds clones), durable-name\ncollision across refreshes, builder split, and `from_config` wiring.\nThe shared invariant helper now also asserts the two sets are disjoint\nand that every synthesised tool carries a policy decision.\n
Shanu committed 2 months ago
92b6617
chore(memory): retire the contacts gate's engine test and its allowlist entries\n\n`Rust Feature-Gate Smoke` failed on its gated-test allowlist: two entries no\nlonger gate a test, because this branch emptied\n`memory/people/mod_contacts_gate_tests_tests.rs`. Both of its tests called\n`tinycortex::memory::people::address_book`, and that crate is out of the graph.\n\nThe test guarded something real — the `contacts` feature not forwarding, so the\nmacOS `CNContactStore` reader was compiled out while `refresh_address_book`\nreported success having seeded nothing. That is the `voice` (#4901) /\n`tokenjuice-treesitter` (#4918) soft-failure shape, and it is worth guarding.\n\nIt is guarded, and not here. `Cargo.toml` has said so since before this branch:\n`contacts = []`, because "nothing host-side is gated on `contacts` any more —\nits whole job was forwarding into the engine ... that reader now lives in the\n`tinymemory` module, whose own manifest enables `tinycortex/contacts`, and\n`people.refresh_address_book` reaches it through\n`MemoryPeople::seed_from_address_book` over the bus". The gate name survives\nonly because the Feature Forwarding Gate asserts the product list and the\nshell's list are equal.\n\nSo the test was already asserting a property this crate had stopped having. It\nstill compiled because `tinycortex` lingered as a dev-dependency, which let it\nlink the engine and call the reader directly — and a direct call proves nothing\nabout what this crate forwards once this crate does not depend on what it is\nforwarding to. It could not have been kept, and keeping it would have been\nworse than deleting it: a green assertion about a forward that no longer exists.\n\nWhat was left behind was debris, and that is what this removes: a one-line\nempty file, its `#[path]` module declaration, a `mod.rs` paragraph explaining\nhow the test works, and a `Cargo.toml` comment naming it as the thing that\n"fails if this is ever flattened back". Each now says where the guard actually\nlives.\n\nThe kernel-floor half of that lane passed. It reports a regression on macOS\n(288/270 against a 287/269 limit) and that is the documented platform skew, not\nthis branch: the ratchet is calibrated on Linux, `scripts/kernel-floor.limits`\nis byte-identical to upstream here, and none of `dhat`,\n`tinymemory-conformance` or the engine crates appears in the `flows` profile.\n
Shanu committed 2 months ago
c284bdf
test(memory): restore host coverage for the entity read-RPCs\n\n`top_entities_rpc`, `chunks_for_entity_rpc` and `delete_chunk_rpc` were covered\nonly by `tests/raw_coverage/memory_threads_*`, 4,800-line targets that drove\nforty subjects at once through an in-process engine. Those went with the engine\nand took this coverage with them, leaving three handlers with no test naming\nthem anywhere.\n\nThat was wrong, and the reason it was wrong is not that the tests were good —\nthey were bulk coverage-farming — but that what they happened to cover here is\n**host policy**, not engine behaviour, so nothing upstream replaces it.\n\nThe one that matters is `top_entities_rpc`'s deliberate degradation of\n`MemoryError::Invalid` to an empty list. The SQL it replaced compared a `kind`\nstring against a stored column, so an unknown kind matched no rows; the\ncontract member validates instead and answers `Invalid`. The handler maps that\nback so the migration does not turn a quiet empty result into a user-visible\nerror, and its own comment calls this "the one behaviour delta this migration\nwas warned about". It carries two narrowing conditions — only `Invalid`, and\nonly when a `kind` was supplied — and nothing asserted either.\n\nBoth branches are now pinned, and the assertion is mutation-tested: changing\nthe guard to `if false` fails\n`an_unknown_kind_degrades_to_an_empty_list_rather_than_an_error` and restoring\nit passes. A test for a fallback that cannot fail is the defect this whole\nbranch keeps finding, so it seemed worth proving rather than assuming.\n\n`EntityAwareDriver` is local rather than `tinymemory-conformance`'s driver\nbecause that one advertises `as_entities()` while leaving `top_entities` at its\ntrait default, which answers `Unsupported` — the same advertises-but-does-not-\nserve shape tinymemory#151 fixed for four other families. Worth filing\nupstream; not something to block host coverage on, and the instrument here has\nto produce the answer being mapped.\n
Shanu committed 2 months ago
4766295