Skip to content

fix(active-memory): restore SQLite recall sessions - #105255

Merged
vincentkoc merged 10 commits into
mainfrom
fix/qa-memory-sqlite-seed-20260712
Jul 12, 2026
Merged

vincentkoc merged 10 commits into
mainfrom
fix/qa-memory-sqlite-seed-20260712

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Jul 12, 2026 •

Copy link
Copy Markdown
Member

Related: #100167

What Problem This Solves

Fixes an issue where Active Memory recall stopped producing pre-prompt context after session storage moved to SQLite. Embedded recall runs used a transient session identity that was not present in the canonical registry, so strict plugin session ownership could reject the run; QA memory scenarios also still seeded retired JSONL/session-index state.

Why This Change Was Made

Creates each recall session through the canonical SQLite session-store API, uses a unique session key per run, preserves configured transcript artifacts, and removes the transient registry/transcript state after completion. QA scenarios now seed transcript events through the same SQLite runtime path. Cleanup retries remain bounded, cleanup failures are surfaced, and temporary workspaces are still removed if registry cleanup fails.

User Impact

Active Memory can provide pre-prompt recall again under SQLite-backed sessions without leaving transient session rows, transcript artifacts, or temporary workspaces behind. Repeated or overlapping recalls remain isolated.

Evidence

  • Wrapper-owned Testbox tbx_01kxawxbdj8vb91ne98fq3ecc6: Active Memory tests 169/169 and QA runtime tests 15/15 passed.
  • Same Testbox: session-memory-ranking and active-memory-preprompt-recall passed in .artifacts/qa-e2e/memory-final-c9f8f37d3a5/qa-suite-summary.json.
  • Fresh wrapper-owned Testbox tbx_01kxax74rpm0m0sdtbp7vxrqjg: scoped pnpm check:changed passed for the 12 PR paths, including Plugin SDK baseline, tsgo with root-level noUncheckedIndexedAccess, all oxlint shards, and runtime import cycles.
  • Fresh structured autoreview returned no accepted/actionable findings. The final landing-policy cleanup removed the release-owned changelog entry; the runtime, test, and scenario patch remained unchanged from the reviewed and tested diff.

@vincentkoc vincentkoc self-assigned this Jul 12, 2026
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 12, 2026
@clawsweeper

clawsweeper Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 6:07 AM ET / 10:07 UTC.

Summary
The PR registers each Active Memory embedded recall as a unique SQLite-backed session, removes its transient session/transcript state after the run, and migrates QA memory scenarios to canonical SQLite transcript seeding.

PR surface: Source +186, Tests +396, Docs +1, Other -27. Total +556 across 12 files.

Reproducibility: yes. at source level. The linked release report gives a consistent log-based reproduction, and current main visibly lacks the canonical SQLite session row required by the strict plugin ownership path; this read-only review did not independently execute the deployment.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: qa/scenarios/memory/session-memory-ranking.yaml, unknown-data-model-change: qa/scenarios/memory/active-memory-preprompt-recall.yaml, unknown-data-model-change: qa/scenarios/memory/session-memory-ranking.yaml, vector/embedding metadata: extensions/qa-lab/src/suite-runtime-agent-session.test.ts, vector/embedding metadata: qa/scenarios/memory/active-memory-preprompt-recall.yaml. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #100167
Summary: This PR is the direct candidate fix for the released Active Memory recall timeout and empty-context regression.

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.

Next step before merge

  • [P2] This active maintainer-authored implementation has no actionable review defect; normal draft, CI, and landing review should proceed without a separate repair job.

Security
Cleared: The patch introduces no dependency, workflow, permission, secret-handling, package-resolution, download, or third-party execution changes.

Review details

Best possible solution:

Land the canonical per-run SQLite registration and exact lifecycle cleanup after the PR leaves draft state and passes the repository's normal exact-head landing gates.

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

Yes at source level. The linked release report gives a consistent log-based reproduction, and current main visibly lacks the canonical SQLite session row required by the strict plugin ownership path; this read-only review did not independently execute the deployment.

Is this the best way to solve the issue?

Yes. Registering the embedded recall through the canonical session-store API fixes the ownership invariant without adding a fallback, while unique identities and storage-boundary checks keep cleanup isolated.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P1: This fixes a released Active Memory regression that disables recall and adds an approximately 15-second delay to every affected turn.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The contributor proof gate does not apply to this maintainer-authored PR, though its exact-head Testbox and live QA scenario results provide strong supplemental behavior evidence.

Label justifications:

  • P1: This fixes a released Active Memory regression that disables recall and adds an approximately 15-second delay to every affected turn.
  • 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. Not applicable: The contributor proof gate does not apply to this maintainer-authored PR, though its exact-head Testbox and live QA scenario results provide strong supplemental behavior evidence.
Evidence reviewed

PR surface:

Source +186, Tests +396, Docs +1, Other -27. Total +556 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 5 214 28 +186
Tests 4 423 27 +396
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 2 28 55 -27
Total 12 666 110 +556

What I checked:

  • Current-main behavior: Current main has no recall-session creation or cleanup helper and no QA SQLite transcript seeding helper, so the central regression fix is not already implemented. (extensions/active-memory/index.ts:3190, 199993510897)
  • Canonical session registration: Before invoking the embedded agent, the branch creates a unique session key and exact SQLite marker, inserts a plugin-owned entry through patchSessionEntry, and passes the same identity as the embedded run's session target. (extensions/active-memory/index.ts:3217, 782acc63629b)
  • Cleanup safety: The branch persists configured artifacts before cleanup, retries bounded lifecycle deletion, surfaces deletion failure, and still removes the temporary workspace from an outer finally block. (extensions/active-memory/index.ts:3153, 782acc63629b)
  • Storage-boundary concurrency guard: SQLite lifecycle cleanup filters by the per-run session-key segment, plans under an exclusive write boundary, and refuses deletion if the row changed before the transaction applies it. (src/config/sessions/session-accessor.sqlite.ts:3936, 199993510897)
  • Focused validation: The PR body reports exact-head Testbox success for 169 Active Memory tests, 15 QA runtime tests, both affected QA memory scenarios, and changed-file checks; the branch adds regression coverage for creation/removal, overlap, persistence, cleanup failure/retry, and workspace cleanup. (extensions/active-memory/index.test.ts:438, 782acc63629b)
  • Direct Codex dependency contract: At Codex upstream head, turn/start requires an input vector, Text maps unchanged to CoreUserInput::Text, and the turn processor submits those mapped items as Op::UserInput; the fix correctly targets OpenClaw session ownership rather than replacing prompt delivery. (codex-rs/app-server-protocol/src/protocol/v2/turn.rs:68, 9e552e9d15ba)

Likely related people:

  • Takhoffman: Introduced the bundled Active Memory plugin and carried most of its early recall, diagnostics, model, and prompt-prefix work. (role: feature introducer; confidence: high; commits: b83726d13e33, f94d6778b1d5, 9d126dc64584; files: extensions/active-memory/index.ts, extensions/active-memory/index.test.ts)
  • steipete: Introduced and maintained the Plugin SDK session-store surface and adjacent SQLite session lifecycle behavior used by this fix. (role: session-store API contributor; confidence: high; commits: a71b810e43f8; files: src/plugin-sdk/session-store-runtime.ts, src/config/sessions/session-accessor.sqlite.ts)
  • danhdoan: Introduced incoming-prompt forwarding into context-engine assembly, an adjacent contract involved in the linked zero-message diagnosis. (role: context-engine contract contributor; confidence: medium; commits: e78129a4d93e; files: src/context-engine/types.ts, src/context-engine/context-engine.test.ts, src/agents/embedded-agent-runner/run/attempt.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.

@vincentkoc
vincentkoc force-pushed the fix/qa-memory-sqlite-seed-20260712 branch from 782acc6 to 2d320b0 Compare July 12, 2026 10:26
@vincentkoc
vincentkoc marked this pull request as ready for review July 12, 2026 10:27
@vincentkoc
vincentkoc merged commit 2148c3b into main Jul 12, 2026
105 of 108 checks passed
@vincentkoc
vincentkoc deleted the fix/qa-memory-sqlite-seed-20260712 branch July 12, 2026 10:29
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 13, 2026
* fix(qa): seed memory scenarios through SQLite

* fix(active-memory): initialize SQLite recall sessions

* test(active-memory): model missing harness reservation

* fix(active-memory): clean up transient recall sessions

* fix(active-memory): isolate concurrent recall sessions

* fix(active-memory): discard transient SQLite recalls

* fix(active-memory): preserve transient recall boundaries

* fix(active-memory): retry transient recall cleanup

* fix(active-memory): always clean transient recall workspaces

* chore: drop release-owned changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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