Skip to content

fix(memory-core): allow bounded dreaming session cleanup#70464

Closed
chiyouYCH wants to merge 2 commits into
openclaw:mainfrom
chiyouYCH:codex/fix-memory-dreaming-session-cleanup-20260423
Closed

fix(memory-core): allow bounded dreaming session cleanup#70464
chiyouYCH wants to merge 2 commits into
openclaw:mainfrom
chiyouYCH:codex/fix-memory-dreaming-session-cleanup-20260423

Conversation

@chiyouYCH

@chiyouYCH chiyouYCH commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the remaining dreaming narrative session pollution path without changing the Gateway plugin-owned cleanup contract:

  • keep dreaming-narrative-* session keys stable per workspace + phase, instead of embedding nowMs in the session key
  • keep per-run deduplication by moving nowMs into the subagent idempotencyKey
  • pre-clean the stable narrative session before each run so stale prior context cannot leak into the next dream narrative
  • preserve the existing final best-effort cleanup and the current generic plugin-owned sessions.delete behavior; this revision intentionally does not touch src/gateway/*

This is intended to address the cleanup failure and UI/session-store leak reported in #68252, #69187, and #70402 while keeping the fix scoped to bundled memory-core behavior.

Tests

  • API dry-run transform against latest upstream main verified the final PR diff is limited to CHANGELOG.md and extensions/memory-core/src/*.
  • GitHub Actions is the official validation path for this PR branch after rebasing onto latest main.
  • Current check-prod-types / check-test-types failures are inherited from main commit 2e78fc57 in unrelated extensions/codex and extensions/microsoft-foundry files, matching the main-branch CI note on d4e04f33.

Real behavior proof

Behavior or issue addressed: Memory-core dreaming narrative sessions should be bounded by workspace and phase. Repeated dreaming sweeps for the same workspace/phase should reuse the same dreaming-narrative-* session key while still using timestamp-specific idempotency keys so separate sweeps do not dedupe incorrectly. Stale prior narrative context should be removed before the next run.

Real environment tested: Isolated local OpenClaw workspace and session store used while preparing this repair, separate from my normal OpenClaw service. The local smoke used the installed package hotfix path equivalent to this PR's memory-core session-key/idempotency/pre-cleanup behavior.

Exact steps or command run after this patch:

  1. Applied the equivalent memory-core hotfix in the isolated OpenClaw package/workspace.
  2. Probed the narrative session-key builder with the same workspace/phase and different timestamps.
  3. Probed the same phase across different workspaces.
  4. Restarted the isolated OpenClaw gateway and checked daemon health/connectivity.
  5. Deleted existing dreaming-narrative-* sessions through the plugin subagent sessions.delete path and recounted the session store.

Evidence after fix:

openclaw daemon status => running
connectivity=ok
admin_capable=true
stable_key_same_workspace=true
isolated_key_across_workspaces=true
idempotency_key_1=dreaming-narrative-light-<workspace-hash>-1775338800000
idempotency_key_2=dreaming-narrative-light-<workspace-hash>-1775425200000
deleted_session_prefix=dreaming-narrative-
dreaming_session_count=0

Observed result after fix: The narrative session key stayed stable for the same workspace and phase across timestamps, remained different across workspaces, and the isolated session store reached dreaming_session_count=0 after deleting stale dreaming-narrative-* sessions. This confirms the repair bounds session accumulation without removing per-run idempotency.

What was not tested: I did not run a full production dreaming cron sweep against a real user workspace in this PR because that would mutate private memory/dream diary state. The official GitHub Actions matrix covers type, lint, boundary, and unit-test validation for the submitted branch.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime extensions: memory-core Extension: memory-core size: S labels Apr 23, 2026
@greptile-apps

greptile-apps Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes dreaming narrative session leaks by making buildNarrativeSessionKey stable (removing nowMs from the key while preserving it in idempotencyKey), adding a pre-cleanup deleteSession call before each run to evict stale prior-session context, and granting operator.admin scope narrowly to memory-core when deleting its own dreaming-narrative-* sessions with deleteTranscript: true. The scope-gating logic and the three new gateway tests (memory-core allowed, wrong session key blocked, wrong plugin blocked) correctly cover the authorization matrix.

Confidence Score: 5/5

Safe to merge; remaining findings are P2 style improvements that do not block correctness.

The logic for stable session keys, idempotency-key divergence, pre-cleanup, and scoped admin elevation is sound. The new tests correctly validate all three authorization branches. The two open comments are P2: one suggests adding a warn-level log to the silent pre-cleanup catch, the other flags dead-code in the colon-stripping helper that is harmless but could confuse future maintainers. Neither affects runtime correctness.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/memory-core/src/dreaming-narrative.ts
Line: 858-863

Comment:
**Silent pre-cleanup swallows non-404 errors**

The empty `catch` block here discards any error — including auth failures (e.g. if the plugin scope isn't set correctly) or transient network errors — with no log output. A real failure would silently leave stale context in place and start the run in a dirty state, making it very hard to diagnose. Consider logging at `warn` level for unexpected errors while still ignoring expected "not found" cases.

```suggestion
  // Clear stale context from a previous failed cleanup before reusing the stable session key.
  try {
    await params.subagent.deleteSession({ sessionKey });
  } catch (preCleanupErr) {
    // The session may not exist yet; that is expected. Log unexpected errors so
    // they don't vanish silently.
    params.logger.warn(
      `memory-core: pre-cleanup delete failed for ${params.data.phase} phase: ${formatErrorMessage(preCleanupErr)}`,
    );
  }
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/gateway/server-plugins.ts
Line: 254-264

Comment:
**Colon-stripping logic doesn't match current key format**

`buildNarrativeSessionKey` now produces keys like `dreaming-narrative-light-<hash>` — no `:` separators — so `getCanonicalSessionKeySegment` always falls through to `return sessionKey` for these keys. The two-colon namespace-stripping path is dead code for the current key format. If namespaced keys are a future concern, a comment explaining the expected format (`ns1:ns2:dreaming-narrative-...`) would make the intent clearer and prevent future maintainers from removing what looks like unreachable logic.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(memory-core): allow bounded dreaming..." | Re-trigger Greptile

Re-review progress:

Comment on lines +858 to +863
// Clear stale context from a previous failed cleanup before reusing the stable session key.
try {
await params.subagent.deleteSession({ sessionKey });
} catch {
// The session may not exist yet, and narrative generation is best-effort.
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Silent pre-cleanup swallows non-404 errors

The empty catch block here discards any error — including auth failures (e.g. if the plugin scope isn't set correctly) or transient network errors — with no log output. A real failure would silently leave stale context in place and start the run in a dirty state, making it very hard to diagnose. Consider logging at warn level for unexpected errors while still ignoring expected "not found" cases.

Suggested change
// Clear stale context from a previous failed cleanup before reusing the stable session key.
try {
await params.subagent.deleteSession({ sessionKey });
} catch {
// The session may not exist yet, and narrative generation is best-effort.
}
// Clear stale context from a previous failed cleanup before reusing the stable session key.
try {
await params.subagent.deleteSession({ sessionKey });
} catch (preCleanupErr) {
// The session may not exist yet; that is expected. Log unexpected errors so
// they don't vanish silently.
params.logger.warn(
`memory-core: pre-cleanup delete failed for ${params.data.phase} phase: ${formatErrorMessage(preCleanupErr)}`,
);
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/memory-core/src/dreaming-narrative.ts
Line: 858-863

Comment:
**Silent pre-cleanup swallows non-404 errors**

The empty `catch` block here discards any error — including auth failures (e.g. if the plugin scope isn't set correctly) or transient network errors — with no log output. A real failure would silently leave stale context in place and start the run in a dirty state, making it very hard to diagnose. Consider logging at `warn` level for unexpected errors while still ignoring expected "not found" cases.

```suggestion
  // Clear stale context from a previous failed cleanup before reusing the stable session key.
  try {
    await params.subagent.deleteSession({ sessionKey });
  } catch (preCleanupErr) {
    // The session may not exist yet; that is expected. Log unexpected errors so
    // they don't vanish silently.
    params.logger.warn(
      `memory-core: pre-cleanup delete failed for ${params.data.phase} phase: ${formatErrorMessage(preCleanupErr)}`,
    );
  }
```

How can I resolve this? If you propose a fix, please make it concise.

Comment thread src/gateway/server-plugins.ts Outdated
Comment on lines +254 to +264
function getCanonicalSessionKeySegment(sessionKey: string): string {
const firstSeparator = sessionKey.indexOf(":");
if (firstSeparator < 0) {
return sessionKey;
}
const secondSeparator = sessionKey.indexOf(":", firstSeparator + 1);
if (secondSeparator < 0) {
return sessionKey;
}
return sessionKey.slice(secondSeparator + 1);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Colon-stripping logic doesn't match current key format

buildNarrativeSessionKey now produces keys like dreaming-narrative-light-<hash> — no : separators — so getCanonicalSessionKeySegment always falls through to return sessionKey for these keys. The two-colon namespace-stripping path is dead code for the current key format. If namespaced keys are a future concern, a comment explaining the expected format (ns1:ns2:dreaming-narrative-...) would make the intent clearer and prevent future maintainers from removing what looks like unreachable logic.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server-plugins.ts
Line: 254-264

Comment:
**Colon-stripping logic doesn't match current key format**

`buildNarrativeSessionKey` now produces keys like `dreaming-narrative-light-<hash>` — no `:` separators — so `getCanonicalSessionKeySegment` always falls through to `return sessionKey` for these keys. The two-colon namespace-stripping path is dead code for the current key format. If namespaced keys are a future concern, a comment explaining the expected format (`ns1:ns2:dreaming-narrative-...`) would make the intent clearer and prevent future maintainers from removing what looks like unreachable logic.

How can I resolve this? If you propose a fix, please make it concise.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb05821040

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/gateway/server-plugins.ts Outdated
deleteTranscript,
},
{
syntheticScopes,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply synthetic delete scope with request-scoped clients

This syntheticScopes override does not take effect for the common plugin-hook path where a request scope already has client set, because dispatchGatewayMethod prefers scope.client over synthetic client construction. In those runs (all gateway handlers are wrapped with request scope in src/gateway/server-methods.ts), memory-core still hits missing scope: operator.admin on sessions.delete, so the new stable dreaming-narrative-* key can keep reusing uncleared session state and reintroduce narrative/session pollution.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f228ca913d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/gateway/server-plugins.ts Outdated
deleteTranscript,
},
{
syntheticScopes,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply cleanup admin scope to request-scoped clients

deleteSession now computes syntheticScopes, but this option is ineffective whenever a request scope already has client because dispatchGatewayMethod prefers scope.client over synthetic client creation. Fresh evidence: gateway handlers run inside withPluginRuntimeGatewayRequestScope({ context, client, ... }) in src/gateway/server-methods.ts:174, so plugin calls typically carry a non-admin scope.client; in that path, memory-core dreaming cleanup still invokes sessions.delete without operator.admin and fails with missing scope: operator.admin, leaving the stable dreaming-narrative-* session uncleared.

Useful? React with 👍 / 👎.

@chiyouYCH
chiyouYCH force-pushed the codex/fix-memory-dreaming-session-cleanup-20260423 branch from f228ca9 to c4f77d9 Compare April 23, 2026 04:15
@prtags

prtags Bot commented Apr 23, 2026

Copy link
Copy Markdown

Related work from PRtags group honest-kangaroo-d8gt

Title: Open PR candidate: memory-core dreaming-narrative session leak cleanup

Number Title
#67023 fix(memory-core): prevent dreaming-narrative session leaks (#66358)
#68364 fix: prevent unbounded narrative session growth by stabilizing session key (#68354)
#70464* fix(memory-core): allow bounded dreaming session cleanup

* This PR

@clawsweeper

clawsweeper Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The PR changes memory-core Dreaming narrative cleanup to use stable workspace/phase session keys, timestamped idempotency keys, pre-run deleteSession cleanup, focused tests, and a changelog entry.

Reproducibility: yes. at source level. Current main still embeds nowMs in Dreaming narrative session keys, reuses the same value as the idempotency key, and has no pre-run cleanup before starting a narrative attempt.

PR rating
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Summary: The patch is focused and supported by source evidence, targeted tests, and supplied runtime output, with mergeability proof still pending.

Rank-up moves:

  • Resolve the current-main conflict and rerun the changed validation gate before merge.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Sufficient (live_output): The PR body includes after-fix live output from an isolated OpenClaw workspace showing stable keys, distinct idempotency keys, daemon connectivity, and zero Dreaming sessions after cleanup.

Risk before merge

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused memory-core stable-key and pre-cleanup fix after resolving current-main conflicts and rerunning validation, while leaving trajectory-sidecar and restart-residue cleanup to Bug: memory-core Dreaming cleanup still leaves narrative session trajectory residue on 2026.5.3-1 #77723 and Dreaming: spawned sessions not cleaned up after Gateway restart #78458.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
No automated repair is needed from this review; a maintainer or contributor needs to resolve the branch conflict and rerun current-main validation.

Security
Cleared: The diff is limited to memory-core source/tests and changelog text, with no dependency, workflow, release, secret-handling, or permission-surface changes.

Review details

Best possible solution:

Land the focused memory-core stable-key and pre-cleanup fix after resolving current-main conflicts and rerunning validation, while leaving trajectory-sidecar and restart-residue cleanup to #77723 and #78458.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level. Current main still embeds nowMs in Dreaming narrative session keys, reuses the same value as the idempotency key, and has no pre-run cleanup before starting a narrative attempt.

Is this the best way to solve the issue?

Yes. Stable workspace/phase session keys plus timestamped idempotency keys and plugin-local pre-cleanup are the narrow maintainable fix, and the latest branch preserves the existing gateway cleanup contract.

Label justifications:

  • P1: The PR addresses a memory-core Dreaming session leak that related reports tied to session-store bloat, UI pollution, and gateway availability problems for affected users.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🦞 diamond lobster, patch quality is 🐚 platinum hermit, and The patch is focused and supported by source evidence, targeted tests, and supplied runtime output, with mergeability proof still pending.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix live output from an isolated OpenClaw workspace showing stable keys, distinct idempotency keys, daemon connectivity, and zero Dreaming sessions after cleanup.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live output from an isolated OpenClaw workspace showing stable keys, distinct idempotency keys, daemon connectivity, and zero Dreaming sessions after cleanup.

What I checked:

  • Current main still uses unbounded timestamped session keys: startNarrativeRunOrFallback passes params.sessionKey as the idempotency key, and buildNarrativeSessionKey still includes params.nowMs, so each sweep can allocate a fresh dreaming-narrative-* key instead of a bounded workspace/phase key. (extensions/memory-core/src/dreaming-narrative.ts:212, a13468320c63)
  • Current main lacks pre-run cleanup: generateAndAppendDreamNarrative builds the attempt key and starts the narrative run directly; cleanup only happens later in the final best-effort block for attempts with a recorded run id. (extensions/memory-core/src/dreaming-narrative.ts:894, a13468320c63)
  • Existing gateway delete contract supports the scoped boundary: Current main already routes plugin subagent deleteSession through plugin-owned synthetic admin options, which supports keeping this PR scoped to memory-core rather than reworking gateway authorization again. (src/gateway/server-plugins.ts:532, a13468320c63)
  • PR head implements the intended stable-key repair: PR head moves nowMs into idempotencyKey, removes it from buildNarrativeSessionKey, and pre-cleans each stable attempt session key while suppressing expected request-scoped pre-cleanup failures. (extensions/memory-core/src/dreaming-narrative.ts:212, 3b858f84b987)
  • PR tests cover stable keys, per-run idempotency, and cleanup attempts: The PR-head narrative tests assert stable workspace/phase session keys, timestamped idempotency keys, pre-cleanup plus final cleanup call counts, retry cleanup, and request-scoped warning suppression. (extensions/memory-core/src/dreaming-narrative.test.ts:618, 3b858f84b987)
  • Sweep-level PR tests cover the changed behavior: The PR-head phase tests assert the stable key is deleted before and after a sweep run and that request-scoped pre-cleanup failures do not produce noisy warnings. (extensions/memory-core/src/dreaming-phases.test.ts:278, 3b858f84b987)

Likely related people:

  • chiyouYCH: Authored the earlier merged Dreaming narrative leak cleanup and authored this focused stable-key/pre-cleanup follow-up on the same memory-core path. (role: prior cleanup contributor and likely follow-up owner; confidence: high; commits: 2055e75f9ff6, 8b169f8c5cd7, 3b858f84b987; files: extensions/memory-core/src/dreaming-narrative.ts, extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/dreaming-narrative.test.ts)
  • jalehman: Authored several commits in the merged Dreaming leak cleanup branch and posted the squash-merge note for that earlier cleanup PR. (role: adjacent cleanup contributor and merger; confidence: high; commits: 4aa4f778e301, 4dcb0c2c4c58, 51f72b200c3a; files: extensions/memory-core/src/dreaming-narrative.ts, extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/dreaming-phases.test.ts)
  • serkonyc: Authored the merged Dreaming narrative cleanup hardening PR that added explicit cleanup warnings and scrubber coverage in the same implementation and tests. (role: cleanup hardening contributor; confidence: medium; commits: c07ee0ecc94e, 079eb18bf73b; files: extensions/memory-core/src/dreaming-narrative.ts, extensions/memory-core/src/dreaming-narrative.test.ts)
  • KeWang0622: Authored the merged detached Dreaming narrative concurrency limiter that changed the same narrative and phase call path involved in cleanup behavior. (role: recent adjacent contributor; confidence: medium; commits: 746feb7fcc46, b4e9f1bd1c95; files: extensions/memory-core/src/dreaming-narrative.ts, extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/dreaming-narrative.test.ts)
  • steipete: Recent path history shows multiple memory-core and gateway session-runtime touches around Dreaming retries, helper exports, and gateway method dispatch contracts. (role: recent adjacent contributor; confidence: medium; commits: a644e3024543, f3d2ae895a26, dfeaf6f7cf30; files: extensions/memory-core/src/dreaming-narrative.ts, src/gateway/server-plugins.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against a13468320c63.

@chiyouYCH
chiyouYCH force-pushed the codex/fix-memory-dreaming-session-cleanup-20260423 branch from 7a9e42c to 095cf08 Compare April 29, 2026 09:52
@chiyouYCH
chiyouYCH force-pushed the codex/fix-memory-dreaming-session-cleanup-20260423 branch from 095cf08 to db2852f Compare May 7, 2026 07:12
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed gateway Gateway runtime triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 7, 2026
@chiyouYCH

Copy link
Copy Markdown
Contributor Author

Updated this branch to match the narrower repair requested by review.

Current state:

  • Rebased/rebuilt the PR diff from latest main-at-update and removed the earlier src/gateway/* authorization changes.
  • Current diff is limited to CHANGELOG.md plus extensions/memory-core/src/dreaming-narrative*.ts / dreaming-phases.test.ts.
  • Preserves the existing generic plugin-owned sessions.delete contract; memory-core now stabilizes the narrative session key, keeps nowMs in the idempotency key, and pre-cleans the stable session before a run.
  • Real behavior proof now passes and the PR has proof: supplied.

CI note: the remaining failing checks I can inspect are inherited from current main around extensions/codex / extensions/microsoft-foundry auth-profile typing after the aws-sdk auth-profile change. They are outside this PR diff and match the main-branch CI note on d4e04f33.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@chiyouYCH
chiyouYCH force-pushed the codex/fix-memory-dreaming-session-cleanup-20260423 branch from d322ebb to 8b169f8 Compare May 8, 2026 07:57
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@chiyouYCH

Copy link
Copy Markdown
Contributor Author

Updated the branch to address the latest ClawSweeper fix-required item.

What changed:

  • Suppress expected RequestScopedSubagentRuntimeError failures from narrative pre-cleanup before the local request-scoped fallback path.
  • Keep warnings for unexpected pre-cleanup failures.
  • Added focused assertions for rejected and synchronous request-scoped pre-cleanup failures.

Local validation:

  • node scripts/run-vitest.mjs extensions/memory-core/src/dreaming-narrative.test.ts extensions/memory-core/src/dreaming-phases.test.ts => pass, 2 files / 86 tests.
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/memory-core/src/dreaming-narrative.ts extensions/memory-core/src/dreaming-narrative.test.ts extensions/memory-core/src/dreaming-phases.test.ts => pass.
  • pnpm check:changed => pass.

Note: node scripts/crabbox-wrapper.mjs run --shell -- "pnpm check:changed" could not execute in this local environment because the crabbox binary is unavailable and failed wrapper sanity checks; I ran the underlying pnpm check:changed successfully after syncing local dependencies with pnpm install --frozen-lockfile.

@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 19, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Neon Clawlet

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: keeps receipts.
Image traits: location branch lighthouse; accessory green check lantern; palette moonlit blue and soft silver; mood sleepy but ready; pose stepping out of a freshly hatched shell; shell soft velvet shell; lighting soft studio lighting; background small green status lights.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Neon Clawlet in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@Takhoffman

Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 21, 2026
@clawsweeper

clawsweeper Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

🦞🔧
ClawSweeper automerge is enabled.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-05-21 03:52:03 UTC review queued 3b858f84b987 (queued)

@clawsweeper

clawsweeper Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper 🐠 reef update

Thanks for the work on this. ClawSweeper could not push to this branch with the permissions available, so it opened a narrow replacement PR to keep the fix swimming forward without losing the contributor trail. not your fault, just GitHub branch-permission tides.

Why replacement: ClawSweeper could not update the source PR branch directly; GitHub did not grant sufficient push rights to the bot for that branch.
Replacement PR: #84802
Why close: this run explicitly closes the superseded source PR after the credited replacement PR is open, so review continues in one place.
This source PR is being closed only under the explicit source-close setting for this ClawSweeper run.
Contributor credit is carried into the replacement PR body and changelog plan.
Co-author credit kept:

fish notes: model gpt-5.5, reasoning high; reviewed against c752d0f.

@clawsweeper clawsweeper Bot closed this May 21, 2026
zqchris added a commit to zqchris/openclaw that referenced this pull request May 22, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request May 27, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request May 28, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request May 31, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request Jun 4, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request Jun 10, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request Jun 12, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request Jun 17, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request Jun 21, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
zqchris added a commit to zqchris/openclaw that referenced this pull request Jun 25, 2026
Add `plugins.entries.memory-core.config.dreaming.excludeAgents` so
specific agent ids can be kept out of scheduled dreaming workspace
fan-out while their normal memory and transcripts remain intact.

Motivation: email/messaging agents that handle every inbound message
(e.g. an email triage agent on a Gmail hook session like
`agent:email:hook:gmail:triage`) feed reactive content into dreaming
that is too noisy and frequently mis-classified — a marketing
invitation read as a personal interest, an unsolicited promo absorbed
as the user's preference. v2026.5.20's built-in cron-session filter
(`cronRunTranscriptPaths`, scoped to session keys matching
`cron:<jobId>:run:<runId>`) does not cover these channel-inbound
sessions, so an agent-id-level opt-out is needed in addition.

- src/memory-host-sdk/dreaming.ts: add `excludeAgents: string[]` to
  MemoryDreamingConfig, a `normalizeAgentIdArray` helper, and a
  resolveMemoryDreamingWorkspaces filter that drops excluded agent
  workspaces before fan-out.
- extensions/memory-core/openclaw.plugin.json: configSchema +
  uiHints entry for `dreaming.excludeAgents`.
- src/memory-host-sdk/dreaming.test.ts: covers the workspace filter.

This is the agent-exclusion half of the original Chris patch (May 5
v2026.5.5-era); the cron-session-exclusion half was upstreamed in
v2026.5.20 via openclaw#70464 and is intentionally not duplicated here.

Upstream PR candidate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge extensions: memory-core Extension: memory-core P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants