Skip to content

fix(memory-core): keep live reindex of reset/deleted session archives#96132

Merged
steipete merged 3 commits into
openclaw:mainfrom
yetval:fix/memory-archive-live-reindex
Jul 22, 2026
Merged

fix(memory-core): keep live reindex of reset/deleted session archives#96132
steipete merged 3 commits into
openclaw:mainfrom
yetval:fix/memory-archive-live-reindex

Conversation

@yetval

@yetval yetval commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users who reset or delete a session could not find the archived conversation through live memory search until the gateway restarted. Reset/deleted transcript archives emit a session update, but memory-core discarded archive-file updates before its existing delta/index scheduling path could process them.

Why This Change Was Made

The session listener is the live bridge between transcript archive creation and memory indexing. Current main returns early for archive paths even though processSessionDeltaBatch explicitly handles usage-counted reset/deleted archives and schedules an immediate session sync.

This patch admits only usage-counted session transcript filenames from the current agent's sessions directory. Reset/deleted archives now reach the existing scheduleSessionDirty and archive-delta path, while backup, trajectory, metadata, outside-agent, and unrecognized archive artifacts remain rejected or use the existing corpus fallback. The regression coverage lives in the existing session-sync harness and exercises the real listener, five-second debounce, dirty state, sync scheduling, and archive content indexing.

PR #76666 remains separate: it addresses complementary listener-attachment timing rather than this archive-classification regression.

User Impact

Reset and deleted conversations become eligible for memory indexing while the gateway is still running, instead of remaining invisible until restart or manual reindex. There is no configuration, schema, dependency, or provider-routing change.

Evidence

Accepted exact head: 4b72c0196855261e38757a47122f09733d86f5ad.

  • node scripts/run-vitest.mjs extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts: 1 file, 21 tests passed.
  • node scripts/run-vitest.mjs extensions/memory-core/src/memory/index.test.ts -t 'forces a rebuild after incremental writes while vectors are disabled': 1 passed.
  • node scripts/run-vitest.mjs extensions/memory-core/src/memory/manager.legacy-migration-cleanup.test.ts: 1 passed.
  • oxfmt --check, oxlint, and git diff --check on the touched files: clean.
  • Codex autoreview: both the runtime branch diff and the CI repair diff completed clean with no accepted/actionable findings.
  • Focused before/after proof from the original regression validation: restoring the archive guard left reset/deleted updates out of the pending queue; this head queues each archive, marks it dirty after the debounce, schedules { reason: "session-delta" }, and indexes the archive content through the existing session sync path.
  • Exact-head CI initially exposed two migrated-config fixture failures in the selected memory shard. The test-only repair forwards the canonical memory.search configuration, passes the vector-enabled option through the fixture, limits the cleanup fixture to memory sources, and seeds the preexisting vector index as clean. Both failed tests pass locally after the repair.
  • Exact-head hosted CI is tracked on this PR and must be green before merge.

What was not tested: no live embedding-provider request or end-to-end memory_search query was issued. The focused harness reaches the production listener, debounce, archive selection, and indexing-content path while replacing the final provider write with its existing capture.

@clawsweeper

clawsweeper Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 9:25 PM ET / 01:25 UTC.

Summary
The PR removes memory-core's listener-level archive-file early return and adds a regression test proving reset/deleted transcript archive emits reach live dirty/sync scheduling.

PR surface: Source -3, Tests +153. Total +150 across 2 files.

Reproducibility: yes. Source inspection shows current main returns before scheduling archive session files, while the later delta batch explicitly handles usage-counted reset/deleted archives; the PR body also provides before/after terminal proof for that listener scheduling path.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: persistent cache schema: extensions/memory-core/src/memory/manager-sync-ops.archive-live-index.test.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-sync-ops.archive-live-index.test.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-sync-ops.archive-live-index.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: canonical
Canonical: #96132
Summary: This PR is the canonical narrow fix for the listener guard regression; the open listener-preload PR is complementary timing work, not a replacement.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] The PR proves the listener/debounce/dirty-file/sync-scheduling boundary, but it does not show a full gateway memory_search result or provider index write after a reset/delete archive.

Maintainer options:

  1. Land With Focused Scheduler Proof (recommended)
    Accept the bounded session-state risk because source review and terminal proof show reset/deleted archive emits now reach the existing dirty/sync path without config, schema, or provider routing changes.
  2. Ask For End-To-End Memory Search Smoke
    Request a full gateway reset/delete flow with memory_search output if maintainers want provider/index-write proof before landing.

Next step before merge

  • [P2] No repair job is needed; the PR has no blocking findings and the remaining action is maintainer merge judgment or optional broader end-to-end proof.

Security
Cleared: No concrete security or supply-chain concern was found; the diff removes a memory listener guard and adds a test without touching dependencies, workflows, secrets, package metadata, or external code execution.

Review details

Best possible solution:

Land the narrow listener guard removal with the regression test if maintainers accept focused scheduler proof, and keep gateway startup listener preloading in #76666 as separate complementary work.

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

Yes. Source inspection shows current main returns before scheduling archive session files, while the later delta batch explicitly handles usage-counted reset/deleted archives; the PR body also provides before/after terminal proof for that listener scheduling path.

Is this the best way to solve the issue?

Yes. Removing the listener-level archive drop is the narrowest maintainable fix because the existing downstream delta path already owns usage-counted archive indexing, and the merge result preserves current main's corpus fallback.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 201eb9cd29a1.

Label changes

Label justifications:

  • P2: This is a normal-priority memory-core regression fix with limited blast radius but real impact on whether reset/deleted session history becomes searchable live.
  • merge-risk: 🚨 session-state: The diff changes how live transcript archive events feed memory indexing, so a bad merge could stale or mis-index session memory state.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes before/after terminal output for the real listener, debounce, dirty-file, and sync-scheduling path with an on-disk reset archive; the final embedding-provider index write was not exercised end to end.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes before/after terminal output for the real listener, debounce, dirty-file, and sync-scheduling path with an on-disk reset archive; the final embedding-provider index write was not exercised end to end.
Evidence reviewed

PR surface:

Source -3, Tests +153. Total +150 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 0 3 -3
Tests 1 153 0 +153
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 153 3 +150

What I checked:

Likely related people:

  • jalehman: Authored and merged the transcript update identity PR that added the archive early return in the memory-core transcript listener. (role: regression provenance and recent area contributor; confidence: high; commits: 475252453b4b; files: extensions/memory-core/src/memory/manager-sync-ops.ts, src/sessions/transcript-events.ts)
  • buyitsydney: Authored the earlier archive emit work and the still-open listener-preload PR in the same reset/deleted archive live-indexing problem family. (role: adjacent archive-indexing contributor; confidence: medium; commits: 04a8aa14cac1, b3f39fc38569; files: src/gateway/session-transcript-files.fs.ts, extensions/memory-core/src/memory/manager-sync-ops.ts, src/gateway/server-startup-memory.ts)
  • vincentkoc: Landed the earlier equivalent archive-emission patch directly on main and is tied to recent memory host SDK contract history around archived session transcripts. (role: merger and adjacent area contributor; confidence: medium; commits: aba97a4c7cff, 2e593d07f706; files: src/gateway/session-transcript-files.fs.ts, extensions/memory-core/src/memory/manager-sync-ops.ts, packages/memory-host-sdk/src/host/session-files.ts)
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.

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.

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 24, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 16, 2026
@yetval
yetval force-pushed the fix/memory-archive-live-reindex branch from dc14d1a to 344e7d4 Compare July 16, 2026 14:45
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jul 17, 2026
yetval and others added 2 commits July 22, 2026 13:33
The session transcript listener dropped every archive artifact before
scheduling, so .jsonl.reset and .jsonl.deleted archives written by /reset
and session delete were no longer indexed on the live path and only
surfaced in memory search after the next gateway restart. Remove the
archive guard so in-agent archives fall through to scheduleSessionDirty,
which reaches the usage-counted-archive branch in processSessionDeltaBatch.

Regression from openclaw#89912; restores the incremental archive indexing added in
@steipete
steipete force-pushed the fix/memory-archive-live-reindex branch from 344e7d4 to 76f0030 Compare July 22, 2026 20:58
@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(memory-core): keep live reindex of reset/deleted session archives This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(memory-core): keep live reindex of reset/deleted session archives This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete

Copy link
Copy Markdown
Contributor

Land-ready proof for exact head 4b72c0196855261e38757a47122f09733d86f5ad:

  • Exact-head hosted CI passed: https://github.com/openclaw/openclaw/actions/runs/29961198105
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 96132 passed with gates_mode=hosted_exact_or_recent_parent; the prepared and remote PR heads both remained 4b72c0196855261e38757a47122f09733d86f5ad.
  • node scripts/run-vitest.mjs extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts: 21 passed.
  • node scripts/run-vitest.mjs extensions/memory-core/src/memory/index.test.ts -t 'forces a rebuild after incremental writes while vectors are disabled': 1 passed.
  • node scripts/run-vitest.mjs extensions/memory-core/src/memory/manager.legacy-migration-cleanup.test.ts: 1 passed.
  • Oxfmt, oxlint, and diff whitespace checks passed on all four touched files.
  • Codex autoreview completed clean for the runtime patch and again for the CI repair, with no accepted/actionable findings.

The first two exact-head CI attempts exposed the same migrated memory-search fixture failures. The repair moves those fixtures to the canonical memory.search shape, passes the vector-enabled option through, limits the cleanup fixture to memory sources, and seeds its preexisting vector table as clean. The repaired exact head passed the selected memory shard and the full hosted gate.

ClawSweeper's latest completed review had no rank-up moves and recommended the focused scheduler proof. A newer current-head placeholder did not produce a completed verdict or moves, so there were no additional current-head moves to apply. PR #76666 remains separate because it addresses listener attachment timing, not this archive-classification regression.

Known proof gap: no live embedding-provider request or end-to-end memory_search query was issued. The focused regression uses the production listener, debounce, archive selection, and indexing-content path while capturing the final provider boundary in the existing harness.

@steipete
steipete merged commit 0f3855a into openclaw:main Jul 22, 2026
90 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 23, 2026
…openclaw#96132)

* fix(memory-core): keep live reindex of reset/deleted session archives

The session transcript listener dropped every archive artifact before
scheduling, so .jsonl.reset and .jsonl.deleted archives written by /reset
and session delete were no longer indexed on the live path and only
surfaced in memory search after the next gateway restart. Remove the
archive guard so in-agent archives fall through to scheduleSessionDirty,
which reaches the usage-counted-archive branch in processSessionDeltaBatch.

Regression from openclaw#89912; restores the incremental archive indexing added in

* fix(memory-core): constrain live archive indexing

* test(memory-core): align migrated search fixtures

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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