Skip to content

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

fix(recall): publish MemoryRecalled domain event per tool call

Steven Enamakeleb8ce1a48118
diff --git a/app/src/features/conversations/aui/ChatScheduleCard.test.tsx b/app/src/features/conversations/aui/ChatScheduleCard.test.tsx
index cfb8f43952..9b02cbf9f0 100644
--- a/app/src/features/conversations/aui/ChatScheduleCard.test.tsx
+++ b/app/src/features/conversations/aui/ChatScheduleCard.test.tsx
@@ -71,7 +71,9 @@ describe('cron tool call renders', () => {
});
it('toggling the switch calls the cron update RPC and flips only after it resolves', async () => {
- const spy = vi.spyOn(cron, 'openhumanCronUpdate').mockResolvedValue({ result: job({ enabled: false }) });
+ const spy = vi
+ .spyOn(cron, 'openhumanCronUpdate')
+ .mockResolvedValue({ result: job({ enabled: false }), logs: [] });
render(<CronAddOrUpdateCall {...toolCallProps('cron_add', {}, job())} />);
const toggle = screen.getByRole('switch');
diff --git a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
index 8ac1fffd88..0f8eeaf200 100644
--- a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
+++ b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
@@ -1,5 +1,4 @@
import { render, screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
import { describe, expect, it } from 'vitest';
import type { SubagentActivity } from '../../../store/chatRuntimeSlice';
diff --git a/crates/openhuman-core/src/memory/tools/recall.rs b/crates/openhuman-core/src/memory/tools/recall.rs
index 9cf1390704..2efd1c6e60 100644
--- a/crates/openhuman-core/src/memory/tools/recall.rs
+++ b/crates/openhuman-core/src/memory/tools/recall.rs
@@ -123,6 +123,20 @@ impl Tool for MemoryRecallTool {
}
}
+/// Publishes `DomainEvent::MemoryRecalled` once per tool call — a discrete,
+/// per-turn action, not the hot-path per-driver-read the guard's own success
+/// path deliberately does not publish (see `memory::guard::audit` docs). The
+/// domain event itself still carries the raw `query` (existing shape,
+/// consumed only in-process); the web-channel bridge
+/// (`web_chat::event_bus::MemoryActivitySubscriber`) is what clips it to a
+/// short preview before it ever reaches a socket.
+fn publish_memory_recalled(query: &str, hit_count: usize) {
+ crate::core::bus::BUS.publish(crate::core::events::DomainEvent::MemoryRecalled {
+ query: query.to_string(),
+ hit_count,
+ });
+}
+
/// The namespace a call searches: the one it names, or the default scope when
/// it names none. An explicit empty string is a caller mistake, not a request
/// for the default — the model had a namespace in mind and lost it.