Skip to content

refactor(memory): await standing intent operations - #144832

Merged
steipete merged 1 commit into
mainfrom
codex/async-memory-runtime
Sep 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/async-memory-runtime

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #144592

What Problem This Solves

Standing-intent tools and hooks assume database work has completed when their synchronous store calls return. They need to retain the operation and propagate its result when database admission becomes asynchronous.

Why This Change Was Made

Await create, list, sweep, cancel and match through the existing asynchronous agent-database owner, including actual tool and registered hook callers. Keep native schema, lifecycle, FTS selection and claim transactions synchronous and intact; pure scope and context helpers remain synchronous.

User Impact

Tool results and prompt injection wait for the corresponding store operation. Rejections reach the existing error policy, and an operation retains its originally selected database across ambient path changes. Durable formats, eligibility and firing budgets are unchanged.

Evidence

  • 53 focused cases passed using real isolated SQLite, registered hooks, tool calls and fresh reopen checks.
  • Twelve delayed/rejected admission regressions fail against original source for the intended missing-await boundaries, then pass on the candidate.
  • Full selected checks, SDK export/type checks and fresh independent Codex P2 review passed.
  • No full build was run; this exports an existing owner from an already-imported private-local SDK module.
  • This is API groundwork. Native SQLite still executes on the caller thread until the shared worker cutover.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-core Extension: memory-core size: L maintainer Maintainer-authored PR labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 11, 2026, 6:59 AM ET / 10:59 UTC (Revision 2).

ClawSweeper review

What this changes

Makes Memory Core’s event-triggered reminder operations asynchronous and updates tools, hooks, documentation, and tests to await completion.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this useful, maintainer-authored PR open. No blocking defect was found, and the previous migration-proof blocker is unsupported: the introduced changes preserve schemas, stored values, and transaction boundaries.

Priority: P2
Reviewed head: 05eff8441d67b985ab963191b4438fd3b13de356

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-and-caller conversion with meaningful boundary coverage and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its reported real-SQLite tests exercise awaited tool and registered-hook completion, rejection, and retained database identity; this review inspected their source without executing them.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its reported real-SQLite tests exercise awaited tool and registered-hook completion, rejection, and retained database identity; this review inspected their source without executing them.
Evidence reviewed 8 items Complete operation and caller conversion: Create, list, cancel, sweep, and match use the existing asynchronous database owner. All production call sites found in the tool and registered hooks await their results; scope checks and fire-budget updates remain inside synchronous transactions.
Existing admission owner preserves connection identity: The admission owner snapshots path inputs, checks cancellation and current cached connection before invoking the operation, checks maintenance and deletion access, and retains the connection through settlement. This PR reuses that owner without changing it.
Prior migration concern reassessed: The schema, database-open implementation, and admission owner have no introduced changes. Inspection of the complete standing-intent diff also found no changed serialization, defaults, SQL predicates, or transaction boundaries. The earlier review's generic migration-proof request therefore does not establish a remaining blocker.
Findings None None.
Security None None.

How this fits together

Memory Core stores event-triggered reminders in each agent’s SQLite database. Agent tools manage reminders, while prompt and scheduled-turn hooks match or maintain them before returning results.

flowchart TD
  A[Agent tool requests] --> C[Standing intent operations]
  B[Prompt and scheduled hooks] --> C
  C --> D[Asynchronous database admission]
  D --> E[Synchronous SQLite transactions]
  E --> F[Awaited results or errors]
  F --> G[Tool response or reminder context]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +8, Tests +357, Docs 0. Total +365 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 32 24 +8
Tests 2 418 61 +357
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 451 86 +365

Review metrics

Metric Value Why it matters
Production versus test growth Production net +8 lines; tests net +357 lines Small production growth completes the asynchronous contract; most added code exercises waiting, rejection, persistence, and concurrency boundaries.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/memory-core/src/standing-intents.ts, vector/embedding metadata: extensions/memory-core/src/standing-intents-tool.ts, vector/embedding metadata: extensions/memory-core/src/standing-intents.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep domain operations awaitable through the existing database owner while preserving synchronous claims, reminder eligibility, and durable formats.

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

Not applicable: this is asynchronous-contract groundwork, not a demonstrated current-main failure; delayed-admission tests target the intended completion boundaries.

Is this the best way to solve the issue?

Yes: the patch converts complete operations and their callers through the existing admission owner without duplicating storage logic or changing the data model.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 227e7ae26af4.

Labels

Label justifications:

  • P2: This is a bounded runtime-storage improvement supporting an explicitly requested conversion, without evidence of an urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 maintainer-authored PR is exempt from the external-contributor proof gate. Its reported real-SQLite tests exercise awaited tool and registered-hook completion, rejection, and retained database identity; this review inspected their source without executing them.

Evidence

What I checked:

  • Complete operation and caller conversion: Create, list, cancel, sweep, and match use the existing asynchronous database owner. All production call sites found in the tool and registered hooks await their results; scope checks and fire-budget updates remain inside synchronous transactions. (extensions/memory-core/src/standing-intents.ts:76, 05eff8441d67)
  • Existing admission owner preserves connection identity: The admission owner snapshots path inputs, checks cancellation and current cached connection before invoking the operation, checks maintenance and deletion access, and retains the connection through settlement. This PR reuses that owner without changing it. (src/state/openclaw-agent-db-admission.ts:67, 05eff8441d67)
  • Prior migration concern reassessed: The schema, database-open implementation, and admission owner have no introduced changes. Inspection of the complete standing-intent diff also found no changed serialization, defaults, SQL predicates, or transaction boundaries. The earlier review's generic migration-proof request therefore does not establish a remaining blocker. (src/state/openclaw-agent-standing-intents-schema.ts:42, 05eff8441d67)
  • SDK change stays within the existing private-local surface: The sole SDK addition re-exports an existing owner from an already-imported module; documentation explicitly describes sqlite-runtime as private-local and explains callback execution remains on the caller thread. No public standing-intent API or new SDK subpath is introduced. (src/plugin-sdk/sqlite-runtime.ts:10, 05eff8441d67)
  • Focused boundary coverage: The new suite covers delayed and rejected tool operations, registered prompt and maintenance hooks, concurrent fire-budget claims, fresh database reopen, and ambient path changes. It uses real SQLite with an injected admission delay. The captured PR body reports 53 focused cases passing and 12 regressions failing on original source; these execution claims were not independently rerun in this read-only review. (extensions/memory-core/src/standing-intents.async.test.ts:171, 05eff8441d67)
  • Work remains absent from fetched main and latest release: Fetched main still calls openOpenClawAgentDatabase synchronously for standing intents. The latest supplied release, v2026.9.4, also contains that synchronous wrapper, so the asynchronous conversion is not redundant. (extensions/memory-core/src/standing-intents.ts:76, 3a9d69db306c)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-09-11T10:09:00.597Z sha 05eff84 :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review September 11, 2026 10:55
@steipete

Copy link
Copy Markdown
Contributor Author

Compatibility confirmation: this changes awaited admission and callers, with no changes to the SQLite schema, stored scope encoding, serialization, eligibility predicates, firing limits or native claim transaction. The existing agent-database owner captures the database identity and retains it through settlement.

The 53-case suite uses real isolated SQLite and covers registered tools/hooks, concurrent firing claims and fresh reopen. Twelve delayed/rejected admission cases fail against the prior source at the missing-await boundary and pass after conversion. No data migration is required. The review narrative also confirms the original generic migration concern is unsupported by the actual diff.

@steipete
steipete merged commit 4ca5928 into main Sep 11, 2026
254 checks passed
@steipete
steipete deleted the codex/async-memory-runtime branch September 11, 2026 14:26
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
* commit 'f2ce199238e974b1d4caff8f11112aa51eb00d9e': (310 commits)
  refactor(copilot): deduplicate transcript user text (#144888)
  refactor(sessions): await discovery and config readiness (#144854)
  refactor(e2e): deduplicate release file assertions (#144904)
  ci: keep growing hosted test plans within the job cap (#144965)
  fix(macos): avoid stale dashboard command assertions (#144710)
  refactor(memory): await standing intent operations (#144832)
  refactor(ui): derive native device settings types from schemas (#144705)
  refactor(memory): await journal operations and allocate sequences atomically (#144824)
  refactor(tests): share command field assertions (#144955)
  refactor(matrix): share bounded context cache insertion (#144939)
  refactor(i18n): share Apple catalog reader (#144848)
  fix(doctor): preserve legacy registry files when quarantine fails (#144787)
  refactor(tests): reuse PixVerse auth fixtures (#144926)
  fix(bonjour): silence transient ENODEV socket warnings (#144870)
  fix(matrix): preserve unrelated files when migration fails (#144883)
  feat(sqlite): run Team Reports storage in owned workers (#144871)
  fix(update): install explicit same-version artifacts (#144894)
  refactor(ui): share cached message extraction (#144244)
  refactor: normalize Claude usage responses at one boundary (#144707)
  refactor: simplify CLI child listener registration (#144929)
  ...
steipete added a commit that referenced this pull request Sep 11, 2026
…45107)

Give each before_prompt_build handler an ephemeral result-acceptance
capability and revoke it when the runner stops awaiting that handler.
Memory Core checks it after lazy loading and before its synchronous
standing-intent effects, preserving live callers of a shared database open.

Missing host support produces a diagnostic without consuming a reminder.
Document the optional SDK capability and cover timed-out, settled, and
coalesced callers. Underlying work retains its existing cleanup lifecycle.

Related: #144832
Validation: 91 focused tests, selected changed checks, and independent P2 review.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
…enclaw#145107)

Give each before_prompt_build handler an ephemeral result-acceptance
capability and revoke it when the runner stops awaiting that handler.
Memory Core checks it after lazy loading and before its synchronous
standing-intent effects, preserving live callers of a shared database open.

Missing host support produces a diagnostic without consuming a reminder.
Document the optional SDK capability and cover timed-out, settled, and
coalesced callers. Underlying work retains its existing cleanup lifecycle.

Related: openclaw#144832
Validation: 91 focused tests, selected changed checks, and independent P2 review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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