Skip to content

test(agent-memory): Phase 11 — integration suite (real valkey-search)#259

Open
jamby77 wants to merge 2 commits into
feature/agent-memory-phase10-facadefrom
feature/agent-memory-phase11-integration
Open

test(agent-memory): Phase 11 — integration suite (real valkey-search)#259
jamby77 wants to merge 2 commits into
feature/agent-memory-phase10-facadefrom
feature/agent-memory-phase11-integration

Conversation

@jamby77

@jamby77 jamby77 commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #258 (Phase 10 — AgentMemory facade). Final core phase (0–11).

What

MemoryStore.integration.test.ts — a skip-guarded suite that exercises the full memory stack against a real Valkey + valkey-search server.

  • Connects via VALKEY_URL (default redis://localhost:6380), lazyConnect + no-retry so it fails fast and skips when no server is present (CI stays green) — same pattern as semantic-cache/agent-cache.
  • FT.CREATEs the {name}:mem:idx index (FLAT, FLOAT32, COSINE, dim 16; TAG scope/tags/source; NUMERIC importance/created_at/last_accessed_at/access_count; TEXT content) in beforeAll, since the package has no index-creation code of its own.

Coverage

  1. remember → recall round trip — stored memory comes back at cosine distance < 0.01 (≈ exact match), with the right id and content.
  2. scope/tag isolation — same text in two namespaces; recall filters server-side to the requested namespace and to a tag.
  3. capacity evictionmaxItemsPerScope: 3, write 5; the evictions counter in __mem_stats increments and the scope stays bounded.
  4. ttl expiry — a ttl: 1 memory exists, then is gone after expiry.
  5. consolidation — old low-importance memories collapse into a source: 'summary' memory that is itself recallable; sources deleted; counts correct.

Robustness

  • Polls for async HNSW indexing (pollUntil) rather than fixed sleeps; drops the index and deletes keys around the run.
  • Adds iovalkey as a devDependency for the test client (lockfile updated).

Verification

Default vitest run → 100/100 green (integration skips, no server). Against the live valkey/valkey-bundle:9.1 on port 6384: 5/5 green, non-flaky across 3 consecutive runs. tsc clean · prettier clean.

This completes the agent-memory core (Phases 0–11). Optional follow-ups remain: Phase 12 (Python parity) and Phase 13 (MCP tools).


Note

Low Risk
Test-only changes with no production runtime impact; integration tests are skipped without a Valkey server.

Overview
Adds MemoryStore.integration.test.ts, an optional integration suite that runs MemoryStore against a live Valkey instance with valkey-search (connect via VALKEY_URL, default redis://localhost:6380). Tests skip when no server is reachable so default CI stays green, matching other packages’ integration pattern.

The suite bootstraps its own FT.CREATE index in beforeAll (the package does not create indexes), then covers remember/recall similarity, namespace and tag filtering, capacity eviction with stats, TTL expiry, and consolidation into a recallable summary.

Adds iovalkey as a devDependency for the test client; lockfile updated accordingly.

Reviewed by Cursor Bugbot for commit e517bec. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 80c4b1c. Configure here.

Comment thread packages/agent-memory/src/__tests__/MemoryStore.integration.test.ts Outdated
@jamby77 jamby77 force-pushed the feature/agent-memory-phase10-facade branch from 268b946 to a409ab0 Compare June 17, 2026 14:52
@jamby77 jamby77 force-pushed the feature/agent-memory-phase11-integration branch from 80c4b1c to ae5f44f Compare June 17, 2026 14:53
@jamby77 jamby77 force-pushed the feature/agent-memory-phase10-facade branch from a409ab0 to aa75783 Compare June 17, 2026 14:58
@jamby77 jamby77 force-pushed the feature/agent-memory-phase11-integration branch from ae5f44f to dea635c Compare June 17, 2026 14:59
@jamby77 jamby77 force-pushed the feature/agent-memory-phase10-facade branch from aa75783 to 7a0812f Compare June 18, 2026 06:57
@jamby77 jamby77 force-pushed the feature/agent-memory-phase11-integration branch from dea635c to 395d192 Compare June 18, 2026 06:57
@jamby77 jamby77 force-pushed the feature/agent-memory-phase10-facade branch from 7a0812f to 65a592a Compare June 18, 2026 07:19
@jamby77 jamby77 force-pushed the feature/agent-memory-phase11-integration branch from 395d192 to b522a61 Compare June 18, 2026 07:19
@jamby77 jamby77 force-pushed the feature/agent-memory-phase10-facade branch from 65a592a to 8915dfe Compare June 18, 2026 07:28
@jamby77 jamby77 force-pushed the feature/agent-memory-phase11-integration branch from b522a61 to 29a0788 Compare June 18, 2026 07:28
jamby77 added 2 commits June 18, 2026 10:35
- MemoryStore.integration.test.ts, skip-guarded (VALKEY_URL, default
  redis://localhost:6380): connects to a real Valkey + valkey-search,
  FT.CREATEs the mem index, and exercises the full stack
- Covers: remember->recall round trip at near-zero distance; scope/tag
  filter isolation; capacity eviction with the eviction counter; ttl
  expiry; consolidation into a recallable summary
- Polls for async HNSW indexing to stay non-flaky; drops the index and
  cleans keys around the run
- Add iovalkey devDependency for the test client

Verified green and non-flaky against valkey-bundle 9.1 on port 6384.
…figured cap

Assert the scope settles to <= maxItemsPerScope (3), not max+1, so a
broken eviction path can't pass.
@jamby77 jamby77 force-pushed the feature/agent-memory-phase10-facade branch from 8915dfe to a0accf8 Compare June 18, 2026 07:35
@jamby77 jamby77 force-pushed the feature/agent-memory-phase11-integration branch from 29a0788 to e517bec Compare June 18, 2026 07:35
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.

1 participant