Skip to content

fix: index flow-compressed memories and fold in five contributor fixes - #1811

Merged
rohitg00 merged 15 commits into
mainfrom
fix/memory-write-path
Nov 18, 2026
Merged

rohitg00 merged 15 commits into
mainfrom
fix/memory-write-path

Conversation

@rohitg00

Copy link
Copy Markdown
Owner

Summary

Combines five contributor PRs with the reworked fix for flow-compress indexing (#1709). The contributors' commits are merged in unchanged, so their authorship is kept. The commits after the merges tighten each change and replace the oversized tests.

PR What it does Changes on top
#1772 (@zack-dev-cm) Consolidation status counts summaries by key, not by loading every record Uses the existing StateKV.count; test cut to 2 cases
#1773 (@zack-dev-cm) Durable capture replays do a point read before listing the session Test cut to 4 cases. Cost: a first delivery does one extra point read before the list
#1783 (@zack-dev-cm) mem::insight-list keeps only the top limit results while paging Removed the 1,061-line JSON fixture and the child-process heap test; 4 inline cases
#1788 (@zack-dev-cm) Audit log supports more than one listener (step 1 of #1741) addAuditListener returns its unsubscribe; entries are frozen copies; listener failures are logged; internal doc removed
#1785 (@zack-dev-cm) Typecheck src/hooks in CI Runs in one CI cell, not eight; dropped the ~50 tsx spawn tests, which duplicate the packaged-hook tests
#1709 (@DimitriChrysafis) Flow-compressed memories were not searchable Rebuilt as described below; graph gate .bin.tmp race fix kept

Memory write path

mem::flow-compress and mem::auto-page wrote memories to KV without indexing them. Both now call indexMemory, the same function consolidate uses. A full sweep of writes to KV.memories found no other write path that skips the index.

flow-compress also changes behavior:

  • If the reply has no summary sections, the call returns success:false and stores nothing. It does not store the raw model text or a placeholder.
  • Compressing the same set of actions again supersedes the earlier memory (version 2, parentId), under the mem:remember lock. If marking the old memory fails, the new write is rolled back.
  • agentId comes from the caller, falling back to AGENT_ID. project is trimmed, and is stamped only when every compressed action belongs to it.
  • runId and actionIds are type-checked. The REST route forwards only runId, actionIds, project and agentId.

Not included from #1709: parallel candidate reads in graph-retrieval.ts. That change touches the hot search path and needs its own PR with latency numbers.

Testing

  • npx vitest run: 5,078 passed, 24 skipped. test/integration.test.ts fails here because no server runs on :3111; it needs a live daemon.
  • npm run build, npm run typecheck:hooks and npm run docs:check pass. tsc --noEmit shows the same 28 existing errors as main.
  • The new flow-compress and auto-page tests fail on main.

Merge with a merge commit, not a squash, so the contributor PRs show as merged.

zack-dev-cm and others added 15 commits November 13, 2026 06:28
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
- consolidation status: count summaries through StateKV.count instead
  of a copy of it.
- audit listeners: addAuditListener returns its unsubscribe function,
  entries are frozen copies of the caller's targetIds and details so
  one listener cannot change what another sees, and listener failures
  are logged instead of dropped. Removed the internal-only doc.
- hooks typecheck: run once in CI (ubuntu, Node 22) instead of in all
  eight matrix cells. Dropped the tsx source-hook spawn tests: the
  packaged hooks are already tested, and the HTTPS refusal is covered
  in directory-review-privacy.test.ts.
- Replaced the oversized tests and fixtures for the summary count,
  durable replay lookup, insight paging and audit listeners with
  focused cases.

Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
mem::flow-compress and mem::auto-page wrote memories to KV without
indexing them, so search could not find them until a restart rebuilt
BM25. Both now go through indexMemory, the funnel consolidate already
uses.

flow-compress also:
- returns success:false and stores nothing when the reply has no
  summary sections, instead of saving an empty or raw-text memory;
- supersedes its earlier memory for the same action set under the
  mem:remember lock, instead of adding a duplicate;
- takes agentId from the caller (falling back to AGENT_ID) and trims
  project the way mem::remember does;
- stamps project only when every compressed action belongs to it;
- validates runId and actionIds, and the REST route forwards only
  runId, actionIds, project and agentId;
- accepts summary tags that carry attributes.

auto-page titles use the surrogate-safe title helper.

The packaged graph gate ignores in-flight .bin.tmp files when listing
graph files, so an atomic rename between readdir and stat no longer
fails the gate.

Co-authored-by: dimitri <dimitri.chrysafis@gmail.com>
Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agentmemory Ready Ready Preview Nov 18, 2026 4:32am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

This branch was successfully deployed

1 active deployment
Preview — de5db98f Deployed Nov 18, 2026 by vercel[bot]
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.

2 participants