Repository navigation
feat(memory): establish canonical promotion pipeline - #10772
Git-on-my-level merged 3 commits into
Conversation
Failure-Class: FC-split-mutation-authority
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 165c041a93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…tch guard - Remove module-level pydantic import from run-canonical-maintenance.py; duck-type BaseModel via model_dump so the bare-Python dev-harness test lane (repo-checks Hygiene + PR Metadata Preflight) can load the script without backend deps. The serialization test now skips when pydantic is unavailable instead of erroring. - Add batch-level duplicate-supersede-target detection in _validate_agent_batch so two decisions that supersede the same active Long-term candidate are rejected pre-apply rather than producing a partial-apply maintenance run after the first promotion commits. - Add regression test for the duplicate-supersede scenario. Addresses Codex P2 review comment r3665114173.
The duplicate-supersede batch guard adds 11 lines to the canonical admission authority file, squarely within its existing split-mutation justification.
|
Resolved Codex P2 thread r3665114173 — duplicate-supersede-target guard. The batch-level guard added in |
There was a problem hiding this comment.
💡 Codex Review
omi/backend/utils/memory/canonical_consolidation.py
Lines 1113 to 1117 in 93685b2
When one promotion supersedes Long-term item X and another non-promote decision uses X as its target_memory_id (for example, an archive decision with reconciliation="duplicate"), this guard accepts the batch because it records only decision.supersedes. Promotions are applied first, so the first decision marks X superseded; the later decision then fails _validate_authoritative_targets, which also requires target_memory_id to remain active, after the promotion has already committed. Fresh evidence in the current guard is this mismatch between the references it records and the references the apply boundary validates; reject an intersection between any decision's target and another decision's supersedes before applying the batch.
AGENTS.md reference: AGENTS.md:L45-L49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
What changed and why
Replace the remaining split memory lifecycle with one canonical pipeline: broad, bounded intake always lands in Short-term; canonical consolidation is the sole route into Long-term and atomically records its promotion receipt and graph assertion. Retrieval now collapses canonical lineage, while vector, keyword, compatibility, and graph projections converge from a durable outbox instead of acting as memory authority.
High-level change map
INV-MEM-4lifecycle invariant, and a backend prevention artifact forFC-split-mutation-authority.Why these are improvements
The requested recall, precision, reliability, and cost percentages remain design targets. This PR establishes the mechanisms expected to improve those metrics but does not claim production benchmark results.
Product invariants affected
How it was verified
BACKEND_PYTEST_WORKERS=1 bash test.shswept all 776 backend test files. It initially exposed nine integration-fixture regressions; after repairing those seams,BACKEND_UNIT_TEST_FILE_LIST=.unit-failures.txt BACKEND_PYTEST_WORKERS=1 bash test.shpassed every formerly failing file.make preflightpassed the complete diff-scoped local manifest.22 passed in 0.80s).0 errors), Black, Ruff, Python compilation, changed-workflowactionlint, Firestore index generation/coverage, runtime validators, and the app-client OpenAPI drift check passed.npx tsc --noEmit --incremental falsepassed for the admin web workspace.No production deployment or live personal account data was used. A live-service/user-facing production exercise therefore remains intentionally unperformed.
Tests
Core-path and error-path coverage was added or updated for broad Short-term capture, sole-route consolidation, atomic graph-backed promotion, required-processing retries, source replacement/reactivation, lineage collapse, projection retries/read fences, privacy deletion, account purge, bounded review queries, scheduler wiring, and compatibility adapters.
Failure class (fixes)
Failure-Class: FC-split-mutation-authority
New guards (only when adding a check or ratchet)
Merged PRs #9365 and #9597 are the recorded instances this would have caught.
backend/tests/unit/test_canonical_maintenance_ordering.pyis intentionally a backend behavioral contract, not a new shared checker, because it must execute the production memory-maintenance owner and prove that no second promotion route can run when consolidation is blocked; the shared cross-component primitive remains theFC-split-mutation-authorityregistry contract.