Skip to content

refactor: keep outbound queue operations on their admitted connection - #148355

Merged
steipete merged 1 commit into
mainfrom
codex/outbound-queue-kernels-20260914
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/outbound-queue-kernels-20260914

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144592

What Problem This Solves

Maintainer-requested outbound worker scheduling needs reusable queue operations that stay on the caller's admitted SQLite connection.

User Impact

No user-visible change: retained API return contracts, pending-only reads, stored data, claim behavior, and media retention remain unchanged.

Why This Change Was Made

Extract synchronous connection-bound kernels and have the existing facades consume them immediately. Facades retain connection selection and write admission; filesystem cleanup still follows durable settlement. Claim IDs, timestamps, and terminal preparation retain their original ordering. Shared media-path helpers and namespace constants keep kernels independent of runtime facades. Remove the internal expiry wrapper whose only caller moved to its existing kernel, and remove the media facade's stale assertion allowance.

Storage compatibility: the schema/version, queue namespace strings, entry JSON shapes, completion receipts, media retention policy, and migration-source reads are unchanged. This extraction requires no data migration. The existing namespace, ACK, media, and compound-settlement/reopen tests exercise those retained contracts.

Evidence

  • All 12 selected existing positive tests pass across claim/compound settlement, namespace ownership, ACK lifecycle, and media staging; every test file is unchanged.
  • The full scoped check-changed gate passes against ee0cf16623068ff535cc20f4a1ce175c8c5b8d25 for all 13 changed files, including core and full core-test types, lint, all three dead-export scans, and the remaining guards.
  • Fresh independent P0–P2 review is scoped-clean; final whitespace check passes.

This is the lasting kernel-extraction preparation cut. Worker activation is separate work.

Exact-head CI passed at 2d77ada4f61e6932d506a811a88c14825b57bb8b after a patch-identical refresh that included the already-landed Wizard test fix (#148337). All 13 reviewed source hashes remained unchanged.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check could not safely complete for this revision.

ClawSweeper will not retry this unchanged revision.

Next step: No contributor action is requested. Maintainers should inspect the linked workflow run.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 14, 2026 16:02
@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Sep 14, 2026
@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 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 14, 2026, 2:03 PM ET / 18:03 UTC (Revision 2).

ClawSweeper review

What this changes

The PR extracts reusable SQLite queue operations while preserving existing delivery claims, settlement, and attachment cleanup behavior.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open as useful, maintainer-requested preparation work. No blocking defect was found, and the earlier migration-proof blocker is not supported by the introduced diff.

Priority: P2
Reviewed head: 2d77ada4f61e6932d506a811a88c14825b57bb8b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent extraction with retained behavioral coverage and no identified correctness or compatibility blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal extraction is exempt from external-contributor runtime proof; retained SQLite tests and supplied CI results support validation without constituting a live delivery demonstration.
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 internal extraction is exempt from external-contributor runtime proof; retained SQLite tests and supplied CI results support validation without constituting a live delivery demonstration.
Evidence reviewed 7 items Admission remains with the existing facade: Claim operations retain runOpenClawStateWriteTransaction and pass its database into the extracted implementation. The existing transaction helper supports nested savepoints; the extraction does not replace the outer admission owner.
Settlement and cleanup ordering preserved: The ACK facade obtains cleanup paths from the database operation before releasing files. Unsent retirement retains its current-claim checks and creates media retention on the same supplied connection before removing custody.
No introduced stored-model change: The state schema, queue row types, serialization owner, and existing low-level mutation implementation are unchanged. All six namespace values are preserved, as are media migration-source reads and retention semantics. This resolves the previous review’s generic upgrade-proof concern without requiring a migration.
Findings None None.
Security None None.

How this fits together

OpenClaw’s outbound queue stores pending messages and attachment custody until delivery settles. Its database operations coordinate claims, recovery, and completion before attachment files can be released.

flowchart TD
  A[Outbound delivery or recovery] --> B[Queue facade selects database]
  B --> C[Existing write admission]
  C --> D[Connection-bound queue operations]
  D --> E[SQLite claims and settlement]
  E --> F[Attachment cleanup after settlement]
Loading

Before merge

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

Security

None.

PR surface

Source +271, Other -1. Total +270 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 12 1049 778 +271
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 13 1049 779 +270

Review metrics

Metric Value Why it matters
Production versus test growth Production net +271 lines; tests unchanged The growth supports reusable connection-bound operations while retaining admission facades; existing behavioral tests remain applicable.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/outbound/delivery-queue-media-staging.ts, migration/backfill/repair: src/infra/outbound/delivery-queue-namespaces.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep queue mutations owned by one connection-bound implementation, with existing facades retaining admission and filesystem cleanup following durable settlement.

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

Not applicable: this is a behavior-preserving extraction, and source review found no introduced failure to reproduce.

Is this the best way to solve the issue?

Yes. The extraction follows the existing store-owner pattern, reuses established serialization and transaction helpers, and leaves worker activation to separate work.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8430fcfb40ba.

Labels

Label justifications:

  • P2: This is bounded preparation for the requested asynchronous storage work, with no identified 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 internal extraction is exempt from external-contributor runtime proof; retained SQLite tests and supplied CI results support validation without constituting a live delivery demonstration.

Evidence

What I checked:

  • Admission remains with the existing facade: Claim operations retain runOpenClawStateWriteTransaction and pass its database into the extracted implementation. The existing transaction helper supports nested savepoints; the extraction does not replace the outer admission owner. (src/infra/delivery-queue-sqlite-claim.ts:42, 2d77ada4f61e)
  • Settlement and cleanup ordering preserved: The ACK facade obtains cleanup paths from the database operation before releasing files. Unsent retirement retains its current-claim checks and creates media retention on the same supplied connection before removing custody. (src/infra/outbound/delivery-queue-ack.ts:57, 2d77ada4f61e)
  • No introduced stored-model change: The state schema, queue row types, serialization owner, and existing low-level mutation implementation are unchanged. All six namespace values are preserved, as are media migration-source reads and retention semantics. This resolves the previous review’s generic upgrade-proof concern without requiring a migration. (src/infra/outbound/delivery-queue-namespaces.ts:1, 2d77ada4f61e)
  • Existing behavioral coverage: Retained tests exercise compound settlement commit/rollback after reopening, expired and replaced claims, namespace ownership, captured state roots, and attachment retention. The PR body reports 12 selected passing tests and scoped checks; this read-only review inspected coverage and did not execute tests. (src/infra/delivery-queue-sqlite-claim.test.ts:29, 2d77ada4f61e)
  • Still distinct from current main: The existing affected queue files are unchanged between the pinned base and fetched main, and the extracted claim kernel is absent from fetched main and v2026.9.4. The broader open storage work remains tracked at Complete asynchronous runtime storage boundaries while retaining SQLite #144592; this PR is a preparation step, not completion of that issue. (src/infra/delivery-queue-sqlite-claim.ts, 8430fcfb40ba)
  • Area-history routing: Current-main history identifies Peter Steinberger’s earlier connection-acquisition and captured-state work. GitHub commit metadata independently maps the earlier extraction commit to steipete. These establish routing relevance beyond authorship of this PR, without claiming original feature introduction. (src/infra/outbound/delivery-queue-ack.ts, 61d347417812)

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-14T16:24:07.534Z sha f1a1202d921eda9a9435c83e6dd49ac62a5bb5dc :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/outbound-queue-kernels-20260914 branch from f1a1202 to 2d77ada Compare September 14, 2026 16:36
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit bd2b841 into main Sep 14, 2026
191 checks passed
@steipete
steipete deleted the codex/outbound-queue-kernels-20260914 branch September 14, 2026 18:38
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: 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