Skip to content

fix(memory): stop copying the conversation into memory; let recall answer with memories - #5315

Open
yh928 wants to merge 3 commits into
tinyhumansai:mainfrom
yh928:fix/conversation-copies-out-of-recall
Open

fix(memory): stop copying the conversation into memory; let recall answer with memories#5315
yh928 wants to merge 3 commits into
tinyhumansai:mainfrom
yh928:fix/conversation-copies-out-of-recall

Conversation

@yh928

@yh928 yh928 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The chat turn, the channel runtime, and the post-turn hook each copied conversation text verbatim into memory_docs. All three writes are removed.
  • transcript_search now owns reading the conversation; memory_recall / memory_hybrid_search answer with memories. The transcript itself is unchanged — every message is still persisted.
  • Recall filters out the copies existing installs already carry, so the fix reaches current users and not only fresh ones.
  • Memories extracted from conversations (learning::transcript_ingest) are untouched and stay fully recallable.

Problem

Three writers put raw chat text into the semantic memory store:

Writer Key Category
session::turn::core user_msg:{uuid} conversation
channels::runtime::dispatch::processor {channel}_{sender}_{id} conversation
session::turn::core (post-turn) assistant_resp (fixed) daily

Each is a duplicate of something the thread transcript already holds, and each lands in the same vector space the agent searches for facts — so raw chat lines competed with real memories for every recall slot (#5312). The user's message additionally cost an embedding round-trip (Voyage) per turn to produce a row no reader wanted.

The assistant copy was the weakest of the three: a 100-character truncation under a fixed key. upsert_document keys by (namespace, key), so every turn in the workspace overwrote the one before it — a single perpetually-stale row, mislabelled Daily, that could not serve as history for anything.

The two tools had also drifted into doing the same job. transcript_search already searches every thread's messages with recency ranking and active-thread exclusion, which is exactly what the copies were trying to provide, less well.

Solution

Stop writing. The three writes are removed. Nothing about transcript retention changes: memory_conversations persists both web chat and every ChannelMessageReceived into the thread transcript, and that is what transcript_search reads.

Hide what is already stored. drop_verbatim_conversation_copies filters the legacy rows out of recall. Two design points:

  • Where. The filter sits in query_namespace_hits_excluding_session, the single layer both Memory::recall and memory_hybrid_search pass through. The hybrid tool does not go through recall — it calls the store directly — so a filter placed in recall alone would have missed the tool context_scout and flow_memory_agent are actually pointed at. recall_namespace_memories (query-less recall) gets it too.
  • Not by category. Filtering on MemoryCategory::Conversation alone would have been wrong: learning::transcript_ingest writes distilled preferences, decisions, commitments, facts, and reflections under that same category, into the dedicated conversation_memory / conversation_reflections namespaces. Those are memories, and recall should return them. The filter is therefore scoped to the global namespace, where the category has only ever meant a raw copy.

The legacy assistant_resp row is matched by key, since its category is daily and no category test would catch it.

channels::context::conversation_memory_key is dropped — its only caller was the deleted channel write.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) — see Testing below
  • Diff coverage ≥ 80% — every changed line in query.rs is exercised by the new query_tests.rs cases; the deleted write paths are covered by the inverted assertions in agent/tests.rs and channels/tests/memory.rs
  • N/A: behaviour-only change, no feature row added/removed/renamed — Coverage matrix updated
  • No new external network dependencies introduced
  • N/A: no release-cut surface touched — Manual smoke checklist updated
  • Linked issue closed via Closes #NNN in the ## Related section

Testing

New (memory_store/namespace_store/query_tests.rs) — one per legacy shape, plus the two that guard against over-filtering:

  • recall_drops_a_legacy_user_message_copy
  • recall_drops_a_legacy_channel_message_copy — the channel key has no prefix to match on, which is why the filter keys off category
  • recall_drops_the_legacy_assistant_reply_snapshot — fixed key, daily category
  • recall_keeps_extracted_conversation_memories — the failure case that matters: proves the filter does not take the transcript_ingest output with it
  • a_non_conversation_global_memory_is_untouched

Rewritten to assert the new behaviour:

  • agent::tests::a_turn_does_not_copy_the_conversation_into_memory — was auto_save_stores_messages_in_memory
  • channels::tests::memory::process_channel_message_does_not_replay_a_prior_message_from_memory — was ..._uses_autosaved_memory_after_history_is_cleared

Retargeted: the same-session exclusion tests (memory_trait.rs, query_tests.rs) move their fixtures to conversation_memory. That guard was written for the chat autosave, which is gone; session-tagged documents now come from transcript_ingest, so the tests exercise it where it still applies.

cargo test --lib: 12553 passed. The 3 remaining failures (credentials::ops, tinyplace::manifest ×2) reproduce identically on the base commit with no changes applied.

Impact

  • Behaviour change, deliberate. A raw message no longer comes back from memory_recall / memory_hybrid_search. To recall what was said, call transcript_search. Agents that had both tools already had the better route.
  • Cost. One fewer embedding round-trip per user message, and per inbound channel message.
  • Migration. None required. Legacy rows stay on disk and stop surfacing in recall; they remain visible to memory_forget and the memory UI, so a user who wants them gone can still remove them.
  • memory.auto_save no longer gates any write in the turn path. The flag is left in place rather than removed in this PR — retiring it touches the config schema and the settings UI, and is better done on its own.
  • Platform-neutral; no security or performance risk beyond the saved work.

Related

Closes #5312

Summary by CodeRabbit

  • Bug Fixes

    • Prevented raw user, channel, and assistant messages from being duplicated in recalled memory.
    • Excluded legacy verbatim conversation copies while retaining extracted memories and reflections.
    • Ensured cleared conversation history is not replayed through memory recall.
  • Improvements

    • Conversation transcripts remain available for reviewing prior exchanges.
    • Non-conversation memories continue to be stored and recalled normally.
    • Improved separation between conversation history and long-term memory.

@yh928
yh928 requested a review from a team August 2, 2026 08:05
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 61f7ff0b-1352-409a-8ca2-a3c153322560

📥 Commits

Reviewing files that changed from the base of the PR and between af1104b and 7c6d6ac.

📒 Files selected for processing (3)
  • src/openhuman/channels/tests/memory.rs
  • src/openhuman/memory/store/namespace_store/query.rs
  • src/openhuman/memory/store/namespace_store/query_tests.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/openhuman/memory/store/namespace_store/query.rs
  • src/openhuman/memory/store/namespace_store/query_tests.rs

📝 Walkthrough

Walkthrough

The change stops session and channel turns from copying raw conversation text into memory. Namespace recall filters legacy verbatim conversation copies while retaining extracted memories and unrelated global memories. Tests cover autosave, session exclusion, and legacy-row filtering.

Changes

Conversation memory deduplication

Layer / File(s) Summary
Remove duplicate conversation writes
src/openhuman/agent/harness/session/turn/core.rs, src/openhuman/agent/tests.rs, src/openhuman/channels/..., src/openhuman/channels/tests/memory.rs
Session turns and inbound channel messages no longer autosave raw text or assistant snapshots. Tests now expect no copied conversation entries.
Filter legacy verbatim recall copies
src/openhuman/memory/store/namespace_store/query.rs
Query-based and query-less recall remove legacy conversation copies and assistant_resp snapshots before ranking. Episodic results remain available through direct transcript search.
Update namespace and recall coverage
src/openhuman/memory/store/memory_trait.rs, src/openhuman/memory/store/namespace_store/query_tests.rs
Tests use the conversation_memory namespace and verify session exclusion, legacy-row filtering, and retention of extracted memories and unrelated global memories.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: memory, agent, bug

Suggested reviewers: yellowsnnowmann, senamakel

Poem

A rabbit cleared copied words from the store,
Raw turns now rest in transcripts secure.
Distilled memories remain in their place,
Old echoes no longer crowd recall space.
“Hop!” says the suite, “the duplicates are gone!”

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR prevents internal-agent writes but also removes user-turn autosave, which conflicts with issue #5312 acceptance criteria for preserving user behavior. Preserve raw conversation autosave for WebChat and external channel turns, and add regression coverage proving user turns save while automation turns do not.
Out of Scope Changes check ⚠️ Warning The PR filters legacy copied rows from recall and removes all conversation-copy writes, exceeding issue #5312's write-path-only scope. Limit the change to preventing internal-agent conversation writes; handle legacy-row recall filtering in a separate issue or document its approved scope.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: stopping conversation copies in memory while preserving recall of useful memories.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added agent Built-in agents, prompts, orchestration, and agent runtime in src/openhuman/agent/. bug memory Memory store, memory tree, recall, summarization, and embeddings in src/openhuman/memory/. labels Aug 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/openhuman/channels/tests/memory.rs`:
- Around line 201-209: Update the test around the first channel-processing call
to assert that runtime_ctx.memory.count().await is zero before clearing
in-process history, directly verifying process_channel_message does not store
the raw inbound message. Keep the existing recall assertion afterward to
preserve coverage that prior messages are not replayed from memory.

In `@src/openhuman/memory_store/namespace_store/query_tests.rs`:
- Around line 1013-1156: Add a regression test alongside the existing recall
tests that uses UnifiedMemory::recall_namespace_memories("") instead of
query_namespace_ranked. Insert legacy conversation rows, including an
assistant_resp entry, plus a global memory with category Core, then assert the
legacy rows are absent while the Core memory remains available.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cf982dbe-9034-4780-8f7f-82fd94591bbd

📥 Commits

Reviewing files that changed from the base of the PR and between 43cc1b4 and 5131125.

📒 Files selected for processing (8)
  • src/openhuman/agent/harness/session/turn/core.rs
  • src/openhuman/agent/tests.rs
  • src/openhuman/channels/context.rs
  • src/openhuman/channels/runtime/dispatch/processor.rs
  • src/openhuman/channels/tests/memory.rs
  • src/openhuman/memory_store/memory_trait.rs
  • src/openhuman/memory_store/namespace_store/query.rs
  • src/openhuman/memory_store/namespace_store/query_tests.rs
💤 Files with no reviewable changes (1)
  • src/openhuman/channels/context.rs

Comment thread src/openhuman/channels/tests/memory.rs
Comment thread src/openhuman/memory/store/namespace_store/query_tests.rs
@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a memory pollution bug (#5312) where three separate code paths wrote raw conversation text verbatim into the semantic memory store, causing chat lines to compete with real memories for every recall slot. The fix removes all three writes and adds a filter layer (drop_verbatim_conversation_copies) to suppress legacy rows already on disk for existing installs.

  • Removed writes: The user-message fire-and-forget spawn in session::turn::core, the channel-message autosave in channels::runtime::dispatch::processor, and the post-turn assistant-reply snapshot in session::turn::core are all deleted. The transcript itself is unchanged — every message is still persisted and reachable via transcript_search.
  • Migration filter: drop_verbatim_conversation_copies is added to query_namespace_hits_excluding_session and recall_namespace_memories, the two paths both Memory::recall and memory_hybrid_search flow through. It is scoped to the global namespace only, so conversation_memory / conversation_reflections docs written by learning::transcript_ingest are unaffected.
  • Test coverage: Five new unit tests cover each legacy document shape, including the critical guard that extracted conversation memories (transcript_ingest output) are not over-filtered. Existing session-exclusion tests are retargeted to the conversation_memory namespace to reflect where session-tagged documents now originate.

Confidence Score: 5/5

Safe to merge. The three deleted writes are cleanly excised with no remaining callers, the filter is correctly placed in the single retrieval layer shared by both recall and hybrid search, and the migration story for existing installs is sound.

The change is a straightforward deletion of three write paths and addition of a read-time filter. The filter is scoped to the global namespace, so extracted conversation memories in dedicated namespaces are guaranteed to survive. Legacy rows stay on disk and remain accessible via the memory UI; they simply stop surfacing in recall. Test coverage is thorough, including the critical guard against over-filtering. No schema changes, no new external dependencies, and the transcript itself is unmodified.

Files Needing Attention: No files require special attention. The docstring on query_namespace_hits_excluding_session in query.rs still references the removed auto-save and is worth a follow-up, but it does not affect runtime behaviour.

Important Files Changed

Filename Overview
src/openhuman/memory/store/namespace_store/query.rs Core of the fix: adds drop_verbatim_conversation_copies and applies it in both the query-with-session-exclusion and query-less recall paths; filter is correctly scoped to the global namespace so extracted conversation memories in dedicated namespaces are untouched.
src/openhuman/agent/harness/session/turn/core.rs Removes the fire-and-forget user-message write and the synchronous assistant-reply snapshot; replaces both with explanatory comments. Clean deletion, no lingering writes.
src/openhuman/channels/runtime/dispatch/processor.rs Removes the channel-message autosave (and notes the previously missing session_id tagging as an additional fix). Import of conversation_memory_key cleaned up.
src/openhuman/memory/store/namespace_store/query_tests.rs Adds five targeted tests covering all three legacy document shapes plus the over-filtering guard; retargets session-exclusion fixtures from global to conversation_memory namespace to match where transcript_ingest actually writes.
src/openhuman/channels/tests/memory.rs Removes now-deleted autosave tests; renames and inverts the key test to assert the message does NOT replay out of memory; changes a test fixture category from Conversation to Core to avoid the new global-namespace filter.
src/openhuman/memory/store/memory_trait.rs Updates session-exclusion tests to use conversation_memory namespace instead of global; updates assertion message to reference transcript_ingest rather than the removed autosave.
src/openhuman/channels/context.rs Deletes conversation_memory_key helper function and its one test; conversation_history_key is preserved and unaffected.
src/openhuman/agent/tests.rs Renames and inverts auto_save_stores_messages_in_memory to assert zero writes happen; uses the same 25-iteration polling pattern to catch any stray fire-and-forget writes that might arrive late.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before["Before (writes raw chat to memory)"]
        A1[User message] -->|fire-and-forget spawn| W1["memory.store() → user_msg:{uuid}\ncategory=Conversation, global ns"]
        A2[Agent turn ends] -->|sync write| W2["memory.store() → assistant_resp\ncategory=Daily, global ns\n(fixed key: overwrites every turn)"]
        A3[Channel message] -->|sync write| W3["memory.store() → {ch}_{sender}_{id}\ncategory=Conversation, global ns\n(session_id=None: no self-echo guard)"]
        W1 & W2 & W3 -->|pollute| VEC["Vector search space\n(fact recall)"]
    end

    subgraph After["After (writes removed; filter cleans up legacy rows)"]
        B1[User message] --> T1["Transcript\n(memory_conversations)"]
        B2[Channel message] --> T1
        B3[Agent turn] --> T1
        T1 -->|reads| TS["transcript_search"]
        MEM["memory_docs\n(facts only)"] -->|query path| F["drop_verbatim_conversation_copies\n(global ns only)\n• drops category=conversation\n• drops key=assistant_resp"]
        F --> RC["recall / memory_hybrid_search\n(returns memories, not chat lines)"]
        INGEST["learning::transcript_ingest\n(extracts facts → conversation_memory /\nconversation_reflections)"] --> MEM
    end
Loading

Reviews (3): Last reviewed commit: "fix(memory): stop copying the conversati..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 513112549c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/openhuman/memory/store/namespace_store/query.rs
@yh928
yh928 force-pushed the fix/conversation-copies-out-of-recall branch from 5131125 to 0d595ec Compare August 2, 2026 13:03
…swer with memories

Three writers copied chat text verbatim into `memory_docs`:

- the chat turn stored the user's message as a `conversation` document,
- the channel runtime stored each inbound message the same way,
- and every turn overwrote a single `assistant_resp` row holding a
  100-character truncation of the reply, mislabelled `Daily`.

All three duplicated text the transcript already holds, and all three landed
in the vector space the agent searches for *facts*, so raw chat lines competed
with real memories for every recall slot (tinyhumansai#5312). The user's message cost an
embedding round-trip per turn to produce a row no reader wanted.

The roles are now split cleanly. `transcript_search` reads the conversation —
it searches the thread transcripts, which still receive every message
(`memory_conversations` persists both web chat and `ChannelMessageReceived`).
`memory_recall` / `memory_hybrid_search` answer with memories. What is worth
keeping from a conversation is extracted rather than copied:
`learning::transcript_ingest` distils preferences, decisions, commitments,
facts, and reflections into the `conversation_memory` /
`conversation_reflections` namespaces, and those stay fully recallable.

Existing installs already carry the old rows, so recall filters them out
(`drop_verbatim_conversation_copies`). The filter sits in
`query_namespace_hits_excluding_session`, which is the one layer BOTH
`Memory::recall` and `memory_hybrid_search` pass through — the hybrid tool does
not go through `recall`, so a filter there would have missed the tool the
context scout and flow memory agent actually call. `recall_namespace_memories`
(query-less recall) gets it too.

The filter is scoped to the **global** namespace deliberately. The extracted
memories above carry the same `conversation` category, so filtering on category
alone would have deleted the useful half of the feature. In the global
namespace that category has only ever meant a raw copy.

Tests:
- the chat turn now asserts it writes NOTHING, and the channel test asserts a
  prior message is not replayed out of memory,
- new query tests cover each legacy shape (user autosave key, channel key with
  no prefix, the fixed `assistant_resp` key) and pin that extracted memories in
  their own namespaces survive, and that a non-conversation global memory is
  untouched,
- the same-session exclusion tests move to `conversation_memory`, where
  session-tagged documents actually live now that the autosave is gone.

Also drops `channels::context::conversation_memory_key`, whose only caller was
the deleted channel write. One of its two tests carried no `#[test]`
attribute and had never run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SRSNnqQsokuGmkbpLoLCGy
@yh928
yh928 force-pushed the fix/conversation-copies-out-of-recall branch from 0d595ec to 56a6312 Compare August 5, 2026 01:55
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/openhuman/memory/store/namespace_store/query.rs`:
- Around line 151-171: Update drop_verbatim_conversation_copies to follow the
domain logging contract: use the stable [domain] prefix and add debug logs for
function entry, the non-global namespace early-return branch, and function exit.
Include stable count fields such as the input and remaining document counts,
while preserving the existing filtering behavior and dropped-count logging.
- Line 215: Update query_namespace_hits_excluding_session and the
memory_hybrid_search path so episodic transcript hits are excluded from global
hybrid-search results, while remaining available to transcript-specific
searches. Make episodic inclusion explicit at the relevant query boundary,
preserve query_namespace_ranked’s existing non-document filtering, and add a
regression covering a matching global episodic row to verify
memory_hybrid_search never renders it.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4db66f00-c577-4034-859f-67f98d3be49f

📥 Commits

Reviewing files that changed from the base of the PR and between d75b0a4 and 56a6312.

📒 Files selected for processing (8)
  • src/openhuman/agent/harness/session/turn/core.rs
  • src/openhuman/agent/tests.rs
  • src/openhuman/channels/context.rs
  • src/openhuman/channels/runtime/dispatch/processor.rs
  • src/openhuman/channels/tests/memory.rs
  • src/openhuman/memory/store/memory_trait.rs
  • src/openhuman/memory/store/namespace_store/query.rs
  • src/openhuman/memory/store/namespace_store/query_tests.rs
💤 Files with no reviewable changes (1)
  • src/openhuman/channels/context.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/openhuman/agent/tests.rs
  • src/openhuman/channels/runtime/dispatch/processor.rs
  • src/openhuman/channels/tests/memory.rs

Comment thread src/openhuman/memory/store/namespace_store/query.rs
Comment thread src/openhuman/memory/store/namespace_store/query.rs
…call

Review found the same leak twice, from two directions, and both were right.
Dropping the verbatim `[conversation]` documents closed one door; the episodic
FTS5 merge a hundred lines further down was the other. `memory_hybrid_search`
renders every hit it is handed, so a global query still came back with raw chat
turns — truncated to 500 characters, scored, and competing with extracted
memories for the same slots. That is exactly what tinyhumansai#5312 is about.

The merge is removed rather than filtered at each renderer: `transcript_search`
reads the thread transcript directly, which is complete and current where the
episodic mirror is neither, and nothing else consumes `fts5::episodic_search`.
Filtering per caller would have left the next caller to rediscover this.

The episodic-present reweighting goes with it, since the branch that applied it
can no longer be taken.

Tests: the three that pinned the merge are replaced by one that asserts the
opposite — an episodic row `episodic_search` finds directly must not appear in
`query_namespace_hits("global", ..)`. The fixture is checked for a direct match
first, so the assertion cannot pass vacuously. namespace_store 162 pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SRSNnqQsokuGmkbpLoLCGy

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yh928 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/openhuman/memory/store/namespace_store/query.rs (1)

117-164: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Split query.rs to meet the Rust file-size limit.

The final file extends to Line 1381. Line 117 adds retrieval behavior to a file that exceeds the 500-line limit. Split the retrieval logic into focused modules and keep src/openhuman/memory/store/namespace_store/query.rs at or below 500 lines.

As per coding guidelines, “Keep file size to ≤ 500 lines of code.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openhuman/memory/store/namespace_store/query.rs` around lines 117 - 164,
Split the retrieval logic containing drop_verbatim_conversation_copies and its
related query helpers out of namespace_store/query.rs into focused Rust
module(s), preserving behavior and visibility at existing call sites. Update
module declarations and imports as needed, and ensure query.rs is no longer than
500 lines.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/openhuman/memory/store/namespace_store/query.rs`:
- Around line 117-164: Split the retrieval logic containing
drop_verbatim_conversation_copies and its related query helpers out of
namespace_store/query.rs into focused Rust module(s), preserving behavior and
visibility at existing call sites. Update module declarations and imports as
needed, and ensure query.rs is no longer than 500 lines.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: db43ad85-187f-4137-96c5-a1ec133357ad

📥 Commits

Reviewing files that changed from the base of the PR and between 56a6312 and af1104b.

📒 Files selected for processing (2)
  • src/openhuman/memory/store/namespace_store/query.rs
  • src/openhuman/memory/store/namespace_store/query_tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openhuman/memory/store/namespace_store/query_tests.rs

… recall

Two gaps the review found, both of the same kind: an assertion that holds for
the wrong reason.

The channel test only proved recall hides the prior message — it would have
passed just as well if `process_channel_message` started writing raw messages
again, since the new filter would hide those too. It now reads `memory_docs`
directly and asserts the row count for the secret is zero, which is the property
the PR actually claims.

`recall_namespace_memories` carries its own copy of the filter and nothing
called it. `query_namespace_ranked` passing says nothing about it — the two load
the same documents but neither delegates to the other, so either could lose the
filter alone. Adds a regression that drops a `user_msg:` copy and keeps a real
memory through the query-less path.

Also completes the logging contract on the filter: entry, the non-global
early return, and one exit either way — a run that drops nothing is as much a
fact about this filter as one that drops. Counts only; the documents are
recalled memory and their content must not reach the log.

namespace_store 163, channels::tests::memory pass.

Reported by CodeRabbit on tinyhumansai#5315.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SRSNnqQsokuGmkbpLoLCGy

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yh928 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Built-in agents, prompts, orchestration, and agent runtime in src/openhuman/agent/. bug memory Memory store, memory tree, recall, summarization, and embeddings in src/openhuman/memory/.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Internal agents store their own prompts as the user's conversation memories

1 participant