Skip to content

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

test(e2e): tighten the legacy-state and null-driver assertions\n\nReview follow-ups on the tests this branch adds.\n\nThe write-refusal assertion now also checks the refusal does not echo the\nprotected file back. The read path already rejected the seeded token in its\noutput; the write path checked only the error flag and the on-disk bytes, so a\nrefusal that quoted the existing file would have satisfied both and still\nleaked it.\n\nThe null-classed-driver assertion now requires the quoted `"null"` class rather\nthan a bare `null` substring — the driver id in the fixture is `mynull`, which\ncontains `null`, so the looser check would have been satisfied by the id alone\nand proved nothing about the class the refusal names.\n\nThe product fix this commit originally carried — dropping `diff.external=` from\nNEUTRALISED_CONFIG — is gone: `3a8aa89b1` fixed the same bug on main and did it\nbetter, suppressing the external diff with `git diff --no-ext-diff` rather than\nrelying on the allowlist alone, and `730befd69` extended that to `--no-textconv`.\nMain's version is a strict superset, so the rebase keeps main's and drops mine.\n

M3gA-Mind7dc725eb0150
diff --git a/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs b/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs
index e2ca99b416..cf80f067d7 100644
--- a/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/tools_agent_credentials_state_raw_coverage_e2e.rs
@@ -1052,6 +1052,15 @@ async fn file_tools_cannot_reach_retained_legacy_state_in_the_workspace() {
"{legacy}: agent write into retained legacy state succeeded: {}",
attempted_write.output()
);
+ // The refusal must not itself disclose what it is protecting. A write
+ // path that echoes the existing file back in its error would satisfy
+ // the flag and the byte-comparison below while still leaking the
+ // secret (CodeRabbit, #5974).
+ assert!(
+ !attempted_write.output().contains("do-not-read"),
+ "{legacy}: the write refusal leaked the file it refused to touch: {}",
+ attempted_write.output()
+ );
// The refusal has to be a refusal, not a message printed after the fact.
assert_eq!(
std::fs::read_to_string(&secret).expect("legacy file still present"),
@@ -1111,9 +1120,12 @@ async fn openclaw_import_names_a_null_classed_driver_rather_than_the_build() {
.await
.expect_err("importing into a null-classed driver must refuse");
+ // `contains("null")` alone would be satisfied by the driver id `mynull`,
+ // so this asserts the *quoted* class value the message renders — which a
+ // generic class-validation error could not produce (CodeRabbit, #5974).
assert!(
- err.contains("mynull") && err.contains("class"),
- "the refusal must name the configured driver and its class; got: {err}"
+ err.contains("mynull") && err.contains("class") && err.contains("\"null\""),
+ "the refusal must name the configured driver and its `class = \"null\"`; got: {err}"
);
assert!(
!err.contains("no memory module compiled in"),