Repository navigation
fix(memory-core): preserve canonical cache rows during legacy migration - #107243
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 343e945a8e
ℹ️ 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".
ddd4c8b to
d851aa3
Compare
|
Codex review: needs changes before merge. Reviewed July 14, 2026, 8:29 AM ET / 12:29 UTC. Summary PR surface: Source 0, Tests +135. Total +135 across 2 files. Reproducibility: yes. The linked issue and PR proof establish a v2026.7.1 fixture with duplicate embedding-cache identities that repeatedly blocks Gateway startup, plus the intended successful migration path. Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Require both canonical and legacy embeddings to be valid arrays whose lengths each equal their shared declared Do we have a high-confidence way to reproduce the issue? Yes. The linked issue and PR proof establish a v2026.7.1 fixture with duplicate embedding-cache identities that repeatedly blocks Gateway startup, plus the intended successful migration path. Is this the best way to solve the issue? No, not yet. Canonical-wins for derived cache payloads is the narrow owner-boundary fix, but the predicate must validate each row’s internal dimension consistency rather than only comparing the rows to each other. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b4128978cdbd. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +135. Total +135 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
Land-ready at Maintainer work completed:
Proof:
Known gap: the standalone raw-head changed gate saw unrelated Plugin SDK API baseline drift because that checkout predates current |
|
Merged via squash.
|
…on (openclaw#107243) * fix(memory-core): preserve canonical cache rows on migration * fix(memory-core): guard cache migration dimensions * fix(memory-core): validate cache embedding lengths * fix(memory-core): validate cache migration dimensions * refactor(memory-core): keep cache guard compact --------- Co-authored-by: felirami <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…on (openclaw#107243) * fix(memory-core): preserve canonical cache rows on migration * fix(memory-core): guard cache migration dimensions * fix(memory-core): validate cache embedding lengths * fix(memory-core): validate cache migration dimensions * refactor(memory-core): keep cache guard compact --------- Co-authored-by: felirami <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an upgrade failure introduced in v2026.7.1: Gateway startup can loop when a legacy Memory Core sidecar and the canonical per-agent database contain the same embedding-cache identity with different derived payloads. The import previously treated every collision as a conflict, retained the sidecar, and repeated the failed startup migration on every restart.
Why This Change Was Made
The cache identity is
(provider, model, provider_key, hash), and the canonical database is authoritative once a compatible row exists. The migration now retains that canonical row only when both rows declare the same dimensions, both embeddings are valid JSON arrays, and each array length matches its declared dimensions. It still imports non-colliding legacy rows. Any dimensional or payload-shape mismatch rolls back and preserves the sidecar for repair instead of archiving potentially recoverable state.User Impact
Affected Gateways can complete the v2026.7.1 state migration without deleting a valid canonical cache row. Legacy sources, chunks, and non-colliding cache entries still import; compatible canonical rows win; malformed or incompatible collisions remain fail-closed.
Evidence
e35ddb3ce365c07419365d5b799bbb45b65ac38e.run_6ac4a00dc21c: focused Memory Core doctor suite, 35/35 passed. Coverage includes preservation/import/idempotency, different dimensions, same wrong length relative to dimensions, one-sided wrong length, malformed canonical/legacy JSON, and missing dimensions.run_b5f278178191: created real canonical and legacy SQLite state, startedopenclaw gateway run, reached/readyz, preserved canonical[9,9,9]with dims 3 and timestamp 99, imported the legacy source/chunk, archived the sidecar, then reached/readyzagain on a second start.29349881414: exact-head CI gate passed, including build, lint, production/test types, dependency and architecture guards, and both QA smoke profiles.main; this PR changes no SDK files, and the current merge-ref CI gate passed.Fixes #107133