Skip to content

feat(memory): backfill past sessions from Control UI - #115266

Merged
steipete merged 3 commits into
mainfrom
feat/memory-backfill-ui
Jul 28, 2026
Merged

steipete merged 3 commits into
mainfrom
feat/memory-backfill-ui

Conversation

@steipete

@steipete steipete commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Operators can backfill trusted memory candidates from retained agent sessions with the CLI, but the Control UI has no way to preview, apply, or roll back that history. This leaves a useful recovery and migration workflow inaccessible to browser-based administration.

Why This Change Was Made

Memory Core now registers three additive plugin-owned Gateway methods and the existing Memory Import page exposes a “From past sessions” card. Preview and apply share the canonical session-backfill executor; apply uses bounded, client-driven 14-day calls with persisted idempotent cursors, so no job system or new core Gateway surface is required.

The three Gateway methods are approved additive plugin-registered surfaces, using the same policy recorded on #114819 and #115162. No protocol-version bump or core Gateway edit is needed.

This PR is AI-assisted. I reviewed the implementation, ran the repository’s autoreview workflow to a clean result, and understand the ownership and continuation contracts.

User Impact

From Import Memory, an operator can select an agent and optional date range, preview per-day session candidates and samples, apply the history with visible cumulative progress, or confirm a rollback. Bounded previews clearly say when more candidates remain, Gateway errors are shown directly, and rollback removes only the diary/staged entries owned by session backfill while preserving tracked cursors.

Evidence

Live coordinator validation

The coordinator validated this end to end in a real browser against a development Gateway with real retained sessions. Full notes and artifacts: https://gist.github.com/steipete/d00e9b8ee024ab3430abc791e8668e2f (live-ui-proof.md).

  • Preview returned 42 candidates.
  • Apply added exactly 42 database-backed recall entries, moving the count from 70 to 112.
  • Rollback removed exactly those 42 entries and left all 70 pre-existing recall entries untouched.

before

after

Gateway methods and authorization

Method Scope
memory.sessionBackfill.preview operator.read
memory.sessionBackfill.apply operator.admin
memory.sessionBackfill.rollback operator.admin

Automated proof

  • 135 focused assertions passed after rebasing onto origin/main: Memory Core gateway (6), shared executor (13), plugin registration (22), Memory Core CLI (75), Control UI page (10), and view (9).
  • node scripts/check-changed.mjs -- <11 changed files> passed on the final corrected head in Blacksmith Testbox: all typecheck lanes, formatting, Control UI i18n, plugin boundaries, full core/UI/packages/extension lint, database-first guards, sidecar-loader checks, and runtime import-cycle checks (28m13s; the initial post-rebase pass was 36m40s).
  • deadcode:dependencies and production/full-tree/script unused-export scans pass with zero entries after the CI follow-up.
  • Source-blind mocked-browser validation passed preview, chunked apply, rollback confirmation, range-result reset, Gateway error display, and mutation serialization.
  • Final Codex autoreview reported no accepted/actionable findings.

Progress design

Apply intentionally has no server-side job. The UI drives small limitDays=14 calls, requires authoritative cursor advancement for positive batches, accumulates unique processed days and staged counts, and finishes only after the idempotent zero-candidate exhausted sentinel. Per-message hashes and persisted ingestion cursors make retries converge safely.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui extensions: memory-core Extension: memory-core size: XL maintainer Maintainer-authored PR labels Jul 28, 2026
@steipete steipete self-assigned this Jul 28, 2026
@steipete
steipete marked this pull request as ready for review July 28, 2026 15:34
@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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 28, 2026
@clawsweeper

clawsweeper Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 12:36 PM ET / 16:36 UTC.

ClawSweeper review

What this changes

Adds a Control UI workflow that previews, applies, tracks, and rolls back Memory Core backfill of trusted candidates from retained agent sessions through three plugin Gateway methods.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for maintainer review. The implementation reuses the merged retained-session backfill executor and has credible real UI proof, but it creates three new plugin Gateway methods with read/admin scopes, so maintainers must explicitly accept their stable names, authorization, and rollback-cursor behavior before merge.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong live proof and focused reuse of the existing executor support the patch; the remaining blocker is maintainer acceptance of the new Gateway contract.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The supplied linked browser validation demonstrates the after-fix preview, database-backed apply, and selective rollback results with retained-session data.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The supplied linked browser validation demonstrates the after-fix preview, database-backed apply, and selective rollback results with retained-session data.
Evidence reviewed 5 items Existing backfill foundation: The merged retained-session backfill work supplies the shared executor and idempotent cursor model that this PR exposes in the Control UI rather than creating a second memory writer.
Proposed Gateway surface: The branch registers three additive Memory Core Gateway methods: preview, apply, and rollback; preview is read-scoped and the mutating calls are admin-scoped.
Control UI integration: The Memory Import page advertises the new session-backfill flow, drives bounded apply batches, and renders preview/progress/rollback state.
Findings None None.
Security None None.

How this fits together

Memory Core converts trusted retained-session transcript content into staged memory candidates for later dreaming promotion. This PR exposes that existing backfill path to Control UI operators through plugin-owned Gateway methods, then renders preview, progress, errors, and rollback controls in the Memory Import page.

flowchart LR
  A[Retained agent sessions] --> B[Memory Core backfill executor]
  B --> C[Persisted cursors and staged memory]
  D[Control UI Memory Import] --> E[Plugin Gateway methods]
  E --> B
  C --> F[Preview and progress results]
  F --> D
  D --> G[Rollback request]
  G --> E
Loading

Decision needed

Question Recommendation
Should Memory Core permanently support memory.sessionBackfill.preview, memory.sessionBackfill.apply, and memory.sessionBackfill.rollback as plugin Gateway methods with the proposed read/admin scopes and cursor-preserving rollback semantics? Accept the additive Gateway contract: Approve the names, scopes, bounded client-driven execution, and rollback behavior as the supported Control UI backfill API.

Why: This is an additive externally reachable plugin Gateway surface and changes the operator-facing recovery workflow; code review can assess implementation quality but cannot choose the lasting contract on behalf of feature owners.

Before merge

  • Resolve merge risk (P1) - The three new method names and their operator.read/operator.admin scopes become an additive plugin Gateway contract for Control UI and any future clients; their long-term support boundary needs explicit maintainer acceptance.
  • Resolve merge risk (P1) - Rollback intentionally preserves ingestion cursors, so operators cannot use rollback to re-stage the same retained-session history; the UI warns about this, but maintainers should confirm that this is the intended permanent recovery model.
  • Complete next step (P2) - A maintainer must decide whether the new plugin Gateway surface and cursor-preserving rollback behavior are the intended permanent operator contract before merge.
Agent review details

Security

None.

PR surface

Source +880, Tests +466. Total +1346 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 7 916 36 +880
Tests 4 467 1 +466
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 1383 37 +1346

Review metrics

Metric Value Why it matters
Gateway contract 3 methods added: 1 read-scoped, 2 admin-scoped These additive plugin Gateway methods are the durable boundary between the Control UI and Memory Core’s session-backfill executor.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/memory-core/index.ts, migration/backfill/repair: extensions/memory-core/src/session-backfill-gateway.test.ts, migration/backfill/repair: extensions/memory-core/src/session-backfill-gateway.ts, migration/backfill/repair: extensions/memory-core/src/session-backfill.test.ts, migration/backfill/repair: ui/src/i18n/locales/en.ts, migration/backfill/repair: ui/src/pages/memory-import/memory-import-page.test.ts, and 18 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Confirm and merge the supported Gateway contract (recommended)
    Record maintainer acceptance of the three additive method names, scopes, and cursor-preserving rollback behavior, then merge once required checks finish.
  2. Require a narrower operator contract
    Pause for a targeted revision if maintainers want a different authorization or retry/rollback model before clients can depend on it.

Technical review

Best possible solution:

Accept the three method identifiers, authorization scopes, and cursor-preserving rollback semantics as the supported Memory Core Gateway contract, then merge the UI layer with its existing executor and proof coverage.

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

Not applicable as a bug reproduction: this is a new Control UI capability, and the provided real-browser evidence shows preview, apply, and rollback against retained-session data.

Is this the best way to solve the issue?

Unclear pending maintainer intent: reusing the canonical CLI executor is the right implementation boundary, but accepting the three public Gateway methods and rollback semantics is a product and API-contract decision.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a useful operator-facing Memory Core enhancement with bounded blast radius, pending maintainer contract confirmation.
  • merge-risk: 🚨 compatibility: New named plugin Gateway methods and authorization scopes may become a supported client contract after merge.
  • merge-risk: 🚨 session-state: Apply and rollback operate on persisted backfill cursors and staged memory entries, so the permanent recovery semantics need explicit acceptance.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The supplied linked browser validation demonstrates the after-fix preview, database-backed apply, and selective rollback results with retained-session data.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied linked browser validation demonstrates the after-fix preview, database-backed apply, and selective rollback results with retained-session data.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the merged provenance-gated memory redesign and retained-session backfill that define the executor, cursor, and staging contracts this Control UI layer consumes. (role: feature owner; confidence: high; commits: 28630a9a6501, f0bf74bad477; files: extensions/memory-core/src/session-backfill.ts, extensions/memory-core/index.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record explicit acceptance or requested changes for the method names, scopes, and cursor-preserving rollback semantics.

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 (1 earlier review cycle)
  • reviewed 2026-07-28T15:44:25.288Z sha 6f228ec :: needs maintainer review before merge. :: none

@steipete
steipete merged commit ca48f6c into main Jul 28, 2026
117 checks passed
@steipete
steipete deleted the feat/memory-backfill-ui branch July 28, 2026 16:57
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 28, 2026
…etwork-none

* origin/main:
  feat(memory): backfill past sessions from Control UI (#115266)
  docs: link macOS onboarding pages to app download (#111361)
vincentkoc added a commit that referenced this pull request Jul 28, 2026
…-20260728

* origin/main:
  fix(tui): order delayed prompts before completed replies (#115219)
  feat(macos): enable Computer Control by default and diagnose stale Accessibility grants (#115280)
  fix(qa): restore full-stack scenarios and truthful suite exits (#115290)
  feat(memory): backfill past sessions from Control UI (#115266)
  docs: link macOS onboarding pages to app download (#111361)
  feat(skills): shared authoring standards make learned skills routable (#115103)
  fix(matrix): suppress previews for modifying hooks
  fix: prevent node gateway hangs and runaway local inference (#115248)
  refactor(ui): adopt @lit/task across remaining page surfaces (#115274)
vincentkoc added a commit to christian-lallo/openclaw that referenced this pull request Jul 28, 2026
* origin/main: (62 commits)
  feat(macos): enable Computer Control by default and diagnose stale Accessibility grants (openclaw#115280)
  fix(qa): restore full-stack scenarios and truthful suite exits (openclaw#115290)
  feat(memory): backfill past sessions from Control UI (openclaw#115266)
  docs: link macOS onboarding pages to app download (openclaw#111361)
  feat(skills): shared authoring standards make learned skills routable (openclaw#115103)
  fix(matrix): suppress previews for modifying hooks
  fix: prevent node gateway hangs and runaway local inference (openclaw#115248)
  refactor(ui): adopt @lit/task across remaining page surfaces (openclaw#115274)
  fix(slack): cap chat.update edit text at the 4000-char limit, not the 8000 send limit (openclaw#115027)
  [AI-assisted] docs: recommend Node 26 in quickstart, landing, and platform install docs (openclaw#115064)
  refactor(workboard): tidy Control UI card execution helpers (openclaw#115195)
  perf(agents): amortize history-limit eviction with hysteresis (openclaw#115273) (openclaw#115281)
  fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (openclaw#115232)
  fix: restore Fish completion after global CLI options (openclaw#115222)
  refactor(agents): collapse the client-tool catalog branch (openclaw#115212)
  fix(macos): signed rebuild no longer stalls on app shutdown (openclaw#103957)
  fix(agents): prevent repeated Code Mode output across waits (openclaw#115213)
  refactor(ui): split Profile (identity) from Usage (statistics) (openclaw#115245)
  fix(channels): report a channel that cannot receive as unhealthy instead of connected (openclaw#115229)
  fix(cli): reject malformed infer model refs (openclaw#115225)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
* feat(memory): expose session backfill gateway methods

* feat(ui): add session memory backfill controls

* fix(memory): keep session backfill internals private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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: 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