Skip to content

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

Name the missing module when an import refuses the null driver\n\n`Rust Feature-Gate Smoke (gates off)` has been red on main since #5779.\nBoth `migration_helpers::ops` apply cases fail with:\n\n refusing to import OpenClaw memory into the null driver — memory is\n disabled by configuration ([subsystems.memory] driver = "null")\n\nThe config says no such thing. `admit` is pure config and never sees the\nfeature flag, so it admits the configured `tinycortex`; `module_provider`\nthen substitutes the null provider under `#[cfg(not(feature = "modules"))]`\nbecause there is no module to bind. The binding that comes back reports\n`class = Null` with `driver_id = "tinymemory"` and no `fallback` — nothing\nrefused, so there is nothing to fall back from.\n\n`target_memory_backend` keyed its reason on the class alone, so that third\ncase landed in the configured-null arm and sent a user to edit a line that\nsaid the opposite of what they were told. It now matches on the driver id\ntoo and names the build.\n\nThe refusal itself is correct and stays: with no module compiled in, every\nwrite is discarded, and an import reporting "migrated N" having written\nnone is the silent data loss #5779 added it to prevent. The message also\nstops saying "OpenClaw" on the Hermes path, which is the same function.\n\nSo the two apply cases cannot pass with the gates off — there is no store\nto import into — and are gated on `feature = "modules"` (a default\nfeature, so the product and contributor lanes keep running them).\n`apply_refuses_and_names_the_build_when_no_memory_module_is_compiled_in`\ncovers the gates-off half: still refused, and refused for the stated\nreason.\n\nVerified: gates-off CI scope 952 passed; `--no-default-features` and\n`--features tui` check clean; product-set lib 22 passed with both apply\ncases live. Reverting the core.rs change fails the new test on its own\nassertion.\n

M3gA-Mind4a448e286926
diff --git a/src/openhuman/config/migration_helpers/core.rs b/src/openhuman/config/migration_helpers/core.rs
index 8a7c6e076e..6344056714 100644
--- a/src/openhuman/config/migration_helpers/core.rs
+++ b/src/openhuman/config/migration_helpers/core.rs
@@ -144,31 +144,45 @@ pub async fn migrate_openclaw_memory(
///
/// # A null driver is refused, not imported into
///
-/// `binding` answers the null driver in two situations: `[subsystems.memory]
-/// driver = "null"` is configured, and a configured driver failed to bind and
-/// fell back. In both, every write below is discarded. An import that reports
+/// `binding` answers the null driver in three situations: `[subsystems.memory]
+/// driver = "null"` is configured; a configured driver failed to bind and fell
+/// back; and — the one this note used to miss — a driver was *admitted* as a
+/// module but this build has no module to bind, so `binding::module_provider`
+/// substituted the null provider under `#[cfg(not(feature = "modules"))]`.
+/// In all three, every write below is discarded. An import that reports
/// "migrated N entries" having written none is silent data loss of the worst
/// kind — the source workspace may be deleted on the strength of that report,
/// and the user only discovers it later, with nothing left to re-run against.
-/// So this refuses up front and names which of the two it was.
+/// So this refuses up front and names which of the three it was.
+///
+/// The third case is the reason this reads `driver_id()` rather than only
+/// `class()`. `admit` is pure config and never saw the feature flag, so it
+/// returns the configured id — the binding then reports `driver_id =
+/// "tinymemory"` with `class = Null` and **no** `fallback`, since nothing
+/// refused. Keying the message on the class alone put that case in the
+/// configured-null arm, which told a user whose config says `driver =
+/// "tinycortex"` that they had set it to `"null"` and sent them to edit a line
+/// that already said the opposite.
fn target_memory_backend(config: &Config) -> Result<Arc<dyn Memory>> {
let binding = crate::openhuman::memory::binding::for_config(config)
.map_err(|e| anyhow::anyhow!("bind memory for migration import: {e}"))?;
if binding.class() == crate::core::subsystem::DriverClass::Null {
- let because = binding.fallback().map_or_else(
- || {
+ let because = match (binding.fallback(), binding.driver_id()) {
+ (Some(fallback), _) => format!(
+ "driver '{}' refused to bind: {}",
+ fallback.configured_driver, fallback.reason
+ ),
+ (None, tinymemory_api::null::NULL_DRIVER_ID) => {
"memory is disabled by configuration ([subsystems.memory] driver = \"null\")"
.to_string()
- },
- |fallback| {
- format!(
- "driver '{}' refused to bind: {}",
- fallback.configured_driver, fallback.reason
- )
- },
- );
+ }
+ (None, driver_id) => format!(
+ "driver '{driver_id}' is configured, but this build has no memory module \
+ compiled in (the 'modules' feature is off), so nothing can be written"
+ ),
+ };
anyhow::bail!(
- "refusing to import OpenClaw memory into the null driver — {because}. \
+ "refusing to import memory into the null driver — {because}. \
Nothing was imported; the source workspace is untouched."
);
}
diff --git a/src/openhuman/config/migration_helpers/ops.rs b/src/openhuman/config/migration_helpers/ops.rs
index 6929a826f4..d7e09c29ac 100644
--- a/src/openhuman/config/migration_helpers/ops.rs
+++ b/src/openhuman/config/migration_helpers/ops.rs
@@ -70,6 +70,17 @@ mod tests {
}
}
+ // Apply writes into the bound memory driver, which only exists when a
+ // memory module is compiled in. With `--no-default-features`,
+ // `binding::module_provider` substitutes the null provider, and
+ // `target_memory_backend` then refuses the import rather than reporting
+ // entries it discarded — correct behaviour, and the opposite of what this
+ // case asserts. Gated rather than made tolerant of both answers: a test
+ // that passes on either outcome would stop witnessing the import at all.
+ // The gates-off half of the same seam is
+ // `apply_refuses_and_names_the_build_when_no_memory_module_is_compiled_in`
+ // below.
+ #[cfg(feature = "modules")]
#[tokio::test]
async fn migrate_openclaw_apply_imports_markdown_entries_into_target_workspace() {
// Regression for #1440: prior to this PR the Apply path
@@ -109,6 +120,49 @@ mod tests {
);
}
+ /// With no memory module compiled in, apply must refuse — and the refusal
+ /// must name the build, not the user's config.
+ ///
+ /// `admit` is pure config and never sees the feature flag, so it admits the
+ /// configured `tinycortex`; `module_provider` then substitutes the null
+ /// provider because there is no module to bind. The binding that comes back
+ /// therefore reports `class = Null` with `driver_id = "tinymemory"` and no
+ /// `fallback` — nothing refused, so there is nothing to fall back from.
+ ///
+ /// Keyed on the class alone, that landed in the configured-null arm and told
+ /// a user whose `config.toml` says `driver = "tinycortex"` that memory was
+ /// "disabled by configuration ([subsystems.memory] driver = \"null\")",
+ /// pointing them at a line that says the opposite. This asserts both halves:
+ /// the import is still refused (silent data loss stays impossible), and the
+ /// reason given is the missing module.
+ #[cfg(not(feature = "modules"))]
+ #[tokio::test]
+ async fn apply_refuses_and_names_the_build_when_no_memory_module_is_compiled_in() {
+ let tmp = TempDir::new().unwrap();
+ let config = test_config(&tmp);
+
+ let source = tmp.path().join("openclaw-src");
+ std::fs::create_dir_all(&source).unwrap();
+ std::fs::write(source.join("MEMORY.md"), "# Note\nwould be lost").unwrap();
+
+ let err = migrate_openclaw(&config, Some(source), false)
+ .await
+ .expect_err("apply must refuse with no memory module compiled in");
+
+ assert!(
+ err.contains("this build has no memory module compiled in"),
+ "refusal must name the missing module as the cause; got: {err}"
+ );
+ assert!(
+ !err.contains("[subsystems.memory] driver = \"null\""),
+ "refusal must not blame a config line the user did not write; got: {err}"
+ );
+ assert!(
+ err.contains("the source workspace is untouched"),
+ "refusal must still promise the source survived; got: {err}"
+ );
+ }
+
#[tokio::test]
async fn migrate_openclaw_returns_error_for_missing_source_workspace() {
// Pointing at a non-existent source directory must surface as
@@ -149,6 +203,17 @@ mod tests {
}
}
+ // Apply writes into the bound memory driver, which only exists when a
+ // memory module is compiled in. With `--no-default-features`,
+ // `binding::module_provider` substitutes the null provider, and
+ // `target_memory_backend` then refuses the import rather than reporting
+ // entries it discarded — correct behaviour, and the opposite of what this
+ // case asserts. Gated rather than made tolerant of both answers: a test
+ // that passes on either outcome would stop witnessing the import at all.
+ // The gates-off half of the same seam is
+ // `apply_refuses_and_names_the_build_when_no_memory_module_is_compiled_in`
+ // below.
+ #[cfg(feature = "modules")]
#[tokio::test]
async fn migrate_hermes_apply_imports_markdown_entries() {
// Apply does real memory work; install the embedding host seam so this