Repository navigation
fix(reorganizer): optimize all graph tenants, run scheduled jobs, and survive non-JSON LLM output - #2481
Conversation
… survive non-JSON LLM output - enumerate tenants via new get_all_user_names() (Neo4jGraphDB impl + BaseGraphDB fallback) and route both the _reorganize_needed trigger and the schedule jobs through _optimize_all_users(scope), isolating per-tenant failures; backends without the capability keep the previous single-tenant behavior - call schedule.run_pending() in the structure optimizer loop so the registered 100s jobs actually run instead of being dead code - make _parse_json_result return None for anything that is not a valid JSON object and short-circuit _summarize_cluster/_local_subcluster, so a malformed LLM reply skips the cluster instead of crashing the whole optimization round or silently writing empty parent nodes Fixes MemTensor#2480
🤖 Open Code ReviewTarget: PR #2481 ✅ OpenCodeReview: Review complete: 0 finding(s) across 5 selected item(s). Generated by cloud-assistant via Open Code Review. |
|
|
This PR has been automatically marked as stale due to inactivity. |
|
Thanks for the original fix. I pushed follow-up changes in 475be4f and retargeted the PR to the development branch. The update adds explicit tenant scoping and per-tenant failure isolation, gives each reorganizer its own scheduler, preserves triggers received during optimization, and makes shutdown interrupt the scheduler wait. It also preserves literal json text and skips malformed or empty summaries before embedding or writing parent nodes. Regression tests finished with 504 passed and 9 optional integration tests skipped, including four passing native Neo4j cases covering both backends and tenant isolation. |
Description
Graph reorganization previously optimized only the default tenant, while its registered periodic jobs were never executed. Malformed model output could interrupt a cluster or produce an empty parent.
The final implementation covers three areas.
The original contribution history by akushonkamen is retained, with dev-v2.0.37 merged into the PR branch and follow-up regression fixes applied.
Fixes #2480.
Type of change
How Has This Been Tested?
Actual verification output
MEMOS_TEST_REORGANIZE_NEO4J_URI pointed to a disposable Neo4j 5.26.6 instance. All four new native graph cases passed, including parent and PARENT-edge isolation and one tenant receiving non-JSON output. Model/embedding calls and the Community vector client are mocked with synthetic data.
The nine skips are pre-existing opt-in database integrations whose separate service variables were unconfigured. Existing warnings cover deprecated UTC calls, Pydantic serialization and the intentional thread-exception fixture.
Repository pre-commit hooks passed.
Checklist
Reviewer Checklist