feat(memory): enforce capacity budgets for long-lived Memories - #1746
Open
222twotwotwo wants to merge 1 commit into
Open
222twotwotwo wants to merge 1 commit into
222twotwotwo wants to merge 1 commit into
Conversation
222twotwotwo
requested review from
Alanxtl,
AlexStocks,
PsiACE,
Teingi,
Zxf-xufeng,
frostming and
zhanghuidinah
as code owners
September 26, 2026 12:01
222twotwotwo
force-pushed
the
feat-1718-memory-capacity-contract
branch
from
September 26, 2026 12:34
5731493 to
e001436
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue or RFC does this PR close?
Closes #1718
Rationale for this change
#1709 removed projection write amplification, but each Memory Revision still stores a complete manifest. Inactive entries remain as tombstones, writes have no explicit entry or byte ceiling, and callers cannot inspect remaining capacity.
This PR adds observable capacity budgets and deterministic refusal when a write exceeds them. Explicit tombstone compaction lets operators recover current-manifest capacity while preserving historical content and exact citations.
What changes are included in this PR?
This implements the explicit-failure option in feat(memory): define capacity contract for long-lived Memories #1718. Physical erasure and retention policies remain under RFC: define retention, erasure, and lifecycle policies #1425; entry and history pagination remain under feat(memory): add bounded cursor pagination for Memory entries #1656 and feat(memory): add bounded pagination for Memory changes and history #1657.
Are there any user-facing changes?
Yes.
No database schema migration is required. The budgets constrain current Revision content and history-read expansion; retained historical data continues to consume storage.
How was this change tested?
Focused capacity, service, persistence, HTTP/client, and API contract regressions:
uv run --locked --no-sync python -m pytest
tests/builtin/artifacts/memory/test_capacity.py
tests/builtin/artifacts/memory/test_service.py
tests/e2e/test_memory_capacity.py
tests/test_api_contract.py
tests/test_js_operations.py
tests/builtin/persistence/test_memory.py -q
80 passed, 13 skipped. The skipped cases require an OceanBase connection.
Full repository CI remains pending.
AI usage statement
Codex assisted with code review, documentation updates and validation.