Repository navigation
fix(memory): make legacy session backfill rollback re-applicable - #116004
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 29, 2026, 12:55 PM ET / 16:55 UTC. ClawSweeper reviewWhat this changesThe PR makes session-backfill rollback reset an affected agent's legacy ingestion cursors and seen hashes when rewind-journal coverage is incomplete, then records a clean baseline for later precise rollbacks. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep this PR open for manual memory-core review. The proposed repair targets a real persistent-session failure mode and has focused regression coverage in the PR body, but it changes stored per-agent ingestion state and does not include after-fix copied-install evidence showing that legacy and mixed-era workspaces can re-apply safely. Priority: P2 Review scores
Verification
How this fits togetherMemory Core stages information from agent session transcripts and records ingestion state so later backfill runs do not process the same content again. The rollback path removes staged memory artifacts and must also restore or reset the corresponding per-agent ingestion state so preview and re-apply can find the transcript again. flowchart LR
A[Agent session transcripts] --> B[Session backfill]
B --> C[Staged memories and diary entries]
B --> D[Per-agent ingestion cursors and seen hashes]
C --> E[Rollback request]
D --> E
E --> F{Complete rewind journal coverage?}
F -->|Yes| G[Precise journal rewind]
F -->|No| H[Reset affected agent state]
G --> I[Re-applicable backfill]
H --> I
Before merge
Agent review detailsSecurityNone. PR surfaceSource +96, Tests +167. Total +263 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the agent-scoped fallback only if a copied legacy and mixed-era workspace demonstrates that rollback, preview, and re-apply converge without cross-agent re-ingestion, then land it with the focused regression suite. Do we have a high-confidence way to reproduce the issue? No—this review has a concrete reported copied-install failure path, but no independently observed current-head run proving the before-and-after behavior. Is this the best way to solve the issue? Unclear—the agent-scoped reset is a plausible bounded recovery path, but the best fix still needs after-fix copied-workspace proof across legacy and mixed journal state before persistent-state behavior can be accepted. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c87e545c8897. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
ClawSweeper rank-up moves addressed for head
No config, flag, or selective rollback mode is added. |
|
Merged via squash.
|
* origin/main: (446 commits) fix(daemon): refuse duplicate launchd gateway managers (openclaw#97285) fix(memory-lancedb): share the recall cooldown with the auto-recall prompt-build hook (openclaw#112927) fix(test): isolate plugin install fixtures (openclaw#116008) fix(feishu): guard Object.assign against prototype pollution in webhook payload merge (openclaw#111729) fix(sms): isolate validated webhook quotas per sender (openclaw#104862) fix(sessions): recover deleted chats without endless retries (openclaw#115974) fix(restart): log errors from restart hook callbacks instead of swallowing (openclaw#108847) feat(ui): enable tool-loop detection from Labs (openclaw#115983) fix(telegram): catch unhandled rejections in webhook and ingress worker shutdown (openclaw#100998) fix(memory): keep rollbacks compatible after recall metadata upgrade (openclaw#116003) fix(ui): derive cron timezone suggestions (openclaw#115973) fix(scripts): bound dependency pin git lookups (openclaw#110570) fix(skills): preserve configless workshop apply upgrades (openclaw#115982) fix(gateway): cancel unread cron webhook bodies before SSRF release (openclaw#111236) fix(voice-call): pin Twilio webhook verification to the configured public path (openclaw#112800) fix(memory): make legacy session backfill rollback re-applicable (openclaw#116004) fix(security): fence external hook job name in isolated-agent prompts (openclaw#112501) fix(channels): mark durable webhook acceptance on Zalo, Google Chat, SMS, Feishu, Nextcloud Talk, and Synology Chat (openclaw#115586) fix(test): restore stdin TTY descriptors (openclaw#115985) fix(plugins): remove incorrect modifying hook timeout fallback in getClaimingHookTimeoutMs (openclaw#107996) ... # Conflicts: # extensions/openai/realtime-quicksilver-wire.ts
* origin/main: (683 commits) fix(discord): bound webhook send body reads (openclaw#109076) fix(ui): preserve initials for missing user avatars (openclaw#115976) feat(ui): add provider icons to coding catalogs (openclaw#115956) fix(daemon): refuse duplicate launchd gateway managers (openclaw#97285) fix(memory-lancedb): share the recall cooldown with the auto-recall prompt-build hook (openclaw#112927) fix(test): isolate plugin install fixtures (openclaw#116008) fix(feishu): guard Object.assign against prototype pollution in webhook payload merge (openclaw#111729) fix(sms): isolate validated webhook quotas per sender (openclaw#104862) fix(sessions): recover deleted chats without endless retries (openclaw#115974) fix(restart): log errors from restart hook callbacks instead of swallowing (openclaw#108847) feat(ui): enable tool-loop detection from Labs (openclaw#115983) fix(telegram): catch unhandled rejections in webhook and ingress worker shutdown (openclaw#100998) fix(memory): keep rollbacks compatible after recall metadata upgrade (openclaw#116003) fix(ui): derive cron timezone suggestions (openclaw#115973) fix(scripts): bound dependency pin git lookups (openclaw#110570) fix(skills): preserve configless workshop apply upgrades (openclaw#115982) fix(gateway): cancel unread cron webhook bodies before SSRF release (openclaw#111236) fix(voice-call): pin Twilio webhook verification to the configured public path (openclaw#112800) fix(memory): make legacy session backfill rollback re-applicable (openclaw#116004) fix(security): fence external hook job name in isolated-agent prompts (openclaw#112501) ... # Conflicts: # CHANGELOG.md # src/agents/tool-search-catalog.ts # src/agents/tool-search.test-support.ts # src/agents/tool-search.ts
…nclaw#116004) * fix(memory): reset legacy backfill cursors on rollback * fix(memory): track complete backfill rewind baselines
What Problem This Solves
Fixes an issue where session-backfill entries staged before the rewind journal existed could still become a one-way rollback. Rollback removed the staged memories and diary entries, but retained their ingestion cursors, so preview and re-apply both returned zero.
Why This Change Was Made
Rollback now distinguishes complete journal coverage from legacy or mixed-era state. A complete, agent-scoped baseline keeps the precise journal rewind path. If removed artifacts are not fully covered, rollback resets only that agent's session-ingestion cursors and seen hashes, forcing safe re-enumeration on the next preview/apply. Successful rollback records a clean per-agent baseline so later journaled rollbacks return to the precise path.
The change is AI-assisted and was reviewed through the repository autoreview workflow until no accepted or actionable findings remained.
User Impact
Rollback is unconditionally re-applicable for session backfills: legacy-only, mixed legacy+journal, and current journaled state all converge. Operators do not need a flag or config change; the first legacy recovery may re-enumerate the agent's transcript corpus, while later covered rollbacks stay precise.
Evidence
node scripts/run-vitest.mjs extensions/memory-core/src/session-backfill.test.ts extensions/memory-core/src/session-backfill-gateway.test.ts extensions/memory-core/src/cli.test.ts— 100 tests passed.archivewithout touching another agent's archived scopes.