Skip to content

fix(agent-context): wire inject_semantic_recall into production path and fix recall accumulation#4040

Merged
bug-ops merged 2 commits into
mainfrom
4022-4019-inject-semantic-recall
May 16, 2026
Merged

fix(agent-context): wire inject_semantic_recall into production path and fix recall accumulation#4040
bug-ops merged 2 commits into
mainfrom
4022-4019-inject-semantic-recall

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 16, 2026

Summary

  • Wires ContextService::inject_semantic_recall into the agent turn loop via the new inject_semantic_recall_bare method in zeph-agent-context; the production assembly path in zeph-core now delegates to it, activating tiered retrieval for all production sessions.
  • Extends remove_by_part_or_prefix to remove Role::User messages with RECALL_PREFIX (in addition to Role::System), preventing recall messages from accumulating across turns when tiered retrieval is enabled.
  • Adds 2 regression tests covering both fixes.

Test plan

  • service::tests::remove_recall_messages_removes_user_role_recall — verifies Role::User recall messages are cleaned up
  • service::tests::inject_semantic_recall_tests::inject_semantic_recall_bare_no_memory_returns_ok — verifies the new production API
  • 9465 workspace tests pass, clippy clean, fmt clean

Closes #4022
Closes #4019

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate bug Something isn't working size/L Large PR (201-500 lines) labels May 16, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 16, 2026 17:08
@bug-ops bug-ops force-pushed the 4022-4019-inject-semantic-recall branch from 9180334 to 94b4765 Compare May 16, 2026 17:08
…and fix recall accumulation

ContextService::inject_semantic_recall was never called from the agent turn
loop — tiered retrieval was silently inactive for all production sessions.
Wire the production path in assembly.rs through the new
inject_semantic_recall_bare method so tiered retrieval now activates when
configured.

remove_by_part_or_prefix only removed Role::System recall messages, leaving
Role::User messages inserted by the tiered-retrieval path to accumulate
across turns. Extend the retain predicate to also remove Role::User messages
whose content starts with RECALL_PREFIX.

Closes #4022
Closes #4019
@bug-ops bug-ops force-pushed the 4022-4019-inject-semantic-recall branch from 94b4765 to 1a92a5e Compare May 16, 2026 17:10
@bug-ops bug-ops merged commit 90e469b into main May 16, 2026
32 checks passed
@bug-ops bug-ops deleted the 4022-4019-inject-semantic-recall branch May 16, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

1 participant