Skip to content

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

fix(agent): correct memory attribution test assertions

Steven Enamakel159af705309f
diff --git a/crates/openhuman-core/src/agent/agent_memory_attribution_tests.rs b/crates/openhuman-core/src/agent/agent_memory_attribution_tests.rs
index 90d72e353c..c00150a091 100644
--- a/crates/openhuman-core/src/agent/agent_memory_attribution_tests.rs
+++ b/crates/openhuman-core/src/agent/agent_memory_attribution_tests.rs
@@ -121,7 +121,7 @@ async fn an_automation_turn_does_not_store_its_prompt_as_the_users_memory() {
let origin = AgentTurnOrigin::TrustedAutomation {
job_id: "memory_goals:enrich:1".into(),
- source: TrustedAutomationSource::Subconscious,
+ source: TrustedAutomationSource::Background,
};
let _ = with_origin(origin, agent.turn("Maintain the existing goals list."))
.await
diff --git a/crates/openhuman-core/src/security/approval/gate_core_flow_tests.rs b/crates/openhuman-core/src/security/approval/gate_core_flow_tests.rs
index 48ca717f2a..c2452e72c6 100644
--- a/crates/openhuman-core/src/security/approval/gate_core_flow_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_core_flow_tests.rs
@@ -297,41 +297,6 @@ async fn auto_approve_all_off_still_parks() {
assert!(matches!(outcome, GateOutcome::Allow));
}
-/// `auto_approve_all: true` must NOT override a `SubconsciousTainted`
-/// origin — the gate still hard-denies it (indirect prompt injection
-/// defense).
-#[tokio::test]
-async fn auto_approve_all_does_not_override_subconscioustainted() {
- let _env = crate::config::TEST_ENV_LOCK
- .lock()
- .unwrap_or_else(|e| e.into_inner());
- let (gate, dir) = test_gate();
- let policy = crate::security::SecurityPolicy {
- auto_approve_all: true,
- ..crate::security::SecurityPolicy::default()
- };
- let _policy_guard = crate::security::live_policy::install_scoped(
- Arc::new(policy),
- dir.path().to_path_buf(),
- dir.path().to_path_buf(),
- );
-
- let origin = AgentTurnOrigin::TrustedAutomation {
- job_id: "job-tainted".into(),
- source: TrustedAutomationSource::SubconsciousTainted,
- };
- let outcome = turn_origin::with_origin(
- origin,
- gate.intercept("openhuman_test_aaa_tainted", "noop", serde_json::json!({})),
- )
- .await;
-
- match outcome {
- GateOutcome::Deny { reason } => assert!(reason.contains("external-sync")),
- other => panic!("expected deny, got {other:?}"),
- }
-}
-
/// `auto_approve_all: true` must NOT override an `Unknown` origin — the
/// gate still fails closed for unlabelled call sites.
#[tokio::test]
@@ -370,42 +335,6 @@ async fn auto_approve_all_does_not_override_unknown() {
}
}
-/// `auto_approve_all: true` overrides the `GoalContinuation` bypass —
-/// normally that origin skips the per-tool allowlist and always parks,
-/// but the blanket bypass sits above that check and allows immediately.
-#[tokio::test]
-async fn auto_approve_all_overrides_bypass_shortcut() {
- let _env = crate::config::TEST_ENV_LOCK
- .lock()
- .unwrap_or_else(|e| e.into_inner());
- let (gate, dir) = test_gate();
- let policy = crate::security::SecurityPolicy {
- auto_approve_all: true,
- ..crate::security::SecurityPolicy::default()
- };
- let _policy_guard = crate::security::live_policy::install_scoped(
- Arc::new(policy),
- dir.path().to_path_buf(),
- dir.path().to_path_buf(),
- );
-
- let origin = AgentTurnOrigin::TrustedAutomation {
- job_id: "goal-1".into(),
- source: TrustedAutomationSource::GoalContinuation,
- };
- let outcome = turn_origin::with_origin(
- origin,
- gate.intercept("openhuman_test_aaa_goal", "noop", serde_json::json!({})),
- )
- .await;
-
- assert!(matches!(outcome, GateOutcome::Allow));
- assert!(
- gate.list_pending().unwrap().is_empty(),
- "auto_approve_all must short-circuit before any pending row is persisted"
- );
-}
-
/// `auto_approve_all: true` overrides a `Workflow { require_approval: true }`
/// origin — normally the user's per-flow "gate every action" choice forces
/// a park, but the blanket bypass sits above that check too.
diff --git a/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs b/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs
index c996c170f4..2864de87d1 100644
--- a/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs
@@ -1,13 +1,13 @@
use super::*;
#[tokio::test]
-async fn intercept_with_trusted_subconscious_origin_allows_without_prompt() {
- // Subconscious ticks on internal-only memory are trusted automation
- // and run unprompted (preserves pre-PR behavior for the safe case).
+async fn intercept_with_trusted_background_origin_allows_without_prompt() {
+ // Internal background jobs over local data are trusted automation and
+ // run unprompted.
let (gate, _dir) = test_gate();
let origin = AgentTurnOrigin::TrustedAutomation {
- job_id: "subconscious-tick".into(),
- source: TrustedAutomationSource::Subconscious,
+ job_id: "memory_goals:enrich:1".into(),
+ source: TrustedAutomationSource::Background,
};
let outcome = turn_origin::with_origin(
origin,
@@ -17,29 +17,6 @@ async fn intercept_with_trusted_subconscious_origin_allows_without_prompt() {
assert!(matches!(outcome, GateOutcome::Allow));
}
-#[tokio::test]
-async fn intercept_with_subconscious_tainted_origin_denies() {
- // A subconscious tick whose memory context contains external-sync
- // chunks is rejected for external_effect tools — external text in
- // memory could otherwise steer the tick into a tool call.
- let (gate, _dir) = test_gate();
- let origin = AgentTurnOrigin::TrustedAutomation {
- job_id: "subconscious-tainted".into(),
- source: TrustedAutomationSource::SubconsciousTainted,
- };
- let outcome = turn_origin::with_origin(
- origin,
- gate.intercept("send_email", "send", serde_json::json!({})),
- )
- .await;
- match outcome {
- GateOutcome::Deny { reason } => {
- assert!(reason.contains("external-sync"), "reason was: {reason}")
- }
- other => panic!("expected deny, got {other:?}"),
- }
-}
-
#[tokio::test]
async fn intercept_with_cli_origin_allows_without_prompt() {
// CLI / one-off internal callers (sub-agent invocations, scripts)