feat: dreaming engine with scope isolation and embedded reflections#799
feat: dreaming engine with scope isolation and embedded reflections#799jlin53882 wants to merge 4 commits into
Conversation
Co-authored-by: Andy Ye <andy@Andys-MacBook-Pro-2.local>
… tests Clean implementation addressing all reviewer feedback from PR CortexReach#592: MR1 — Scope isolation: Each phase filters store.list() by scope. Dreaming runs per-scope using scopeManager.getAllScopes(). MR2 — REM reflection loop prevention: Reflections tagged with metadata.source = 'dreaming-engine' and excluded from all phase inputs. F2 — REM reflections now embedded via embedder.embed() instead of vector: []. Falls back to zero-vector on embedding failure. F3 — DEFAULT_DREAMING_CONFIG + mergeDreamingConfig() provides null-safe deep merge. Minimal config { enabled: true } works. F6 — Removed unimplemented fields (storageMode, separateReports, timezone) from schema. Only runtime-active fields exposed. Also includes: - 8 unit tests covering MR1, MR2, F2, F3, all 3 phases, error resilience - Dreaming wired inside async start() callback (fixes ParseError) - Cron scheduler with per-scope execution - DREAMS.md report generation per scope # Conflicts: # openclaw.plugin.json
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86e5ddb48a
ℹ️ 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".
| { group: "cli-smoke", runner: "node", file: "test/functional-e2e.mjs" }, | ||
| { group: "storage-and-schema", runner: "node", file: "test/per-agent-auto-recall.test.mjs", args: ["--test"] }, | ||
| { group: "core-regression", runner: "node", file: "test/retriever-rerank-regression.mjs" }, | ||
| { group: "core-regression", runner: "node", file: "test/upgrader-compactor-rerank-fixes.test.mjs" }, |
There was a problem hiding this comment.
Point the CI manifest at an existing test
This new manifest entry references test/upgrader-compactor-rerank-fixes.test.mjs, but that file is not present (I checked the repo with find test scripts src ...), so node scripts/verify-ci-test-manifest.mjs now fails with missing test file on disk, and scripts/run-ci-tests.mjs --group core-regression will also fail when it tries to spawn this path. This blocks the packaging/workflow test path instead of registering the new dreaming test.
Useful? React with 👍 / 👎.
| } | ||
| // Flush and destroy AccessTracker on plugin stop | ||
| try { | ||
| if (accessTracker) { |
There was a problem hiding this comment.
Keep the access tracker reachable for shutdown
When the service stop hook runs, accessTracker is not in this scope because it was declared locally inside _initPluginState() and is not returned in the singleton state. In the transpiled runtime this if (accessTracker) throws a ReferenceError that is caught here, so destroy() never runs and any debounced access-count flush/timer can be left behind after plugin shutdown.
Useful? React with 👍 / 👎.
Summary
Rebuild of PR #752 with targeted
openclaw.plugin.jsonchanges — no more block-replace noise.What changed
openclaw.plugin.jsonsrc/dreaming-engine.tstest/dreaming-engine.test.tsindex.tsscripts/ci-test-manifest.mjsPrevious issue (fixed here)
Commit
3212c3ain the original PR replaced the entireopenclaw.plugin.jsonblock, accidentally removing:memoryReflection.excludeAgentsmemoryReflection.serialCooldownMsautoRecallBadRecallDecayMsautoRecallSuppressionDurationMsThis rebuild uses targeted diff instead, preserving all existing fields.
Test coverage
store.list()by scope)metadata.source = 'dreaming-engine'exclusion)embedder.embed()DEFAULT_DREAMING_CONFIG+mergeDreamingConfig()null-safe deep mergeBreaking change note
index.ts:2034callsapi.registerMemoryCapability(...)unconditionally. Requires OpenClaw host that provides this API. Will crash on older hosts.