Repository navigation
fix(memory): explain unpromoted candidates in dreaming reports - #145458
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 12, 2026, 9:18 AM ET / 13:18 UTC (Revision 8). ClawSweeper reviewWhat this changesAdds bounded rejection-category counts to scheduled memory dreaming reports, with documentation and regression coverage. Merge readiness⛔ Blocked before merge - 1 item remains Keep open as useful, well-supported work with no actionable patch defects. Current main still lacks the report explanation, and the earlier migration blocker is inapplicable because the new category is returned diagnostic data, not persisted state. Priority: P2 Review scores
Verification
How this fits togetherMemory Core's scheduled dreaming process ranks recalled information and applies promotion checks before updating MEMORY.md. Its human-readable reports summarize the results for operators. flowchart TD
A[Scheduled dreaming run] --> B[Rank recalled information]
B --> C[Promotion checks]
C --> D[Accepted memories]
D --> E[MEMORY.md]
C --> F[Rejection categories]
F --> G[Dreaming report]
D --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +60, Tests +156, Docs +5. Total +221 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep rejection classification with the promotion owner and expose only aggregate counts through the existing report writer, preserving eligibility rules and stored recall data. Do we have a high-confidence way to reproduce the issue? Yes: current main discards available rejection diagnostics when constructing the deep report, so a ranked candidate rejected during apply produces unexplained totals. Source inspection establishes this path; this review did not execute it. Is this the best way to solve the issue? Yes: typed categories reuse the existing rejection owner and report writer without parsing detailed reasons or duplicating eligibility policy. The prior migration request does not apply to this returned diagnostic field. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bce88774daa4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
495e0ca to
c2e48b8
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…law#145458) * fix(memory): explain unpromoted candidates in dreaming reports * fix(memory): use nonmutating report category sorting * fix(memory): classify removed promotion candidates --------- Co-authored-by: migelizaga-rgb <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
Related: #121232
What Problem This Solves
Resolves a problem where operators reading a scheduled deep dreaming report see ranked candidates and zero promotions without an explanation of why promotion rejected them. Mixed outcomes also omit the reasons for candidates that were not promoted.
Why This Change Was Made
The promotion owner now records a fixed rejection category alongside each existing detailed reason. The existing deep report aggregates those categories into one bounded line, such as
Not promoted: 2 candidate(s) (consolidation origin/session: 2).This preserves promotion gates, gate order, and existing CLI reason text while keeping rejected snippets, source identifiers, and threshold values out of the new summary.The summary covers ranked candidates that reach the applier. It does not explain records excluded during ranking, and late revalidation retains a general
candidate changedreason. This addresses the diagnostic portion of #121232, not every eligibility concern in that issue. No new storage, configuration, or schema is introduced.User Impact
Operators can distinguish promotion filters from a lack of candidates and investigate the recorded cause without weakening promotion rules. Empty sweeps continue to avoid creating memory or dreaming files.
Evidence
ui/src/pages/new-session/cloud-target.ts:renderCloudConfigurationandrenderConnectMachineMenuItem. Running the same scan with this entire patch reversed reproduced the identical failures on base34cdbaf303542717f5521ef4da504d57e20b644c; the reviewed commit was then restored exactly. These baseline failures are not treated as a passing aggregate check.toSorted()lint correction was followed by another passing run of all 34 dreaming tests and a formatting check.Real scheduled runtime proof (pre-rebase head, unchanged patch)
On September 12, 2026 at 01:46:00 UTC, the actual Gateway scheduler ran the plugin-managed
Memory Dreaming Promotioncron job in an isolated local setup. The supportedpnpm openclawlauncher built commit495e0ca616ecce79cec04c2a7b9cf1985fb8f2bd(OpenClaw 2026.9.4). This was a natural minute-boundary execution, notautomations run, a test scheduler, a mocked plugin API, or a direct hook invocation.Setup: isolated home/config/state/workspace, loopback-only Gateway, no credentials, no channels configured, and delivery mode
none. Light, REM, and deep phases stayed enabled with normal promotion thresholds (minimum score 0.75, three recalls, three queries). The only schedule change in this isolated fixture wasdreaming.frequency: "* * * * *"; separate phase reports were enabled. A preparation script used the real recall/state owners to seed one synthetic session-corpus candidate with 12 distinct recalls and explicit agent/cron provenance. It did not call promotion or the report writer. The real phases then ingested, repaired, ranked, applied, and wrote the report.Actual deep report:
The native automation receipt recorded
action: finished,status: ok,completionStatus: succeeded, duration 1016 ms, anddeliveryStatus: not-requested. The synthetic MEMORY.md remained byte-for-byte equal to its initial content. The isolated Gateway was stopped after capturing the receipt/report, and its listening port was verified closed.Limit: narrative generation logged missing-auth fallbacks for light/REM and
Async work scope is closedfor deep. This is proof of the real scheduled rejection report, not successful LLM narratives, all-green health, or production acceptance. No credentials were added to mask these outcomes.Data compatibility
This patch does not change a persistent data model:
categorybelongs to the returned rejection diagnostic, not a recall record or SQLite row. The existing store writer still persistslatestStore; the rejection objects are constructed separately in the return value. Schema, migrations, table definitions, namespaces, embedding metadata, config shape, and stored-record types are unchanged by the seven-file diff. Existing detailedreasonvalues remain unchanged; CLI JSON gains an additive category field and textual CLI output keeps usingreason.The real run retained schema version 17. Inspecting its 21 stored memory-core values found zero
categorykeys. A consolidated SQLite backup passed the supported read-onlydatabase preflightcommand withstatus: exact, target/found version 17, no issues, andrequiresWrite: false. This verifies the diagnostic does not require a new migration; it does not claim compatibility of unrelated changes between older releases and this checkout.Prior CI failures outside this patch
CI run 34663155555 evaluated synthetic merge
dd81cc424ef4ad8307c1eabddf50c3dfd362e0bdagainst upstream6983dd95cb1f8606423df72cfa8819866dad156d; its diff against that upstream parent contains only these seven dreaming files. Three UI checks fail:cloud-target.tsexports described above; identical failure reproduced with the whole patch reversed to its base.where-chip.test.tshas 1020 lines, exceeding 1000. The targeted lint command reproduces the same error locally.new-session.csshas unconditional pointer selector.new-session-page__touch-details. The exact cursor-policy test reproduces it locally.The relevant UI inputs were not changed by this PR or by the four intervening upstream commits since its original base. The aggregate CI gate is failing; these findings are documented, not waived or counted as passing checks.
Rebase and maintainer follow-up
Rebased onto upstream
dda647045420956f7900180c5ca32d457dbc4973, which contains the upstream UI repairs for the preceding CI failures. The contributor patch remained identical throughc2e48b8a3bd6fcf9e4b88484934eea6e6e0c90fa; all 295 focused tests and the complete selected changed-file check passed there, including both typecheck lanes, lint, dead-export scans, and storage/import guards.Current head:
610be988d614c9deaf7b8eaaea981b7dbb4a4068. An independent autoreview found one adjacent classification defect: when the rankedlatestrecall disappeared before consolidation, the rejection was reported asconsolidation origin/sessioneven though its provenance had not failed. The maintainer follow-up now classifies that race ascandidate changed. Its regression failed on the prior implementation and passes on this head. The two focused files pass 123 tests, and the native focused review-test gate passes. This changes only returned diagnostics; it does not change promotion eligibility, storage, schema, configuration, or the report bound.Exact-head hosted CI run 34694214855 completed successfully on
610be988d614c9deaf7b8eaaea981b7dbb4a4068.The runtime captures remain explicitly attributed to the SHAs that executed them.
Pre-follow-up scheduled proof
Repeated the supported real Gateway flow on
c2e48b8a3bd6fcf9e4b88484934eea6e6e0c90fa, reusing the isolated synthetic state created and exercised by the previous build. The scheduler naturally started the run at 2026-09-12T03:53:59.831Z and completed in 798 ms (status: ok,completionStatus: succeeded,deliveryStatus: not-requested). The deep report again recorded 1 ranked, 0 promoted, and 1 consolidation origin/session rejection. MEMORY.md remained byte-for-byte unchanged and the state schema remained 17. The same disclosed narrative fallbacks occurred; the isolated Gateway was stopped after capture. This pre-follow-up runtime proof confirms that the previous build's synthetic state is readable without inventing a migration for the diagnostic field.ClawSweeper disposition
The exact-head ClawSweeper review found no actionable patch defect and accepted the real behavior proof. Its remaining
Add data-model compatibility proofcheckbox is skipped as inapplicable because the same review verifies the actual boundary:categoryexists only on returned rejection diagnostics, whilelatestStoreremains the persisted value and stored recall records are unchanged. The schema-17 inspection, zero persistedcategorykeys, and exact read-only database preflight above provide the relevant compatibility evidence. No migration or unrelated persistence change is warranted.