Skip to content

merge test - #2624

Closed
endxxxx wants to merge 65 commits into
dev-v2.0.35from
main
Closed

endxxxx wants to merge 65 commits into
dev-v2.0.35from
main

Conversation

@endxxxx

@endxxxx endxxxx commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change, the problem it solves, the implementation approach, and relevant context. List any dependencies required for this change.

Related Issue (Required): Fixes #issue_number

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Checklist

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

Reviewer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed
  • Tests have been provided

autodev-bot and others added 30 commits August 30, 2026 05:29
`LlmClient.buildCallInput()` dropped `opts.op` when constructing the
`ProviderCallInput` object handed to `provider.complete()` / `stream()`.
Callers set `op` for every logical call site (e.g. `capture.summarize`,
`retrieval.filter`, `skill.evolve`) but only the audit / metrics paths
inside the facade saw the tag — providers never did.

As a result any per-op provider behavior (request-body tweaks, routing
overrides, reasoning kill-switches keyed on
`opts.op === "capture.summarize"`) silently could never fire. The
issue-reported symptom: OpenRouter DeepSeek reasoning models burn full
token budget and double latency on `capture.summarize` because the
recommended `thinking: { type: "disabled" }` switch is unreachable.

Fix:
- extend `ProviderCallInput` with optional `op?: string`
- copy `opts?.op` in `buildCallInput()`

Field stays optional so providers must not assume it is set. No public
LlmClient surface change; consumers keep calling `complete` /
`completeJson` / `stream` unchanged.

Added 4 unit tests in `tests/unit/llm/client.test.ts` under an
"op propagation (issue #2308)" describe block covering complete /
completeJson / stream forwarding and the "no op supplied" case.
## Summary

This branch improves the memory pipeline and local-plugin runtime
compared with main:

- Strengthen L2 multilingual induction and L3 policy evolution with
bounded clustering, retry handling, batched abstraction, complete member
coverage, and policy metadata backfill.
- Prevent skill verification and reward retry loops with reverse
trace-policy links, per-policy cooldowns, pending reward handling, and
expanded skill integration coverage.
- Add configurable per-model Redis GCRA rate limiting and preserve LLM
operation metadata through the provider facade.
- Improve preference extraction by filtering polluted sources, refining
prompts, and cleaning up fast-memory fallback behavior.
- Harden OpenClaw compatibility and Hermes installation with environment
detection, provider linking, staged deployment, recovery, and rollback
handling.
- Add documentation, migration support, runtime compatibility checks,
and regression tests across the plugin and core memory components.

## Validation

- pnpm lint passed.
- Targeted Vitest coverage passed: 32 files, 213 tests.
- Local package build and installation passed on macOS OpenClaw and
Hermes.
- Installation and runtime health checks passed on Windows
(192.168.0.75) for OpenClaw and Hermes.
- Installed artifacts were inspected to verify the updated runtime and
pipeline code.

## Scope

- Generated package archives and local temporary directories remain
untracked and are excluded from the commit.
## Summary

- Extend the local-plugin npm registry visibility window from 150
seconds to 360 seconds.
- Keep the normal-release duplicate-version guard strict; existing npm
versions still require explicit recovery after release-owner
verification.
- Make the six-minute default shared by the workflow, shell publisher,
and Node verifier, with regression coverage.

## Why

npm can acknowledge a publish before version, integrity, and dist-tag
metadata are visible through the public registry. The previous
150-second window could fail a release after npm had already accepted
it. This change gives propagation up to six minutes while preserving the
no-second-publish safety behavior.

## Validation

- `node --test
.github/scripts/wait-for-local-plugin-npm-release.test.mjs
.github/scripts/publish-local-plugin.test.mjs
.github/scripts/prepare-memos-release.test.mjs` (94/94)
- `bash -n .github/scripts/publish-local-plugin.sh`
- `git diff --check`

No npm publish, tag creation, GitHub Release, Docs sync, or deployment
was performed by this PR.
Co-authored-by: Cursor <cursoragent@cursor.com>
Playground only kept the first cube in text_mem, so personal memories
were dropped when a knowledge-base cube came first.

Co-authored-by: Cursor <cursoragent@cursor.com>
Relative markdown paths such as images/<hash>.jpg were forwarded to the vision API and rejected as invalid base64.

Co-authored-by: Cursor <cursoragent@cursor.com>
Relative markdown paths such as images/<hash>.jpg were forwarded to the vision API and rejected as invalid base64.

Co-authored-by: Cursor <cursoragent@cursor.com>
Persist summary-material and raw-file neighbor relationships as node metadata so knowledge storage, retrieval deduplication, deletion, merging, and feedback locking remain functional on backends without graph edges. Raw file creation now follows file sources independently of prompt selection.

Constraint: SUMMARY, MATERIAL, PRECEDING, and FOLLOWING edge operations are unavailable on the replacement graph backend.
Rejected: Remove legacy edge helpers | retained unused compatibility code as requested.
Confidence: high
Scope-risk: moderate
Directive: Keep knowledge_material_ids and knowledge_summary_ids bidirectional when adding, merging, or deleting knowledge nodes.
Tested: 10 focused test functions executed directly; Ruff passed on all changed files.
Not-tested: pytest runner crashes with exit 139 in the existing Anaconda environment; uv environment setup timed out fetching lxml.
Persist summary-material and raw-file neighbor relationships as node metadata so knowledge storage, retrieval deduplication, deletion, merging, and feedback locking remain functional on backends without graph edges. Raw file creation now follows file sources independently of prompt selection.

Constraint: SUMMARY, MATERIAL, PRECEDING, and FOLLOWING edge operations are unavailable on the replacement graph backend.
Rejected: Remove legacy edge helpers | retained unused compatibility code as requested.
Confidence: high
Scope-risk: moderate
Directive: Keep knowledge_material_ids and knowledge_summary_ids bidirectional when adding, merging, or deleting knowledge nodes.
Tested: 10 focused test functions executed directly; Ruff passed on all changed files.
Not-tested: pytest runner crashes with exit 139 in the existing Anaconda environment; uv environment setup timed out fetching lxml.

Co-authored-by: 黑布林 <11641432+heiheiyouyou@user.noreply.gitee.com>
RerankerGuo and others added 18 commits October 28, 2026 02:52
validate_key_format exists as a separate copy in two modules — src/memos/api/utils/api_keys.py (canonical home, used by the key-creation utilities) and src/memos/api/middleware/auth.py (the middleware that gates every authenticated request). Both used `int(hex_part, 16)` to verify the 64-char hex tail, which silently passes for:

- a leading `+` or `-` sign (`int("+a..a", 16)` == ...),
- a `0x` / `0X` prefix (`int("0xa..", 16)` == ...),
- `_` separators (PEP 515: `int("a_a", 16)`),
- surrounding whitespace.

So the documented format `krlk_<64-lowercase-hex>` was not actually enforced — keys like `krlk_+a..a`, `krlk_0x..`, or `krlk_a_a` were accepted by the middleware, hashed verbatim, and looked up against the database, bypassing the canonical form that `generate_api_key()` produces.

This commit:

- Replaces the `int(hex_part, 16)` check in the canonical api_keys.py
  implementation with an anchored regex (`[0-9a-f]{64}`) so only the exact
  lowercase 64-hex form is valid.
- Imports the fixed implementation into auth.py and keeps the public
  `validate_key_format` name as a thin re-export, so the middleware
  shares the same logic as the canonical utils copy. This prevents the
  two copies from drifting again — the original bug class.

New tests/api/test_validate_key_format.py covers 21 cases:

- canonical format and `generate_api_key()` output always pass
- 15 non-canonical variants are rejected (signs, 0x prefix, underscore,
  uppercase, whitespace, wrong length, missing prefix, empty)
- both copies (utils and middleware) enforce the same contract

Fixes #2427.
…mit bucket (#2428) (#2490)

## Summary

`_get_client_key` in `src/memos/api/middleware/rate_limit.py` tested
whether `request.headers["Authorization"]` started with `krlk_`, but
real clients send `Authorization: Bearer krlk_<hex>` per RFC 6750. The
prefix check never matched and every request — including ones carrying a
valid API key — fell through to IP-based limiting.

## Root cause

```python
auth_header = request.headers.get("Authorization", "")
if auth_header.startswith("krlk_"):    # ← false for "Bearer krlk_..."
    return f"ratelimit:key:{auth_header[:20]}"
```

Real `Authorization` values are `Bearer <token>`; the `Bearer ` prefix
is what made this branch unreachable. Behind a shared egress IP all
keyed clients shared one bucket and the per-key rate-limit was dead
code.

## Fix

Strip the `Bearer ` scheme (case-insensitive, per RFC 7235) before the
prefix check, so `Bearer krlk_<hex>` correctly maps to
`ratelimit:key:<first 20 of stripped key>`. Backwards compatibility is
preserved: a bare `krlk_<hex>` header still matches.

## Tests

New `tests/api/test_rate_limit_bearer.py`, 7 cases:

1. `test_bearer_krlk_key_uses_per_key_bucket` — red against unpatched
`main`, green with the fix
2. `test_bearer_krlk_key_first_twenty_chars_of_actual_key` — confirms
the key slice
3. `test_lowercase_bearer_scheme` — RFC 7235 case-insensitivity
4. `test_bearer_with_non_key_token_falls_back_to_ip` — non-API-key
Bearer tokens still go to IP
5. `test_missing_authorization_header_falls_back_to_ip`
6. `test_x_forwarded_for_header_preferred_over_ip`
7. `test_krlk_prefix_without_bearer_scheme_still_matches` — backwards
compat

## Verification

```
PYTHONPATH=src pytest tests/api/test_rate_limit_bearer.py -v
============================== 7 passed in 2.50s ==============================
```

Ruff: `ruff format --check` and `ruff check` both clean on the touched
test file; the source file has the same 2 pre-existing BLE001 findings
as on `main` (this PR introduces 0 new lint issues).

## Out of scope

- No new dependencies
- No public API / OpenAPI contract changes
- No DB schema, migration, or graph model changes
- No Makefile / pyproject.toml / pre-commit / GitHub workflow changes

Closes #2428
…#2491)

## Summary

`validate_key_format` exists as a separate copy in two modules. Both
used `int(hex_part, 16)` to verify the 64-char hex tail, which silently
passes for leading signs, `0x` prefixes, `_` separators, and surrounding
whitespace — so the documented format `krlk_<64-lowercase-hex>` was not
actually enforced at the middleware boundary.

## Root cause

Two copies of the same buggy validator:

- `src/memos/api/utils/api_keys.py:48` — used by the key-creation
utilities
- `src/memos/api/middleware/auth.py:65` — gates every authenticated
request

Both check the tail via `int(hex_part, 16)`. CPython accepts:

| input | `int(..., 16)` result |
| ----- | ----------------- |
| `+aaaa…` (64 chars) | valid |
| `0xaaaa…` (62 chars) | valid |
| `aaaa_bbbb…` (with `_`) | valid (PEP 515) |
| ` AAAA…` / `AAAA… ` | valid |

So `krlk_+a..a`, `krlk_0x..`, `krlk_a_a`, `krlk_A..A`, etc. were all
accepted by the middleware, hashed verbatim, and looked up against the
database — bypassing the canonical form that `generate_api_key()`
produces (lowercase, no prefixes, no separators, no signs, no
whitespace).

## Fix

Two changes that together eliminate the bug class:

1. **Canonical validator** — `src/memos/api/utils/api_keys.py`: replace
the `int(hex_part, 16)` check with an anchored regex
`re.fullmatch(r"[0-9a-f]{64}", hex_part)`. Only the exact
64-lowercase-hex form is valid.
2. **Dedup** — `src/memos/api/middleware/auth.py`: import the canonical
implementation under the name `validate_key_format_canonical`, keep the
public symbol `validate_key_format` as a one-line re-export. This
prevents the two copies from drifting again (the original bug class).

## Tests

New `tests/api/test_validate_key_format.py`, 21 cases:

- canonical format and `generate_api_key()` output (20 random samples)
always pass
- 15 non-canonical variants are rejected: signs, `0x` prefix, underscore
separators, uppercase hex, leading/trailing whitespace, wrong length,
missing `krlk_` prefix, `Bearer ` prefix, empty string
- both `utils` and `middleware` copies enforce the same contract

## Verification

```
PYTHONPATH=src pytest tests/api/test_validate_key_format.py -v
============================== 21 passed in 3.31s ==============================
```

Ruff: `ruff format --check` and `ruff check` both clean on touched files
(0 new findings vs `main`; the 3 pre-existing `DTZ`/`datetime.utcnow`
warnings in api_keys.py are out of scope).

## Out of scope

- No new dependencies
- No public API / OpenAPI contract changes
- No DB schema, migration, or graph model changes
- No Makefile / pyproject.toml / pre-commit / GitHub workflow changes

Closes #2427
## Description

Stopping a scheduler that has never initialized RabbitMQ logs
`AttributeError: 'OptimizedScheduler' object has no attribute
'_io_loop_thread'` during API shutdown. This includes local-queue
deployments and initialization skipped in CI. No restart is required to
trigger it.

The constructor initializes `_rabbitmq_io_loop_thread`, but both
`initialize_rabbitmq()` and `rabbitmq_close()` use `_io_loop_thread`.
Initialize the same field in the constructor. The production change is
one line; connection cleanup, thread joins, shutdown ordering, and
exception handling are unchanged. No new dependencies or configuration
are required.

Related issue: N/A; the reproduction and regression tests are included
here.

## Type of change

- [x] Bug fix (non-breaking)

## How Has This Been Tested?

- [x] Unit tests: `pytest tests/mem_scheduler/test_rabbitmq_shutdown.py
-q` — **5 passed**. Without the fix, **3 failed, 2 passed**. Covers
uninitialized/repeated close, CI initialization skip, connection cleanup
with a real IO thread, native optimized-scheduler lifecycle cleanup, and
propagation of unexpected join errors.
- [x] Test steps: isolated API shutdown with RabbitMQ uninitialized,
followed by restart and a second shutdown — both exits were clean;
graph/vector/business snapshots were unchanged. No generation or
embedding requests were made.
- [x] `make format` — all Ruff checks passed; 631 files unchanged.
- [x] Pre-commit checks on both changed files — passed.

Additional directory run: `pytest tests/mem_scheduler/ -q` — **70
passed, 1 skipped, 1 failed**. The existing
`test_dynamic_cache_layers_access` requires PyTorch, which is absent in
the test image; the same failure was reproduced against the unmodified
source. Pytest also warns that the image lacks the asyncio plugin. The
full repository suite was not run.

## Checklist

- [x] Self-reviewed the one-line fix and focused tests.
- [x] Added tests demonstrating the failure and preserving existing
cleanup behavior.
- [x] No documentation/API/schema changes are needed for this internal
field-name correction.
## Description

Fix problems found while investigating #2495: Windows native model
dependencies can conflict with host Sharp/libvips, a recalled memory can
abort a DSH V4 turn, malformed import rows are silently reported as
skipped, and local model source settings are unavailable or ignored.

- Isolate Windows local embeddings in a shared, lazy child process.
Transformers/Sharp/ONNX stay outside the host process; requests,
cancellation and progress use IPC. Remove inherited host preloads,
restart failed children, release the child after the last provider
closes, and reclaim idle processes. macOS/Linux retain the in-process
path. No DLL replacement, production dependency changes or host-version
pinning.
- Give both recall and auxiliary host-LLM messages the producer-owned
`plugin:memos-local-memory` source kind accepted by DSH V4.
- Validate bundle rows before writing, report duplicates/invalid
rows/database failures separately, and roll back a rejected trace
together with any synthetic parents. Keep the existing
`imported`/`skipped` response fields.
- Add write-free import previews, explicit preserve/target-profile
ownership, and active-profile visibility counts. Existing IDs remain
duplicates and sharing scopes are preserved.
- Add local embedding mirror/model/cache directories, offline mode, a
bounded initial wait, and download/load logs. Explicit mirror
configuration overrides `HF_ENDPOINT`; default model caching lives
outside installed package files. Serialize differently configured loads
and restore Transformers' shared environment afterward.
- Expose these options in Viewer Settings/Import, test unsaved local
model settings, and document configuration and import semantics. Remove
an accidental real-model dependency from the Hermes summarizer-status
unit test.

No production dependency or host peer-range changes. V4 regression tests
add the pinned official codec as a dev dependency, align its Cordis dev
peer, and pin existing brand/protocol dev peers; both lockfiles are
updated. Changes are confined to `apps/memos-local-plugin/`.

Related Issue (Required): #2495 (partial follow-up). **Windows
sharp/libvips isolation is now included. Native Windows validation is
pending; keep the issue open until both load orders and the original
long-session case are confirmed on Windows.**

Reviewers: @hijzy and @whipser030 (assigned by the repository).

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [x] Documentation update

## How Has This Been Tested?

Run from the repository root:

```sh
make format
cd apps/memos-local-plugin
npm run lint
npm test
npm run build:package
node node_modules/typescript/bin/tsc --noEmit --strict --target ES2022 --module ES2022 --moduleResolution Bundler --jsx react-jsx --jsxImportSource preact --lib ES2022,DOM --esModuleInterop --skipLibCheck viewer/src/main.tsx
```

Results: Ruff checks passed (630 Python files unchanged); TypeScript,
strict Viewer type checking, and package/Viewer builds passed. Vitest:
**190 test files passed; 1638 tests passed, 3 skipped**. Repository
pre-commit checks passed over the changed files before committing.

- [x] Unit Test — structured world-model round trips (including
evidence/legacy strings), malformed structure, session/episode ownership
conflicts in preview and writes across batches, stable UI/headless
preset ownership, explicit-profile isolation, and backup/transactional
legacy-profile migration; Windows process isolation without host
Transformers import, concurrent response/progress routing, cancellation,
crash/restart, startup/IPC failure, invalid vectors and shared-provider
cleanup; source attribution, real V4 codec admission/encoding for
recall, pre-step inbox batches and host-LLM output, plus rejection of
retired sources; local mirror precedence, offline paths, stable cache,
shared-environment restoration, serialized loads, progress and
timeout/warmup; SQLite import validation, rollback, preview and
ownership.
- [x] Test Script Or Test Steps (please provide) — On macOS with
official DSH **0.2.0-rc.2**, use an isolated DSH profile/data home and
the logged-in `deepseek-flash` account. Load this build, import a
synthetic deployment-region memory, and ask `deployment region` without
including the stored answer. Recall injected the matching memory,
`memos_get` returned its contents, and the model answered the stored
value with a completed turn and no V4 admission error. Restore the
original test installation afterward and verify its hash. A real cached
local model also returned a 384-dimensional embedding in offline mode.
- [x] Pipeline Automated API Test (please provide) —
`tests/unit/server/http.test.ts` verifies import options and
invalid-option responses. An isolated HTTP smoke test verified zero
writes during preview; one valid, one duplicate and one invalid
timestamp row were classified correctly; target ownership made the
imported row visible.

## Checklist

- [x] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [x] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [x] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [x] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用) — N/A: local-plugin configuration and import behavior are
documented in this package's README.
- [x] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [x] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人

## Reviewer Checklist

- [x] Issue linkage and scope reviewed: relates to #2495; keep the issue
open pending native Windows DLL verification.
- [x] Made sure local checks passed; GitHub CI results are tracked
separately on this PR.
- [x] Tests have been provided


### V4 regression coverage

Bridge tests now use the production recall factory and assert
producer-owned source kinds. The published
`@deepseek-ai/dsh-session-format-v3-to-v4@0.2.0-rc.2` validates both
individual messages and the query/recall inbox batch through
`assertV4RowAdmission` and `encodeEvent`. Host-LLM auxiliary messages
pass without `form`; both old source shapes are rejected. A mutation
check restoring `kind: "plugin"` in the real factory made the admission
regression fail with the original error. Tests require no desktop
installation or account.


### Windows isolation validation

- **Cross-platform checks completed:** real Node and official DSH
Electron subprocess smoke tests each returned two concurrent
384-dimensional vectors, with a separate worker PID and no
Sharp/libvips/ONNX native libraries added to the parent process. `npm
pack --dry-run --ignore-scripts` confirmed all three worker runtime
modules are included.
- **Native Windows check pending:** build the branch and run
`scripts/verify-windows-dll-isolation.mjs --host-sharp <host sharp
package path> [--cache-dir <existing model cache>] [--offline]`. The
README includes PowerShell instructions for executing with DSH's
Electron executable when host Sharp is in ASAR. Each load order runs in
a fresh process and verifies both embedding output and real PNG encoding
using host Sharp. No native Windows pass is claimed from macOS.
- Restart DSH completely before testing the plugin; confirm new and long
conversations plus host image processing after local-model
initialization. Electron hosts need
`ELECTRON_RUN_AS_NODE`/`child_process.fork` support; failure does not
fall back to loading native model libraries into the host.


### QA report follow-up

Address the verified findings from the independent QA report:

- Preserve imported world-model `structure`, including labelled evidence
entries and legacy string entries. Reject malformed structures with
field diagnostics instead of silently clearing them.
- Reject traces whose existing/planned episode belongs to another
session or whose parent records belong to another memory owner. Preview
tracks accepted parents across batches and applies the same checks
without writing records.
- Use the configured MemOS `profileId` consistently for DSH recall,
capture, tools and Viewer; `agentPreset` no longer changes memory
ownership. Explicit profiles stay isolated. Older preset-owned records
are not silently merged: the packaged `migrate-dsh-preset-profile.mjs`
tool defaults to read-only preview and requires a new SQLite backup
before an atomic, explicitly scoped move. Skill-name/constraint
conflicts roll back the entire move.
- Clarify that the Viewer button **Repair embeddings** invokes `POST
/api/v1/embeddings/rebuild` with `mode: repair`.

Validation on the final changes: **190 test files passed; 1638 tests
passed, 3 skipped**; `npm run lint`, package/Viewer build, `make format`
(630 Python files unchanged), pre-commit, and npm package-content checks
passed. Added regressions failed against the old implementation before
the fixes. No schema migration or automatic modification of existing
user databases is introduced. Windows native verification remains
pending as documented above.
## Description

Fixes #2550.

PolarDB lightweight vector-search projections can return a numeric user
ID as an already-decoded string. Decoding it again with `json.loads`
turns it into an integer, causing `TextualMemoryItem` validation to fail
and potentially leaving knowledge-base retrieval empty after successful
ingestion.

Preserve identifier strings (including leading zeros), normalize native
integer identifiers to strings, and keep JSON-quoted strings and nulls
compatible. Non-identifier arrays, objects, booleans and numeric values
retain their existing decoding. The identifier field set is a
module-level frozenset, avoiding per-field allocations during recall. No
dependency, schema or route changes.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

- [x] Unit Test: `poetry run pytest tests/graph_dbs/ -q` → 77 passed, 3
skipped.
- [x] Test Script Or Test Steps: `make test` → 1005 passed, 9 skipped;
`make format` and changed-file pre-commit passed.
- [x] Pipeline verification: all 16 Python tests CI jobs passed on final
head `b1a7d5fee60c06923933550c9c9c0755c54e383c` (Linux, Windows, macOS
14/15; Python 3.10–3.13). Live cloud API testing is not applicable
before deployment.

Regression cases exercise a mocked database row through real lightweight
vector search and real recall-item construction, covering digit strings,
native integers, JSON-quoted strings, leading zeros and nulls. Before
the fix, the numeric string/integer cases fail with Pydantic
`metadata.user_id` string-type errors (2 failed, 26 passed); after the
fix, all relevant tests pass. All fixtures are synthetic and external
services are mocked.

## Checklist

- [x] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [x] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [x] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [x] Documentation issue/PR: not applicable; no public API changes.
- [x] I have linked the issue to this PR: #2550.
- [x] Reviewer mentioned: @endxxxx.

## Reviewer Checklist

- [x] Closes #2550.
- [x] Made sure Checks passed — all 16 required CI jobs passed on the
final head.
- [x] Tests have been provided.
## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes #issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## Checklist

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
## Description

DSH 0.2.1 skips the local memory bundle because all six host-service
peers end at `<0.2.0`. Widening that bound alone is insufficient:
prerelease versions need explicit comparator sets, and `JsonValue` is no
longer exported by `dsh-tools` in 0.2.x.

Admit the validated 0.1.7, 0.2.0 and 0.2.1 preview lines with bounded
ranges, keep the merged 2.0.21 V4 message-source implementation, and
replace the moved type with its equivalent local JSON shape. Pin the
development host stack to 0.2.1-rc.3/Cordis ~4.0.5 and synchronize both
npm and pnpm locks. Add an isolated compile/build/adapter-test matrix
and package-range/lockfile regressions. All changes are under
`apps/memos-local-plugin/`; production dependencies are unchanged.
`semver` is an explicit test-only development dependency.

Related Issue: #2520 (local plugin portion), #2538 (remaining peer
compatibility); follows up the remaining work in #2541 on current main.
This does not update the Cloud plugin or close the broader #2520
request. #2541 should be reconciled with this implementation rather than
merging duplicate compatibility changes.

The obsolete 0.1.0-rc.5 API baseline is no longer advertised: the core
packages cannot be retrieved from npm. The installable 0.1.0-rc.6
baseline is tested. A release containing this change is still required;
npm 2.0.21 retains the old version gate.

## Type of change

- [x] Bug fix — DSH startup compatibility and moved JSON type
- [x] Documentation update — compatibility boundaries, upgrade guidance
and validation report

## How Has This Been Tested?

Tests ran on macOS arm64, Node 25.1.0, npm 11.6.2, pnpm 10.21.0. Details
and limitations:
`apps/memos-local-plugin/adapters/deepseek-harness/COMPATIBILITY.md`.

- [x] Unit Test — regressions first failed for four newly targeted
preview versions; final full suite: **191 files passed, 1655 tests
passed, 3 skipped**.
- [x] Test Script — `npm run test:dsh-compat`: **five real DSH API
stacks** (0.1.0-rc.6, 0.1.7-rc.2, 0.2.0-rc.2, 0.2.1-rc.2/rc.3), each
passing type checks, production compilation, and **71 adapter tests**.
Host peers are installed independently and never borrowed from the
checkout.
- [x] Automated API tests — existing HTTP tests passed in the full
suite; the initial sandboxed run hit localhost `listen EPERM`, then the
complete suite passed with local-port access. GitHub CI is pending
separately.

Additional checks: `make format` (all checks passed, 630 files
unchanged), `npm run lint`, `npm run build:package`, `npm ci
--ignore-scripts --no-audit --no-fund`, `npm ls --all`, `npm run
lock:check`, strict frozen pnpm lock check, and pre-commit over every
changed file.

Official DSH 0.2.1-rc.3 CLI A/B smoke in an isolated profile: old peers
produced “incompatible” with no active exemption and omitted the MemOS
row; new peers emitted no compatibility warning and included the row.
Both commands exit 0, so the test inspected the composed tree as well as
stderr. No live profile, credentials or customer sessions were used.
This is a startup-gate check, not an authenticated model conversation
across every Desktop/Web/CLI platform.

## Checklist

- [x] I have performed a self-review of my own code
- [x] I have commented the dependency and prerelease compatibility logic
- [x] I have added tests demonstrating the fix
- [x] Documentation is included in the local plugin
README/COMPATIBILITY.md; no separate MemOS-Docs change is applicable
- [x] Related issues and overlapping PR are linked above
- [x] Reviewers: @hijzy and @whipser030

## Reviewer Checklist

- [x] Scope and issue linkage reviewed: local plugin portion of #2520,
broader issue remains open
- [x] Local checks passed; GitHub CI remains pending for this draft
- [x] Tests and real output provided
## Description

Merge `dev-v2.0.36` into `main` for MemOS v2.0.36. The final
release-branch commit sets both the package version and
`memos.__version__` to `2.0.36`.

This release includes the PostgreSQL graph storage updates (#2531),
knowledge memory and recall changes (#2479, #2436), and fixes for
PolarDB recall (#2551), RabbitMQ shutdown (#2532), API key validation
(#2491), and rate limiting (#2490).

## How Has This Been Tested?

- [x] Unit tests — 24 passed in
`tests/graph_dbs/test_postgres_400_compat.py` and
`tests/mem_scheduler/test_rabbitmq_shutdown.py`.
- [x] Verified that both version fields are `2.0.36`, ran `make format`
and `git diff --check`, and simulated the merge with `main`.

## Checklist

- [x] Reviewed the release diff and the two-file version commit.
- [x] Verified the release branch merges cleanly with the current `main`
locally.
@Memtensor-AI Memtensor-AI added area:api 云服务 / FastAPI / OpenAPI / MCP area:core MOS 编排层 / 框架底座 / 跨模块问题 area:database graph_db + vector_db | 图数据库与向量数据库 area:docs 文档、示例 area:memcube GeneralMemCube / cube 生命周期 / cube 配置 area:memory 记忆存储、检索、更新、召回逻辑 area:model llm + embedder + reranker area:plugin OpenClaw & Hermes area:scheduler 调度模块 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Nov 17, 2026
@endxxxx endxxxx closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:api 云服务 / FastAPI / OpenAPI / MCP area:core MOS 编排层 / 框架底座 / 跨模块问题 area:database graph_db + vector_db | 图数据库与向量数据库 area:docs 文档、示例 area:memcube GeneralMemCube / cube 生命周期 / cube 配置 area:memory 记忆存储、检索、更新、召回逻辑 area:model llm + embedder + reranker area:plugin OpenClaw & Hermes area:scheduler 调度模块 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理

Projects

None yet

Development

Successfully merging this pull request may close these issues.