Skip to content

feat(memory): injection hygiene — bounded, deduped, no silent fallback (#384) - #387

Merged
ajianaz merged 1 commit into
developfrom
feat/memory-injection-hygiene
Oct 16, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/memory-injection-hygiene

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

What

Harden the pre-turn memory recall injection: hard batch caps, in-batch dedup, all-or-nothing parsing, and a visible failure path for serve/MCP sessions.

Why

#384. The batch was bounded only by a configurable limit; a malformed recall payload silently injected fewer (or zero) items, and tole serve/MCP swallowed recall errors without any output.

Changes

  • memory.rs: MAX_BATCH_ITEMS = 24 / MAX_BATCH_BYTES = 64 KiB enforced (limit clamped; a hit that would cross the byte cap is left out whole).
  • memory.rs: dedup by whitespace/case-normalised content within a batch.
  • memory.rs: non-array payload or a hit without string content now fails the whole batch (empty store stays Ok).
  • session_host.rs: recall errors are reported on stderr (same text as the CLI) instead of being dropped.
  • README + CHANGELOG.
  • Not applicable: pending-injection dedup/expiry and the content-unchanged re-check. Injection is a single synchronous batch on the first turn, so there is no pending queue; left out deliberately.

Testing

  • New unit tests: item cap, byte cap (no mid-hit cut), dedup, malformed batch, empty store.
  • fmt, clippy -D warnings, cargo test --workspace pass; cora review --staged clean.
  • Real uteke recall --json confirmed to return a JSON array; local stores were empty, so a live non-empty batch was not exercised.

Closes #384

@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 6a1bc24 into develop Oct 16, 2026
17 checks passed
@ajianaz
ajianaz deleted the feat/memory-injection-hygiene branch October 16, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(memory): injection hygiene for the uteke integration — bounded, deduped, no silent fallback

1 participant