Skip to content

fix(mcp): require explicit opt-in for optional embedder loading - #215

Merged
bitmaster162 merged 3 commits into
masterfrom
agent/mcp-offline-embedder-local-r1
Oct 21, 2026
Merged

bitmaster162 merged 3 commits into
masterfrom
agent/mcp-offline-embedder-local-r1

Conversation

@bitmaster162

@bitmaster162 bitmaster162 commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Current revision — synchronized R2, reviewed integration scope

Target: protected master, after #214 merged. The owner-delivered Claude decision of 21.10.2026 authorizes the exact steps in APPROVE_CONTINUITYOS_PR215_REVIEW_NOTE_READY_AND_NORMAL_MERGE_ONLY: update this description, change Draft to Ready, then one ordinary merge commit only after a fresh passing BASE/HEAD/TREE/files/mergeability/CI preflight. Authorization does not by itself mean that Ready or merge has completed; the live PR state and post-operation readback determine completion.

merge допущен Claude по делегированию Robert 21.10.2026, только normal merge

  • Base branch: master.
  • Pinned BASE SHA: 0c4d75c6dd7d3806c4efc27d7b284930495c24d6.
  • BASE TREE: de6a73eceea53ec2e864bf1254a7de0ef7d129b6.
  • Head branch: agent/mcp-offline-embedder-local-r1.
  • Current HEAD: 03d3384433e4531c81d4f6aed7b1cf4f51104990.
  • Current HEAD TREE: 043db1c3c0e246d31e462b0a58b740713fbbc48c.
  • Expected normal merge result TREE: 043db1c3c0e246d31e462b0a58b740713fbbc48c.
  • Expected merge parents, in order: pinned BASE, then current HEAD.
  • The mechanical branch-update commit has parents 0bd9d58c898a9756d9b6986b8971b9b6a89fcd01 first and pinned master 0c4d75c6dd7d3806c4efc27d7b284930495c24d6 second.
  • Against pinned master: 3 commits, ahead=3 / behind=0; exactly 4 files, 1 modified + 3 added, +843 / -4.

The reviewed R2 source HEAD was 0bd9d58c898a9756d9b6986b8971b9b6a89fcd01, TREE 33897854a7020f817bdec26ae67e9f142539365f. Its original chain remains intact: original #214 HEAD 34d02e44104146beba7b174a88d58270606891fd → R1 1c9f8af5c2ecab74600f1171826fea2dc52397e6 → R2 0bd9d58c898a9756d9b6986b8971b9b6a89fcd01. Those SHAs describe the earlier stacked publication, not the current target branch.

The 21.10 synchronization added one ordinary merge commit, without additional source edits or history rewriting. The merge TREE was computed with local Git before publication; the branch ref was updated with force=false and the exact previous HEAD check. Compared with the old R2 HEAD, the only file additions are the four already-integrated Company Twin demo files (+763/-0). All four PR #215 file blobs remain identical to the reviewed R2 revision:

File Reviewed and current blob SHA
continuityos/mcp_server.py 55728992affe05c5bce36624428d19792272f81e
tests/test_product_mcp_offline.py 6ccea16d196dd97a1a15555fc61fa17c8c66becf
docs/MCP_OFFLINE_EMBEDDER_R1.md 6acca2471b1b2d6d4242e024e6cbebbcd4d17949
docs/MCP_EMBEDDER_COMPATIBILITY_R2.md e769f9a74d3222f5edf95786e020fc3a559f40f1

Review disposition — R1 REVISE preserved; R2 APPROVE received 21.10.2026

The owner originally supplied the independent Claude/Opus review of R1 HEAD 1c9f8af5…, dated 2026-10-14. Its source file SHA-256 is 6587757efc39fb154f567cd001b1b6ed0cf6a6b2f902ea40aa7fa4eeeaa8c82d.

The R1 reviewer read the full R1 diff and embed.py, embedders.py, memory.py, index.py, and store.py at that head. The reviewer did not verify CI, a real FastEmbed model, or core cos mode selection. The historical R1 verdict was REVISE (small), suitable as Draft; block activation until compatibility protection exists. This record is retained, not relabelled as an approval of R1.

Both mandatory findings were then reproduced locally using synthetic SQLite data and a 384-dimensional callable, not a downloaded model:

  1. A store containing 384-dimensional vectors accepted new 256-dimensional MCP writes under the default mode; semantic ranking subsequently rejected the mixed candidates. Selecting fast again did not remove the incompatible rows.
  2. Explicit fast loader failure silently fell back to Hashing, including on an empty store. With the existing warning-suppression setting, stderr did not reveal the downgrade.

An additional counterexample showed that checking a single saved row can miss a pre-existing mixed store. Recall failure depends on the selected candidate scope; a compatible namespace alone may still rank successfully. Startup-only checks do not prevent later writes from another raw Memory/Store client.

On 21.10.2026, Claude, by Robert's delegation, reported an independent source review of finished R2 at 0bd9d58c… and gave APPROVE for integration into master. The decision was delivered in the owner conversation, not recorded here as a formal GitHub review submission or an authenticated external reviewer identity. Claude reported both mandatory R1 findings correctly addressed: explicit fast failure without fallback before Memory opens; a fixed synthetic dimension probe; one aggregate SELECT across stored vectors in all namespaces; and connection cleanup on failures in the new compatibility check. These statements apply to this narrow correction, not to every possible initialization failure or whole-system safety.

The current four file blobs are unchanged from that reviewed R2 revision. The mechanical synchronization has its own exact-HEAD CI below. Neither the original author checks nor unrelated reviews of #213/#214 substitute for this R2 decision. FastEmbed activation, model downloads, installed-runtime switching and production admission remain outside the approval.

Effective behavior in R2

R1 behavior retained:

  • Read and normalize CONTINUITYOS_EMBEDDER once per Server construction.
  • Default/empty/whitespace, hash, hashing, offline, and local never select or construct the optional backend on this MCP selection path.
  • Only explicit fast / fastembed selects the optional loader.
  • Unknown modes raise UNSUPPORTED_EMBEDDER_MODE before database-path resolution or opening.
  • Construct Memory once; a Memory initialization failure does not cause a second open under another backend.
  • Existing CURRENT effect guards retain precedence over mode selection and Memory construction.

R2 intentionally supersedes R1's fast-loader fallback:

  • Failed import or construction in explicit fast mode raises FAST_EMBEDDER_UNAVAILABLE before Memory construction. There is no automatic Hashing fallback.
  • After normal Memory construction and before serving requests, call the chosen embedder once with the fixed synthetic string continuityos:mcp-embedding-dimension-probe:v1. Stored record content is not supplied to the probe.
  • One aggregate SQL query checks the minimum/maximum vector BLOB length and malformed-storage count across all non-NULL vectors, all namespaces, not one sampled row. No record texts or vector payloads are fetched by this query.
  • Incompatible or mixed dimensions raise EMBEDDER_DIMENSION_MISMATCH store=<dimension-or-range> selected=<dimension>, with operator guidance. Empty/vectorless stores do not acquire a fabricated historical dimension requirement.
  • Malformed stored vector shapes raise EMBEDDER_VECTOR_DATA_INVALID. A failing or invalid probe and SQL-read failure also terminate startup.
  • An already-created Memory connection is closed if this compatibility check fails. A real stdio process returns no ready initialize response and services no queued write after such failure.

No new database schema, runtime, authority issuer, public MCP tool, protocol framing, re-embedding path or automatic repair was added. Memory, Store, index, CURRENT guards, GateBroker, R14/R15, Person R21H/A4/A3 and core cos are unchanged.

Compatibility / remaining boundaries

Activation remains gated. Installing FastEmbed no longer implicitly enables it in MCP; existing FastEmbed operators must explicitly select the correct backend. Explicit fast failure now stops instead of degrading to Hashing. This is an intentional replacement of the R1 contract, documented in docs/MCP_EMBEDDER_COMPATIBILITY_R2.md. The earlier R1 document remains historical; its fallback description is superseded by R2. Both documents remain byte-identical to the reviewed source; historical evidence is not rewritten by this metadata update.

The check detects dimension mismatch and already-mixed dimensions; it is not embedder identity verification. Two unrelated 256-dimensional models may pass this size check despite incompatible spaces. It is a startup snapshot, not a continuous multiwriter constraint or an authenticated-host boundary. No stored data is inspected for a migration, migrated, re-embedded or repaired automatically.

Normal Memory/Store initialization precedes the compatibility scan and may perform its existing WAL/schema work. Therefore "refuses before servicing MCP requests" does not mean zero filesystem effects or no historical initialization changes. A failed startup is not described as a rollback of all initialization effects.

Deferred review recommendations: a shared MCP/core mode resolver, durable backend/model identity, and continuous protection from incompatible external writers. These are not silently claimed solved by R2. Actual FastEmbed model initialization/inference, optional downloads and production runtime activation have not been exercised here.

Exact file scope against pinned master

File Status Current PR delta Historical R2-only delta vs R1
continuityos/mcp_server.py modified +54 / -4 +41 / -3
tests/test_product_mcp_offline.py added +594 / -0 +303 / -5
docs/MCP_OFFLINE_EMBEDDER_R1.md added +100 / -0 unchanged
docs/MCP_EMBEDDER_COMPATIBILITY_R2.md added +95 / -0 +95 / -0

Historical local R2 evidence — not new tests of the synchronized HEAD

Tests were bound to the exact final LF runtime and test bytes. Publication and synchronization did not rerun or relabel these historical local tests.

Evidence Observed result
Same final 88 MCP cases against unchanged R1 runtime 42 failed / 46 passed / 0 errors — red reproduction
Optional backend available as a synthetic sentinel; MCP and existing broker tests 113 passed / 0 failed / 0 skipped
Optional backend absent; extended 20-file regression 567 passed / 0 failed / 1 skipped
MCP cases 88 total; 45 new; two former fallback cases explicitly revised to expect failure
Deterministic author scope/contract audit 24 checks passed
Execution of the exact guard block over synthetic SQLite combinations 146 expected outcomes

These sets overlap; counts must not be added as unique coverage. Old test bodies were retained except the explicitly superseded fallback expectation; the stdio utility also gained a synthetic loader-failure option. The single skip is the pre-existing Windows inability to create a real filesystem symlink.

Real subprocess stdio cases check mismatch rejection before readiness/writes, exact saved rows, connection cleanup, compatible 256/384 operation and explicit loader/import failure. The successful profiles recorded 41 and 58 Python startups, zero network-attempt events, and no real model loads. Local hostname queries are allowed for test metadata. Python audit controls and synthetic backend availability are not OS isolation or real-model qualification.

Historical unsuccessful attempts are preserved. A new test initially checked WAL absence after its own read-only observer had recreated a WAL sidecar. A separate diagnostic established that cause; the assertion was moved before the observer, not removed. Accidental CRLF expansion was corrected to the repository's LF with unchanged Python AST. Red and both green profiles were rerun on the final bytes before commit. The earlier runtime-script transfer timeout was verified as no product write, rather than blindly retried.

Historical custody and original R2 publication evidence

The original R2 publication preflight verified clean HEAD/TREE/direct parent, 731/731 tracked files against Git archive, all 76 members of the immutable R2 manifest, exact three-file delta, configured origin/push URL and the verified bundle. The existing Git hook configuration was not changed. Historical manifests and test evidence were not overwritten; synchronization and merge receipts are separate.

Original R2 publication verified that R2's direct parent was the exact previous remote HEAD, then used a SHA-specific expected-ref lease for a fast-forward update. Readback of all 223 then-existing remote heads found only that expected update; the other 222 heads, including #214 and master, were unchanged. No commits were generated for that original publication. These counts are historical, not the later 224-head synchronization baseline.

  • R2 manifest SHA-256: 7cc10dcd68c8f484db7bad91cc4ba83c53970863978262c097f61377c4522353.
  • R2 patch SHA-256: b8f82398b4591fbc2c6ac377cb83086838bb6a44a80571243334bf370e58e5c6.
  • R2 bundle SHA-256: b9728f50b457415c41fde81f96db8d2ade86978d2a886fc0b64d97f330166641; prerequisite is exact R1 HEAD 1c9f8af5….
  • R2 full evidence archive SHA-256, stored separately from the payload manifest: 685ec6888a051f7784f1e7ef5cccc3b50e6b1dd14dffbe337efad0c188745fa1.

The original and synchronization commits are unsigned. Hashes establish byte integrity and lineage, not independently authenticated owner identity.

Current exact-HEAD CI — 5/5 SUCCESS

All five checks on 03d3384433e4531c81d4f6aed7b1cf4f51104990 completed successfully. Times are UTC on 2026-10-21:

Check Conclusion Completed at
Ubuntu / Python 3.11 SUCCESS 05:22:26
Windows / Python 3.11 SUCCESS 05:50:42
Analyze Python SUCCESS 05:20:11
CodeQL SUCCESS 05:20:04
offline-shadow-continuity SUCCESS 05:19:12

Automatically triggered workflows, all completed with SUCCESS on attempt 1:

Ubuntu and Windows each passed clean-source, isolated wheel-only and full editable-install pytest. Both checkout logs were verified against synthetic CI commit ffd48beb70cf66b9340da17a9c18958ac676b07a, whose parents are pinned BASE and current HEAD, and whose TREE 043db1c3c0e246d31e462b0a58b740713fbbc48c is identical to the current HEAD TREE. This CI object is not the authorized final merge into master.

The previous R1 workflow #38537189298 on 1c9f8af5… and the original R2 workflow #38546056794 on 0bd9d58c… remain historical evidence, not substitutes for this new exact-HEAD qualification. No manual workflow dispatch or rerun was requested.

Authorization boundary and post-merge verification

The accepted 21.10.2026 token permits only this description update, Draft → Ready, and one normal merge of the pinned HEAD into the pinned BASE after a fresh successful preflight. The merge must have BASE as first parent, HEAD as second parent and the exact expected TREE. Any drift or failed gate requires STOP; branch protection must not be changed or bypassed. Post-merge Actions are separate evidence from the successful pre-merge CI.

No squash, rebase, force-push, additional feature-branch commits, source edits, branch deletion, auto-merge, deployment, release, separate issue closure, FastEmbed activation, installed MCP/runtime change, real-user database access, migration or re-embedding is authorized. #209/#210 and already merged PRs remain outside the mutation scope. No global Antigravity, Scheduler, TPM, service or trading changes are included.

R1's two mandatory findings are accepted as addressed by the reviewed R2 correction for source integration. This does not close the remaining dimension-vs-identity, multiwriter, initialization-effect or production-qualification limitations.

C0 HOLD; T11/T12 UNEXECUTED; NOT_PRODUCTION_ADMITTED; execution_authority=NONE; can_execute=false; can_trade=false; capital_permission=DENY.

Mechanical branch synchronization only; no additional source changes.
PR remains Draft. Merge into master and runtime activation are not authorized.
@bitmaster162
bitmaster162 marked this pull request as ready for review October 21, 2026 06:05
@bitmaster162
bitmaster162 merged commit 591e375 into master Oct 21, 2026
5 checks passed
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.

2 participants