Skip to content

fix: enforce workspace memory limit during extraction - #6149

Merged
timothycarambat merged 4 commits into
Mintplex-Labs:masterfrom
uczltw6:codex/enforce-workspace-memory-limit
Aug 19, 2026
Merged

fix: enforce workspace memory limit during extraction#6149
timothycarambat merged 4 commits into
Mintplex-Labs:masterfrom
uczltw6:codex/enforce-workspace-memory-limit

Conversation

@uczltw6

@uczltw6 uczltw6 commented Aug 19, 2026

Copy link
Copy Markdown

Summary

  • enforce the existing workspace-memory limit during automatic memory extraction
  • account for memories already stored in the workspace before creating new ones
  • add a regression test for a workspace with only one remaining slot

Problem

applyExtractedMemories() limited each extraction batch to 20 workspace memories, but it did not subtract memories already persisted for that workspace. For example, a workspace with 19 memories could receive three new extracted memories and end up with 22, despite WORKSPACE_LIMIT being 20.

The fix reuses countForScope() to calculate the remaining workspace slots and only creates that many new memories. Global-memory and update behavior are unchanged.

Fixes #6148

Testing

  • yarn test server/__tests__/models/memory.test.js --runInBand — 1 passed
  • related model tests — 65 passed
  • complete server Jest suite — 40 suites, 411 tests passed
  • cd server && yarn lint:check — passed

AI assistance was used during implementation. I reviewed the final code and regression test and verified the results above locally.

@timothycarambat
timothycarambat merged commit 29713f2 into Mintplex-Labs:master Aug 19, 2026
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.

[BUG]: Automatic memory extraction can exceed the workspace memory limit

2 participants