Skip to content

fix(memory): reuse targeted session corpus snapshot - #117247

Merged
steipete merged 1 commit into
mainfrom
codex/prod-wave-memory-ingestion-052208-2d45
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/prod-wave-memory-ingestion-052208-2d45

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Targeted memory session sync resolved a requested session against one transcript-corpus enumeration, then enumerated the corpus again during indexing. A session-store reset or configuration rotation between those reads could make the chosen identity disappear or be materialized from a different store. Ordinary syncs also paid for corpus discovery during preflight even when there was no session work.

Why This Change Was Made

  • Carry one immutable corpus snapshot from targeted identity resolution into targeted indexing.
  • Remove the duplicate target-normalization map; the resolved file set is already the canonical dedupe boundary.
  • Skip corpus discovery entirely for non-target sync preflight.
  • Keep full/session-retry reindexes on a fresh full corpus enumeration, because those paths intentionally ignore targeted files and rebuild the complete session source.
  • Preserve .dreams/session-corpus, Doctor repair, SQLite schema, config/provider contracts, and persistent user data. The dreaming corpus has shipped citation and repair semantics and is not safe to remove without a dedicated migration.

Architectural owner: memory-core's manager session/source sync boundary. The canonical repair resolves and indexes a targeted session from one prepared corpus snapshot; no fallback or parallel storage path was added.

Production delta: 43 additions, 55 deletions (net -12). Tests/helpers: 105 additions, 26 deletions (net +79).

User Impact

Targeted session indexing remains consistent if the configured SQLite session store rotates while a sync is starting. Ordinary memory syncs avoid an unnecessary session-corpus scan when no target or session indexing work exists. Full reindex, restart/catch-up, archived/reset session, dreaming, backfill, repair, redaction, and provenance behavior remain unchanged.

Evidence

  • Local focused proof: 9 files, 127 tests passed.
  • Blacksmith Testbox tbx_01kyxykp86qbdw81fgsv51eszb: the same 9 files / 127 tests passed, including a real SQLite store A→B rotation during actual runSync; indexing retained store A's resolved snapshot and rejected store B's replacement content.
  • Hosted CI exposed a pre-existing mocked-fixture cold-start problem: self-heal, watcher, and memory-tool fixtures cold-loaded the full plugin capability runtime while resolving static config. Unmodified current main timed out in 339.9s locally and 170.9s on Testbox in the first affected fixture. The shared test-config owner now defaults only an omitted plugins.enabled to false; it preserves every explicit plugins field, including enabled, entries, allowlists, slots, and load settings. The tools fixture uses that owner centrally, and recall tracking no longer carries a duplicate config cast. Provider-auto behavior, explicit dreaming config, real SQLite/self-heal and recall-persistence assertions, timeouts, mocks, and production behavior remain unchanged.
  • Exact hosted changed-2 shard: 12 files / 223 tests passed sequentially on Blacksmith Testbox tbx_01kyy2mby6xkk1cprx6rj42mhe (Actions run).
  • The actual ordinary runSync({ reason: "session-delta" }) path records zero corpus enumerations when index identity is valid and no session work is dirty.
  • Remote node scripts/check-changed.mjs -- <nine changed files> passed on Blacksmith Testbox tbx_01kyy302zc2ycqbdw65140mxxh: formatting, API/boundary/dead-export guards, extension and extension-test tsgo, lint, database-first guards, and runtime import cycles (Actions run).
  • git diff --check passed.
  • Fresh structured Codex autoreview at xhigh: clean, no actionable findings, patch correct at 0.99 confidence.
  • No SQLite schema, config/default, provider, localization, or user-data migration changes.

@steipete
steipete marked this pull request as ready for review August 1, 2026 05:48
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: S maintainer Maintainer-authored PR labels Aug 1, 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. P2 Normal backlog priority with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:33 AM ET / 07:33 UTC.

ClawSweeper review

What this changes

The PR resolves targeted session files and indexes them from one prepared transcript-corpus snapshot, preventing a session-store rotation between those two steps from changing the indexed identity and avoiding corpus discovery for ordinary no-session-work syncs.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness or security findings. This is a focused Memory Core bug fix with source-backed snapshot ownership, a targeted store-rotation regression test, successful proof/quality gates, and no overlap with the current main branch’s memory paths; keep it open for explicit maintainer acceptance because it carries the maintainer label.

Priority: P2
Reviewed head: 32e7ea99c55d16c5a0d6810f22df07a941b4cab2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The repair is narrowly scoped, source-consistent, regression-tested at the claimed race boundary, and backed by real SQLite Testbox evidence.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body records a real SQLite store A→B rotation during actual runSync on Testbox with observed original-snapshot indexing, and the current check context includes successful Real behavior proof runs.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body records a real SQLite store A→B rotation during actual runSync on Testbox with observed original-snapshot indexing, and the current check context includes successful Real behavior proof runs.
Evidence reviewed 6 items Prepared snapshot is passed through the owner boundary: The PR creates one targeted session plan containing both corpus entries and resolved archive files, then supplies that corpus only to targeted archive indexing; full and retry reindexes retain their normal fresh enumeration behavior.
Targeted run path uses the same snapshot for indexing: runSync resolves the plan once for a requested target and injects its corpus entries only into the targeted syncArchiveFiles callback.
Archive indexer accepts the prepared corpus without changing its normal fallback: The source-sync owner uses supplied corpus entries when present and otherwise calls its existing corpus enumeration helper, preserving non-target and full-sync behavior.
Findings None None.
Security None None.

How this fits together

Memory Core builds the local search index from workspace files and agent session transcripts. A targeted session sync resolves a requested session to corpus entries, passes those entries into archive indexing, and then updates the memory index without re-reading the session corpus.

flowchart LR
  A[Targeted session request] --> B[Resolve transcript corpus]
  B --> C[Prepared corpus snapshot]
  C --> D[Resolve target archive files]
  C --> E[Archive-file indexing]
  D --> E
  E --> F[Local memory search index]
Loading

Decision needed

Question Recommendation
Should this maintainer-labelled Memory Core repair be accepted against the current merge result? Accept after merge refresh: Confirm the current GitHub three-way merge result and land the focused snapshot repair with its existing regression proof.

Why: The patch is technically sound and proof-positive, but the repository’s protected maintainer label requires explicit human handling rather than automated cleanup or landing.

Before merge

  • Resolve merge risk (P1) - The branch is behind current main. GitHub reports it mergeable and the affected Memory Core paths have no current-main overlap, but the final landing should use the current GitHub three-way merge result or an equivalent rebase refresh.
Agent review details

Security

None.

PR surface

Source -1, Tests +68. Total +67 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 56 57 -1
Tests 4 92 24 +68
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 148 81 +67

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-session-sync-ops.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-session-sync-ops.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-source-sync-ops.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts, and 4 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused owner-boundary repair after the maintainer confirms the current merge result; retain the one-snapshot contract and its SQLite store-rotation regression coverage.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused owner-boundary repair after the maintainer confirms the current merge result; retain the one-snapshot contract and its SQLite store-rotation regression coverage.

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

Yes, source-reproducible with high confidence: the changed harness rotates the SQLite session store after the sole corpus enumeration and verifies that indexing keeps the original session content.

Is this the best way to solve the issue?

Yes: resolving and consuming the targeted corpus at the manager session/source-sync boundary is the narrow canonical fix; re-enumerating downstream or caching broader corpus state would preserve the race or widen lifecycle scope unnecessarily.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The PR repairs targeted memory-index consistency and avoids unnecessary ordinary-sync work, with a bounded blast radius and no evidence of a release-blocking outage.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body records a real SQLite store A→B rotation during actual runSync on Testbox with observed original-snapshot indexing, and the current check context includes successful Real behavior proof runs.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records a real SQLite store A→B rotation during actual runSync on Testbox with observed original-snapshot indexing, and the current check context includes successful Real behavior proof runs.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the manager sync-operations refactor that established this area, and the same identity authored the current focused repair. (role: feature-history owner and current repair author; confidence: high; commits: c077e801ddd4, 32e7ea99c55d; files: extensions/memory-core/src/memory/manager-session-sync-ops.ts, extensions/memory-core/src/memory/manager-sync-ops.ts)
  • Vincent Koc: Base blame attributes the pre-fix target-resolution and run-sync call-site lines to this recent source lineage; the available local history is partially promisor-backed, so broader provenance remains less certain. (role: recent code-path contributor; confidence: medium; commits: 42c313976ef0; files: extensions/memory-core/src/memory/manager-session-sync-ops.ts, extensions/memory-core/src/memory/manager-sync-ops.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-01T05:53:42.779Z sha c88e957b39468467b54480e79995d463a06e6a1a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T06:23:30.067Z sha 236a99257ef9f380fb9d1a9cbb63c0e3e392d44d :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/prod-wave-memory-ingestion-052208-2d45 branch from c88e957 to 236a992 Compare August 1, 2026 06:17
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@steipete
steipete force-pushed the codex/prod-wave-memory-ingestion-052208-2d45 branch from 236a992 to 32e7ea9 Compare August 1, 2026 07:26
@steipete
steipete merged commit 04f9a20 into main Aug 1, 2026
97 of 99 checks passed
@steipete
steipete deleted the codex/prod-wave-memory-ingestion-052208-2d45 branch August 1, 2026 07:53
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 1, 2026
* origin/main: (41 commits)
  test(ci): update memory helper routing expectation (#117295)
  fix(canvas): emit successful control results in JSON mode (#117297)
  fix(imessage): settle native inbound reply delivery (#117282)
  fix(agents): reject invalid UTF-8 LSP responses (#117271)
  fix(line): centralize card and template message alt text (#117280)
  fix(release): validate candidates before Docker publication (#117252)
  fix(media): validate provider-owned generated media downloads (#117281)
  fix(feishu): restore custom HTTPS API domains (#117278)
  fix(models): reuse prepared plugin metadata (#117131)
  fix(agents): stop fallback after delivered-but-failed attempts (#114628)
  fix(memory): reuse targeted session corpus snapshot (#117247)
  fix(matrix): reconcile durable sends after response loss
  test(release): repair full validation regressions (#116931)
  fix(linux-canvas): report socket watcher fallback (#109502)
  fix(codex): preserve authoritative turn completion (#117185)
  fix(canvas): preserve widgets across derived-name collisions (#117132)
  fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (#117206)
  fix(msteams): prevent duplicate final replies (#116398)
  fix(doctor): session SQLite restore installs an empty session index over the valid archive (#117221)
  fix(plugins): preserve workspace plugins across CLI and control UI (#117265)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main: (41 commits)
  test(ci): update memory helper routing expectation (openclaw#117295)
  fix(canvas): emit successful control results in JSON mode (openclaw#117297)
  fix(imessage): settle native inbound reply delivery (openclaw#117282)
  fix(agents): reject invalid UTF-8 LSP responses (openclaw#117271)
  fix(line): centralize card and template message alt text (openclaw#117280)
  fix(release): validate candidates before Docker publication (openclaw#117252)
  fix(media): validate provider-owned generated media downloads (openclaw#117281)
  fix(feishu): restore custom HTTPS API domains (openclaw#117278)
  fix(models): reuse prepared plugin metadata (openclaw#117131)
  fix(agents): stop fallback after delivered-but-failed attempts (openclaw#114628)
  fix(memory): reuse targeted session corpus snapshot (openclaw#117247)
  fix(matrix): reconcile durable sends after response loss
  test(release): repair full validation regressions (openclaw#116931)
  fix(linux-canvas): report socket watcher fallback (openclaw#109502)
  fix(codex): preserve authoritative turn completion (openclaw#117185)
  fix(canvas): preserve widgets across derived-name collisions (openclaw#117132)
  fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (openclaw#117206)
  fix(msteams): prevent duplicate final replies (openclaw#116398)
  fix(doctor): session SQLite restore installs an empty session index over the valid archive (openclaw#117221)
  fix(plugins): preserve workspace plugins across CLI and control UI (openclaw#117265)
  ...
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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M 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.

1 participant