Skip to content

refactor(memory): consolidate session transcript ingestion - #117293

Merged
steipete merged 1 commit into
mainfrom
codex/goal100k-memory-session-ingestion-0801-2d45
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/goal100k-memory-session-ingestion-0801-2d45

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session transcript ingestion had separate live-dreaming and historical-backfill implementations for parsing, checkpoints, dedupe hashes, state persistence, and corpus citations. That duplication allowed policy and lifecycle behavior to drift. In particular, a live sweep that reached its global candidate cap replaced checkpoint state with only the files it visited, so later sources could lose their checkpoints and replay already-ingested transcript content.

After #117247 merged, its shared test config isolator also sat in the broad manager test helper. Importing that manager helper from tools test support made the test-project router discover seven unrelated transitive importers, breaking precise changed-test routing and blocking unrelated CI shards.

Why This Change Was Made

This creates one private session-ingestion owner for transcript normalization, provenance, hashing, checkpoint persistence, corpus append, and MemorySearchResult citations. Live dreaming and historical backfill retain separate orchestration policies:

  • Live dreaming scans active interactive sessions, uses the metadata fast path, advances past out-of-lookback content, preserves unvisited and backfill-owned checkpoints, and prunes only live sources proven absent by complete corpus enumeration.
  • Backfill scans active, retained, and explicitly supplied archive sources; verifies content even when size and mtime are unchanged; accepts only owner/agent provenance; preserves inclusive range blocking, chronological caps, preview/apply behavior, and rewind semantics.
  • Foreign archive provenance remains forced untrusted, SQLite scope compatibility and legacy hashes remain intact, and transient tolerant-reader failures no longer masquerade as source deletion.

The main-wide test-import repair moves isolateMemoryManagerTestConfig into one dependency-free type-only test leaf. Manager watcher/self-heal tests and tools test support import that leaf directly; the broad lazy manager helper no longer exports or owns config isolation. The helper still preserves explicit plugins.enabled, nested entries, allowlists, slots, and load settings while defaulting only an omitted enabled field. After rebasing onto the current-main routing update, the strict exact expected importer list deletes only the seven now-stale paths and retains the canonical five; the assertion is not weakened.

The shared ingestion owner removes connected duplicate state, scanner, hashing, and corpus-writing code. Handwritten production delta remains 603 additions / 855 deletions: net -252 lines. Tests and test-support are 184 additions / 21 deletions: net +163 lines.

User Impact

Operators should see no intended workflow or configuration change. Live dreaming no longer replays later sessions after a capped sweep loses their checkpoints, and historical backfill reliably notices content replacement even when filesystem size and mtime are preserved. The test-support repair restores precise changed-test routing so unrelated Memory Core tests and dependent PRs do not enter oversized shards.

Evidence

  • Exact current-main routing regression on Blacksmith: node scripts/run-vitest.mjs src/scripts/test-projects.test.ts -t 'routes extension helper targets to importing extension tests' passed 1/1 test (84 skipped) after the integration rebase. Strict equality and the canonical five importer paths remain unchanged; only the seven stale transitive paths were removed.
  • Combined Blacksmith Memory Core proof on the same production/helper patch: 12/12 files and 258/258 tests passed. This includes all 76 ingestion tests plus manager self-heal, watcher config, startup catch-up, tools, citations, recall tracking, and search-visibility coverage.
  • The capped-checkpoint regression creates 20 busy sessions plus a later known session, exhausts the 240-message sweep cap before the later source, and proves its checkpoint remains byte-for-byte unchanged. A companion test proves complete corpus enumeration prunes only a truly absent live checkpoint while retaining canonical retained/archive and foreign backfill state.
  • Backfill provenance proof preserves the existing assertions that self-asserted owner metadata in foreign JSONL stays untrusted, canonical assistant replies remain tainted until a real owner turn begins, and only the trusted owner/agent turn is selected. The new scanner regression also proves verify-content mode detects a same-size/same-mtime replacement.
  • Blacksmith pnpm check:changed passed after the final integration rebase, including core-test and extension production/test typechecks, dead-export scan, lint, formatting, plugin boundaries, database-first guards, and runtime import-cycle checks.
  • Fresh xhigh autoreview on the full final branch: clean, correctness score 0.98, no actionable findings.
  • git diff --check passed.
  • Exact final head: 902519f.

@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: XL maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 08:06
@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 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, 5:10 AM ET / 09:10 UTC.

ClawSweeper review

What this changes

The PR moves live-dreaming and historical-backfill transcript parsing, deduplication, checkpoint persistence, corpus writes, and search citations into a shared private Memory Core ingestion module, while separating a test configuration helper from a broad manager helper.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

This PR remains necessary: current main can discard checkpoints for transcript sources left unvisited after the global live-ingestion cap, while the proposed shared owner preserves them and keeps backfill’s separate provenance and cursor policy. I found no discrete correctness defect in the patch; because it centralizes persisted session state and still has exact-head checks in progress, it should stay open for the protected maintainer review path.

Priority: P2
Reviewed head: 902519ff5bdec1ca317e9ffe792661beb7bed6ae
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong targeted runtime and regression evidence supports a coherent owner-boundary refactor with no actionable patch finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The PR body records exact-head Blacksmith focused Memory Core behavior proof, including the capped-checkpoint and same-size/same-mtime replacement regressions, and the supplied context marks real-behavior proof sufficient.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body records exact-head Blacksmith focused Memory Core behavior proof, including the capped-checkpoint and same-size/same-mtime replacement regressions, and the supplied context marks real-behavior proof sufficient.
Evidence reviewed 6 items Current-main defect: Current live dreaming begins a sweep with an empty checkpoint map and later treats every prior key missing from that map as changed; a global cap can break the source loop before later known sessions are copied into the next state.
Proposed owner-boundary repair: The PR starts from existing checkpoints, enumerates the complete corpus to remove only absent owned sources, and processes active sources through the shared scanner while retaining unvisited state when the cap is reached.
Shared scanner preserves source distinctions: The new scanner distinguishes absent, unavailable, excluded, unchanged, and scanned sources; it retains prior state for tolerant-reader failures and forcibly marks foreign archive provenance untrusted.
Findings None None.
Security None None.

How this fits together

Memory Core consumes session transcripts in two workflows: live dreaming extracts recent interactive-session signals, while backfill processes retained or explicitly supplied archives. Both workflows persist ingestion checkpoints and dedupe hashes, append searchable session-corpus lines, and return citations to later memory features.

flowchart LR
  A[Session transcript sources] --> B[Live dreaming]
  A --> C[Historical backfill]
  B --> D[Shared ingestion owner]
  C --> D
  D --> E[Checkpoint and dedupe state]
  D --> F[Searchable session corpus]
  F --> G[Memory citations and recall]
Loading

Decision needed

Question Recommendation
Should the Memory Core owner approve merging this shared checkpoint and dedupe-state refactor once the remaining exact-head CI checks complete successfully? Merge after exact-head gates: Accept the shared ingestion owner once the in-progress checks are green and the demonstrated checkpoint/provenance invariants remain intact.

Why: The patch is source-supported and proof-backed, but it changes the owner boundary for persisted session-ingestion state used by two workflows and carries the protected maintainer label.

Before merge

  • Resolve merge risk (P1) - This refactor changes the canonical writer for persisted checkpoints and dedupe hashes shared by live dreaming and backfill; complete exact-head CI and owner review should finish before merge.
  • Resolve merge risk (P1) - GitHub reports the branch as mergeable but behind current main. The touched-path history shows no intervening main changes, so this is a review-refresh concern rather than evidence that the merge would remove current behavior.
  • Complete next step (P2) - No mechanical repair is identified; the protected maintainer label and persisted session-state refactor require owner review after the remaining exact-head checks finish.
Agent review details

Security

None.

PR surface

Source -251, Tests +162. Total -89 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 7 615 866 -251
Tests 6 172 10 +162
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 787 876 -89

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/memory-core/src/session-ingestion.test.ts, serialized state: extensions/memory-core/src/session-backfill-lifecycle.ts, serialized state: extensions/memory-core/src/session-backfill.test.ts, serialized state: extensions/memory-core/src/session-ingestion.test.ts, serialized state: extensions/memory-core/src/session-ingestion.ts, unknown-data-model-change: extensions/memory-core/src/dreaming-phases.test.ts, and 7 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Finish exact-head state verification (recommended)
    Wait for the remaining exact-head checks, then merge if they are green and the owner accepts the persisted-checkpoint transition proof.
  2. Pause for owner review
    Pause the refactor if the Memory Core owner wants to independently audit live and backfill checkpoint ownership before landing.

Technical review

Best possible solution:

Keep one private ingestion owner for scanning and persistent-state mechanics, retain each workflow’s explicit orchestration and provenance policy, and merge only after the remaining exact-head checks are green and the Memory Core owner accepts the state-transition proof.

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

Yes, from source: current main initializes the next live-ingestion checkpoint map empty, stops once the global cap is exhausted, and then writes only visited sources. The PR adds a focused regression that constructs this capped-sweep ordering and verifies the later checkpoint remains unchanged.

Is this the best way to solve the issue?

Yes. A single private owner for parsing, state, dedupe, corpus append, and citations removes the duplicated lifecycle policy while retaining separate live and backfill orchestration where their product semantics intentionally differ.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: The PR addresses bounded transcript-ingestion replay and changed-test routing without evidence of an emergency availability, security, or data-loss event.
  • merge-risk: 🚨 session-state: The patch consolidates persisted checkpoint and dedupe state consumed by both live dreaming and historical backfill.
  • 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 (logs): The PR body records exact-head Blacksmith focused Memory Core behavior proof, including the capped-checkpoint and same-size/same-mtime replacement regressions, and the supplied context marks real-behavior proof sufficient.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records exact-head Blacksmith focused Memory Core behavior proof, including the capped-checkpoint and same-size/same-mtime replacement regressions, and the supplied context marks real-behavior proof sufficient.

Evidence

What I checked:

  • Current-main defect: Current live dreaming begins a sweep with an empty checkpoint map and later treats every prior key missing from that map as changed; a global cap can break the source loop before later known sessions are copied into the next state. (extensions/memory-core/src/dreaming-phases.ts:800, b721cffa4461)
  • Proposed owner-boundary repair: The PR starts from existing checkpoints, enumerates the complete corpus to remove only absent owned sources, and processes active sources through the shared scanner while retaining unvisited state when the cap is reached. (extensions/memory-core/src/dreaming-phases.ts:608, 902519ff5bde)
  • Shared scanner preserves source distinctions: The new scanner distinguishes absent, unavailable, excluded, unchanged, and scanned sources; it retains prior state for tolerant-reader failures and forcibly marks foreign archive provenance untrusted. (extensions/memory-core/src/session-ingestion.ts:179, 902519ff5bde)
  • Regression coverage: The PR adds a capped-sweep regression that preserves a later known checkpoint and a pruning regression that retains archive and foreign-backfill state; it also keeps the test-project routing assertion strict after moving the dependency-free helper. (extensions/memory-core/src/dreaming-phases.test.ts:2310, 902519ff5bde)
  • Feature provenance: Blame ties the current checkpoint replacement path to the present Memory Core implementation, and the history also shows an earlier archived-transcript recovery change as relevant context for retained-session handling. (extensions/memory-core/src/dreaming-phases.ts:800, d8ba00f8a262)
  • Current-main overlap check: No commits between the PR base and current main touched the central Memory Core or test-router paths, and GitHub context reports the PR as mergeable; the branch is behind but no touched-path conflict is evidenced. (extensions/memory-core/src/session-backfill.ts:573, b721cffa4461)

Likely related people:

  • steipete: Current-main blame attributes the central live-ingestion checkpoint path to Peter Steinberger, and the merged related Memory Core work in this area also lists steipete as author. (role: recent state-path contributor; confidence: high; commits: d8ba00f8a262, 04f9a204fd91; files: extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/session-backfill.ts)
  • Chris Anderson: Commit f3ac874 recovered archived session transcripts in Memory Core, making this person a useful adjacent routing candidate for retained/archive semantics. (role: historical transcript-recovery contributor; confidence: medium; commits: f3ac874fd215; files: extensions/memory-core/src/dreaming-phases.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-01T08:11:54.061Z sha 48b4b1c6eaa9f09db1065457ea6e1528235483e9 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T08:47:05.231Z sha 434845f1926bb66984ebc806e49728ecf5695c1d :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/goal100k-memory-session-ingestion-0801-2d45 branch from 48b4b1c to 434845f Compare August 1, 2026 08:38
@steipete
steipete force-pushed the codex/goal100k-memory-session-ingestion-0801-2d45 branch from 434845f to 902519f Compare August 1, 2026 09:02
@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 merged commit f216d3c into main Aug 1, 2026
128 of 130 checks passed
@steipete
steipete deleted the codex/goal100k-memory-session-ingestion-0801-2d45 branch August 1, 2026 09:12
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to Alix-007/openclaw that referenced this pull request Aug 1, 2026
* origin/main:
  fix(update): keep rolled-back Git installs runnable (openclaw#117294)
  refactor(ui): centralize chat outbox projections (openclaw#117284)
  fix(sessions): preserve target rows during legacy migration (openclaw#117272)
  fix(security): detect multiline skill prompt injection (openclaw#117254)
  fix(qa): lease credentials for Telegram startup proof (openclaw#116842)
  refactor(memory): unify session ingestion (openclaw#117293)
  fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621)
  fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292)
  fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
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:
  fix(update): keep rolled-back Git installs runnable (openclaw#117294)
  refactor(ui): centralize chat outbox projections (openclaw#117284)
  fix(sessions): preserve target rows during legacy migration (openclaw#117272)
  fix(security): detect multiline skill prompt injection (openclaw#117254)
  fix(qa): lease credentials for Telegram startup proof (openclaw#116842)
  refactor(memory): unify session ingestion (openclaw#117293)
  fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621)
  fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292)
  fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
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 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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL 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