Repository navigation
Conversation
Contributor
Author
This was referenced Jul 14, 2026
Closed
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.
What Problem This Solves
Closes #107133.
Upgrading to 2026.7.1 can leave the Gateway unable to start when a legacy Memory Core sidecar and the canonical per-agent database contain the same embedding-cache key with different derived values or timestamps. The migration uses
INSERT OR IGNORE, then incorrectly requires the ignored legacy row to match every canonical value, so Doctor reports a persistent migration warning and startup refuses readiness.Related: #107220. That issue also covers
metaandchunksconflicts; this change intentionally addresses only the derived embedding-cache case, where the existing cache key defines the identity and the canonical database is already authoritative.Why This Change Was Made
Embedding-cache rows are derived data keyed by
(provider, model, provider_key, hash). The migration now verifies that every legacy cache key exists after the import instead of requiring non-key cache values to be byte-identical. Existing canonical values win for duplicate keys, while non-conflicting legacy cache rows and unrelated legacy files/chunks still import inside the existing savepoint.The strict conflict checks for source rows, chunks, FTS/vector rows, and metadata are unchanged.
User Impact
Affected upgrades can converge through the normal migration path without deleting SQLite files or manually moving the legacy sidecar. The canonical embedding cache is preserved, unrelated legacy memory rows are imported, the sidecar is archived only after the transaction succeeds, and rerunning the migration is a no-op.
Evidence
[email protected](2d2ddc43d0dcf71f31283d780f9fe9ff4cc04fe4, npm integritysha512-ge/Xss99CHAjPL/ikmH/UFoiOrjcxDB4sW3y9mhyCD+dYW3wzV7TKbAVdkrXFgAG2d2BjpJofP97zUZ+umxo8g==) reproduced the warning with a seeded same-key/different-value cache conflict. Doctor exited 0 but left the legacy database in place and imported no legacy sources/chunks.21382b3755fafd7253339b2f3146b8667c5a7bde: the focused regression failed withlegacy memory embedding_cache rows conflict with canonical memory index rows.extensions/memory-core/doctor-contract-api.test.tspassed all 29 tests.pnpm check:changedpassed formatting, extension/test typechecks, lint, database-first guards, and import-cycle checks.okfrom bothPRAGMA quick_checkandPRAGMA integrity_checkon canonical and archived databases, and produced byte-identical verification output on a second Doctor run.4ed76a7ddb89604c35769e88d9d61c32e1a41d05did not change either owner/test file from the fully tested base; their blob contents are byte-identical. The rebased candidate is3072762c82526c0fce27804c6b3839f0002db49a; its 29 focused tests and localcheck:changedgate passed on Node 24.15.0 / SQLite 3.51.3.AI-assisted change. I reviewed the implementation, migration boundary, tests, and evidence.