Skip to content

refactor(conversations): move binding and delivery authority to workers - #166259

Merged
steipete merged 21 commits into
mainfrom
dbasync/w6binding
Oct 7, 2026
Merged

steipete merged 21 commits into
mainfrom
dbasync/w6binding

Conversation

@steipete

@steipete steipete commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Conversation discovery, binding mutations, and delivery recovery execute SQLite work on the Gateway thread and repeat reads for every discovered address.

User Impact

Moves this work to the existing database workers and batches address registration and binding inspection while preserving routing, delivery receipts, live revocation checks and released SDK signatures. No new service, schema, configuration, environment name, retention policy, or user action is introduced.

Why This Change Was Made

The agent executor owns conversation rows; the shared-state worker owns current bindings and delivery recovery. Registration batches return the listing in the same request. Mutations compare expected ownership against transaction-local rows, and listings refresh every requested session after expiry-pruning waits. Main's canonical shared-worker write operation owns binding mutations; the duplicate transaction context was removed during integration with #166444.

The final conversation check surrounds the concrete platform-method handoff. Revocation before initiation prevents the send; the database transaction and FIFO release before transport settlement. Accepted work is joined, and an uncertain native settlement never authorizes replay. Slack supplies an optional batch route preparer while retaining its scalar resolver for older supported hosts.

Released synchronous selectors remain compatible with v2026.9.8 and v2026.10.1-beta.1, including getConversationSession, binding service/manager selectors, and synchronous authority guards. Deprecation record conversation-binding-sync-mutations retains its next-Plugin-SDK-major removal gate; type assertions cover these contracts. Registration already returned a Promise and is not reachable through released SDK exports, documented subpaths, or api.runtime.*.

Short, indexed reads of other owners' binding state remain inside routing grants to preserve immediate revocation checks. Follow-up debt: src/gateway/conversation-route-ownership.ts:284,326,346, via src/infra/outbound/session-binding-service.ts:399. Same-owner conversation facts come from the worker transaction. The compiled-wrapper inventory and import closures are checked.

Evidence and Current Readiness

Published candidate: 69d5f7a5ad7aa9bf2f2873896a20c65c4ac2570e, tree f7b603fc87d72e2a4ef9bdb32177b72f95175adb. Main 3856df48f5c953b26d17938b6888dfa2f3fa826d was integrated through merge commits fbd403d26c970 and 2f53a69c274f5, resolving real conflicts with #166621 and #166659. The final repair retains all four live authority checks and reuses serialized binding rows only after the existing read owner freshly confirms the same schema, foreign-commit and local-mutation revision. Expiry and returned objects are evaluated afresh; write transactions, pinned snapshots and authorizer-controlled reads bypass the bounded cohort. The read callback now consumes the admission's existing scope, adding no extra freshness probe.

The final correction 69d5f7a5ad7a moves the cached-map lookup into the existing admission owner and uses toReversed() in the regression test. It resolves the normal lint diagnostics without changing row reuse or authority semantics. Five-file local lint passes (27.39 s), 52 focused tests across four files pass (188.74 s), core types (29.29 s) and core-test types (424.93 s) pass, and a fresh P0–P2 review is scoped-clean. Earlier import-closure and zero-cycle proof remains applicable; no imports changed in this correction.

Merged through native scripts/pr as 699a3c58bf28512d6b46a48f6f13447457a10172 at 2026-10-07 19:08:30 UTC. Exact-head CI 37669251529, required gates, SQL qualification, local SDK diff and completed ClawSweeper review all passed admission. No admin exception or security waiver was used. The reviewed head was 69d5f7a5ad7aa9bf2f2873896a20c65c4ac2570e; the landed commit is verified on main. Historical failed counts and checks below remain explicitly attributed to their source heads.

Qualified final-head all-thread SQL comparison (69d5f7a5 / 3856df48)

One unchanged alternating main/candidate comparison completed all six full workloads and focused probes on isolated Linux through native Crabbox (run_4113ce0bc6a9f33b0e22b953e76a0b79). All 19 harness/probe hashes are unchanged. The earlier 6dd lint attempt executed zero measurements. Functional assertions pass and all phase duration ratios satisfy the 1.5 limit; first-turn, warmed-total and combined compaction/shutdown ratios are 0.9942, 1.0010 and 1.0012. The lease stopped and all owned remote processes, worktrees, proof/payload files and archive links were removed after verified download.

Phase or complete flow Main Candidate Disposition
First-turn median 4,680 4,631 Pass, −49
Median warmed mean per turn 1,593.0 1,558.3 Pass, −34.7; every warmed position improves
Second-session median 5,343 5,240 Pass, −103
Control-plane median 51 50 Pass, −1
Cron median 1,599 1,576 Pass, −23
Compaction + shutdown median 1,702 1,702 Pass under the adjacent-window rule
Complete sends, three repetitions 287 / 266 / 266 226 / 205 / 205 Pass; original ceilings 260 / 245 / 253
Generic directory, 1 / 3 / 10 addresses 12 / 26 / 75 9 / 9 / 9 Pass in every repetition
Bound and Slack directories, 1 / 3 / 10 addresses 10 / 20 / 55 9 / 9 / 9 Pass in every repetition
Mixed-expiry directory, 2 / 10 addresses 13 / 37 11 / 27 Pass in every repetition
Alternating pair Main compaction Main shutdown Main combined Candidate compaction Candidate shutdown Candidate combined Combined delta
1 1,336 366 1,702 1,427 275 1,702 0
2 1,342 360 1,702 1,360 339 1,699 −3
3 1,452 264 1,716 1,380 325 1,705 −11
Median 1,342 360 1,702 1,380 325 1,702 0

Compaction's standalone +38 median is existing background work moving across the adjacent shutdown boundary. Memory publication remains exactly 53 statements per workload: main compaction/shutdown splits are 0+53, 0+53 and 53+0; candidate splits are 53+0, 0+53 and 13+40. Plugin compare-and-apply remains exactly 56 statements per combined window. Both sources retain one memory attach, 117 create statements and 28 drop statements there. Content-marker reads decrease from 19 to 12. Every pair's combined count is equal or lower, so the median gate passes without a rerun or changed window.

All 38 positive combined full-stack variants have baseline native-site witnesses. Ten require the explicitly inspected cacheAdmission.refresh → read method mapping; both call the same byte-identical freshness primitive, and the new helper carries its existing scope through the reader instead of issuing another probe or worker request. Twenty-seven complete caller chains differ, so this is not a claim of identical full stacks. No new shutdown operation or per-item settlement loop was introduced.

Raw failures remain separate: main 0 / 0 / 0, candidate 1 / 0 / 1, all shutdown-only BEGIN IMMEDIATE lock refusals. Repetition 1 is the coordinator-classified synchronous restart-intent SIGTERM path (see #166528 citation below); repetition 3 is the existing audit-prune retry path. Those restart/audit modules and the native freshness primitive are byte-identical to the baseline. Every functional workload and graceful close completed; no failed attempt is counted as successful SQL or used as an inherited-CI exception.

The exact-head local SDK report passed in 273.86 seconds including cleanup and is byte-identical to the 6dd report: digest 81e882f7dc4aa3713539ae66298013ba7d936bacd835abd37b75cd25b25f489e, 195 affected exports, unchanged named declaration deltas, and no entrypoint changes. ClawSweeper completed this exact head at 2026-10-07 18:52:43 UTC, run 37669430627, with no actionable correctness or security finding; its prior size finding is resolved and its requested SQL/SDK qualification is supplied here. Inspected code introduces zero configuration options, defaults, schema versions, persisted formats or retention changes; the automatic config/schema path warning does not identify an actual compatibility change.

The repair passes 180 focused tests across 14 files, covering binding queries/mutations, live route authority, Slack, shared read admission and snapshots, runtime build graph and import closures. The initial grouped run took 419.94 seconds; one accidental three-read assertion in a separate single-read fixture was corrected and the complete six-test file passed in 17.80 seconds. The new regression itself passed in 261 ms and independently failed on the published pre-fix code (three domain selections versus one; 74.91-second cold negative-control run). It proves three fresh probes still occur while row selection is reused, plus foreign/local changes, expiry and returned-object isolation. No production failure, assertion weakening, sleep or timeout change was involved.

Core types (19.01 s), core-test types (326.38 s), zero-cycle Madge (28.07 s), formatting and diff checks pass. Independent P0–P2 review of the repair is scoped-clean with full revision/read-owner context; the unchanged preceding PR delta retains its clean full review. The preceding integration passed 285 tests across 30 files and its extension/root-test type lanes. Its eight-file lint passed on isolated Linux in 55.21 seconds after a local declaration prerequisite timed out at its normal 300-second budget. The changed files now receive their own normal-budget Linux lint gate with the new measurement.

CI 37666853036 on 6ddf09c7 failed check-lint-core-2 for the test's copied-array .reverse(). Its cache-owner file-size warning was also a hard error in the focused lint gate. Both are PR-caused and corrected by 69d5f7a5; the failed job log was retained once, and no old job was rerun. The isolated 6ddf09c7 attempt stopped at lint before any workload or probe; its resources were cleaned up. The new source receives one SQL-only comparison after passing lint locally.

Pre-fix CI 37661862312 and its required gate passed on 2f53a69c, with no failed or cancelled checks. This is prior-head evidence, not current-head CI; no admin exception is requested.

The local SDK report for 6ddf09c7 passed in 275.57 seconds including cleanup, digest 81e882f7dc4aa3713539ae66298013ba7d936bacd835abd37b75cd25b25f489e. It has 195 affected exports (193 reachable plus two equivalent aliases); the one additional reachable export, agentCommandFromIngress, has an identical declaration and a changed dependency-closure hash. All named declaration deltas match 2f53a69c; no entrypoint changes or new SDK incompatibility were found. The final correction report is complete and identical, as recorded above.

The pre-fix local SDK diff passed in 1,161.75 seconds including cleanup, digest a3fe4eba188b005ae11b6bd294193d14030d1ef6cf93022823477d45be70cd01: the same 194 affected exports (192 reachable and two equivalent aliases), no entrypoint additions/removals or newly affected exports. Its sole changed declaration delta moves optional withDirectAdapterHandoff into shared OutboundChannelContext with the same signature. The repair changes no released function signature; its exact-head report is complete, as recorded above.

ClawSweeper's durable review completed the pre-fix 2f53a69c at 2026-10-07 17:56 UTC, run 37662062194, with no actionable correctness or security findings. The final-head review is complete, as recorded above. The automatic SQLite-table/config compatibility warning is a path-classification false positive: there is no DDL, version, persisted-table, stored-format, configuration or default change. The detailed review also confirms unchanged formats.

Pre-fix integrated SQL comparison (2f53a69c / 3856df48)

One unchanged alternating main/candidate comparison completed all six full workloads and paired focused probes on isolated Linux. All 19 harness/probe hashes are unchanged. Functional assertions pass, every phase's candidate/main median duration ratio is at most 1.5, and the owned remote lease and scratch were stopped and removed. Successful statement totals include all threads and processes; failed attempts remain separate.

Phase or flow Main Candidate Disposition
First-turn median 4,681 4,637 Pass, −44
Median warmed mean per turn 1,594.7 1,558.9 Pass, −35.8; every warmed position improves
Second-session median 5,339 5,241 Pass, −98
Control-plane median 51 50 Pass, −1
Cron median 1,599 1,576 Pass, −23
Compaction + shutdown median 1,721 1,709 Pass, −12
Complete sends, three repetitions 287 / 266 / 266 240 / 219 / 219 Pass, below original ceilings
Generic directory, 3 / 10 addresses 26 / 75 13 / 13 Pass
Slack directory, 3 / 10 addresses 20 / 55 13 / 13 Pass
Single-address generic/list flow, each repetition 12 13 Pre-fix regression, +1; repair measurement pending
Single-address bound/Slack flow, each repetition 10 13 Pre-fix regression, +3; repair measurement pending
Alternating pair Main compaction Main shutdown Main combined Candidate compaction Candidate shutdown Candidate combined Combined delta
1 1,455 266 1,721 1,445 264 1,709 −12
2 1,458 266 1,724 1,335 372 1,707 −17
3 1,452 266 1,718 1,445 272 1,717 −1
Median 1,455 266 1,721 1,445 272 1,709 −12

Shutdown's standalone deltas are −2 / +106 / +6. Their exact attributed components are lease/integrity close −2 / −14 / −2, memory sync/publication 0 / +80 / 0, shared-state/schema admission 0 / +32 / 0, restart-intent admission 0 / +10 / 0, and audit writer 0 / −2 / +8. The +6 median is the existing audit retry's +8 offset by close's −2. All 24 positive combined full-stack variants map to native SQL sites present in baseline across all threads; the clean_close update moves between main and worker threads while retaining exactly one statement per workload. All 18 direct shutdown, memory, audit, lease and admission owner modules are byte-identical. The combined window decreases in every pair and by median; no new shutdown work is introduced.

That pre-fix candidate repetition 2 records two failed synchronous SIGTERM restart-intent attempts, matching the coordinator's inherited classification and #166528 baseline citation below. Repetition 3 also records one audit-prune lock refusal through the unchanged existing retry path. Failed attempts are retained separately; every workload and graceful close completed. No failing attempt is counted as successful SQL or used as an inherited CI exception.

The singleton regression is deterministic authority-inspection overhead, not timing noise. Candidate uses four live binding inspections: initial registration selection, transaction admission, commit admission and final list filtering. Each costs one PRAGMA data_version plus one batched selection, giving eight host statements plus five worker statements. Main uses two inspections plus one host registration insert: generic absent-row lookup costs seven host plus five worker statements; bound/Slack exact-hit lookup costs five host plus five worker statements. No empty-batch or additional worker-request cost was found. A scalar shortcut does not help because the scalar inspector already delegates to the batch owner. Removing only the redundant transaction-stage domain inspection would leave 11 total statements, still above bound/Slack main's 10. Initial filtering, pre-commit revocation and post-await response filtering protect distinct observable contracts; no guard was removed. The new repair reuses freshly qualified row bytes instead of removing authority checks; its measurement is pending.

Last qualified all-thread SQL comparison (e7b564ca / af18444d)

One unchanged alternating main/candidate comparison ran six full workloads and paired probes on isolated Linux. All functional assertions and focused receipts pass. Statement totals include Gateway main, workers and helper processes; prepares and failed attempts remain separately reported.

Phase/flow, median unless repetitions shown Main Candidate Disposition
First turn 5,776 5,732 Pass, −44
Warmed mean per turn 2,200.6 2,166.0 Pass, −34.6
Warm turn 01 2,199 2,167 Pass, −32
Second session 6,872 6,873 Pass, +1 (+0.015%), attributed below
Control plane 48 46 Pass, −2
Cron 1,699 1,692 Pass, −7
Compaction + shutdown 1,919 1,903 Pass, −16
Complete sends, three repetitions 292 / 271 / 271 245 / 224 / 224 Pass; original ceilings 260 / 245 / 253
Generic directory, 3 / 10 addresses 31 / 80 13 / 13 Pass
Slack directory, 3 / 10 addresses 25 / 60 13 / 13 Pass

Every warmed-turn position has a lower median. The first warm pair's +15 remains in the record: two extra retention aggregates add 41 helper statements while worker statements decrease 26. It does not fail the median gate. Second-session's +1 median is below the 2% allowance: maintenance plan snapshots vary from [14,8,8] to [8,13,13], and age snapshots from [24,14,15] to [14,24,23]. These are existing maintenance operations, including their transaction/freshness/publication work. Cron's positive third pair similarly has two extra current-projection transactions and one additional plan/age snapshot; its phase median decreases.

Alternating pair Main compaction Main shutdown Main combined Candidate compaction Candidate shutdown Candidate combined Combined delta
1 1,653 268 1,921 1,571 330 1,901 −20
2 1,653 264 1,917 1,569 334 1,903 −14
3 1,653 266 1,919 1,624 283 1,907 −12
Median 1,653 266 1,919 1,571 330 1,903 −16

Shutdown's standalone +64 median is timing-dependent placement of existing work. Main performs all 53 memory-publication statements during compaction; candidate performs [2,0,53] there and [51,53,0] during shutdown, exactly 53 total per workload. The three-statement plugin compare-and-apply tail also moves from compaction into shutdown. Both owners already join their accepted work at close.

All nine positive complete-stack variants resolve to native SQL sites present in baseline's combined window: lease-path selection, transaction BEGIN, capture retirement BEGIN/ROLLBACK and busy-timeout handling. Seven full caller chains differ because lease verification uses an alternate existing release branch and direct/service-assisted transaction or timeout branches trade places between idle close and restart-intent consumption. This is not a claim that all full stacks are identical. The source-bound comparison finds no new SQL site, shutdown owner operation, or per-item settlement loop; all affected owner modules are unchanged. The complete combined window decreases in every pair and at its median.

Known shutdown diagnostic and campaign follow-up

Candidate repetition 3 has two failed BEGIN IMMEDIATE attempts through clearGatewayRestartIntentSync → consumeGatewayRestartIntentPayloadSync → onSigterm (database is locked); all graceful closes complete. The coordinator classified this as the pre-existing synchronous restart-intent write at SIGTERM using PR #166528's main measurements, which recorded shutdown-only lock refusals [2, 0, 2]. Keep the synchronous restart-intent/active-writer contention as a campaign follow-up; it is not changed by this PR. The unchanged counting contract reports failed attempts separately from successful statements. No non-shutdown or focused execution failure occurred.

Integration and Retained Failure History

Overlap was integrated with merge commits, preserving both owners: session authority #165370, native creation #165819, schema admission #166253, Board reads #166403, integrity retention #166412, worktree ownership #166236 and placement lifecycle #166444. Incidental cleanup overlap #166427/#166439/#166560/#166566/#166621/#166659 is preserved. The latter integration retains main row normalization, transaction helper, consolidated native read capability and shared outbound context. The native account adapter keeps its specialized worker mutation boundary because the public adapter factory does not carry the private expected-row predicate through its scalar unbind callbacks; no public helper signature was expanded. The row encoder removed by main stays removed; the malformed/legacy-row fixture now writes its intentional physical rows independently, with unchanged assertions. The adjacent preflight lane #166252 remains coordinated through main. Source-map and MCP SDK advisory fixes came from main, including #166217; this PR does not patch dependencies.

The previous 565c6ad6 CI run failed the unchanged one-second branch-graph timing assertion at 1153.279 ms. Five exact merge and five exact base whole-file runs pass 17 tests each on Node 24.19.0. Its cause remains unresolved, and passing controls do not prove a repair or qualify an inherited-CI exception. No old CI rerun was requested; required conflict integration produced later green CI; the current head has its own passing run linked above.

Earlier independently reproduced main defects were repaired and integrated: terminal font fixture types (1d10375ee563, published via 1b395594318b), Gateway teardown admission ordering (4ed39a25f674), and requester sharing authority (f6e6805b99b7, published through 96ccec4a1385). Their original failures, negative controls, focused proof and reviews are retained in the landing evidence. Requester failure reproduced in all five base and five merge runs before repair; 121 positive scoped tests pass after it.

Earlier PR fixes include Goal/admission cleanup and routing (c8a16c077e0c), borrower release and input cloning (dc08d2168718), admitted content-version memo and parallel startup (718b382179e0), and capacity readiness proof (9a3da8b04a965). Live-authority, foreign-commit, rollback, pinned-snapshot and unknown-settlement safeguards remain. Historical per-sample/standalone-phase failures remain recorded; the current disposition uses the coordinator's clarified median and adjacent-window rule, not erased counts or selected reruns.

@clawsweeper

clawsweeper Bot commented Oct 6, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: slack Channel integration: slack channel: voice-call Channel integration: voice-call gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling plugin: file-transfer size: XL labels Oct 6, 2026
@steipete

steipete commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 2:52 PM ET / 18:52 UTC (Revision 23).

ClawSweeper review

What this changes

Moves conversation registration, binding mutations, and delivery authority into existing database workers, batches routing reads, and preserves released synchronous plugin contracts.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/state/openclaw-state-db-schema-version.ts. Prefer a design that avoids changing persisted SQLite tables. Migration or upgrade compatibility proof is recorded, but maintainers should still confirm that the schema change is necessary.

Merge readiness

⛔ Blocked before merge - 3 items remain

Current main does not cover the central worker cutover, so this PR remains useful. The previous size-limit finding is resolved, and no new blocking correctness defect was found; repaired-head performance qualification remains incomplete.

Priority: P2
Reviewed head: 69d5f7a5ad7aa9bf2f2873896a20c65c4ac2570e

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The inspected repair is coherent and resolves the prior finding, but the outstanding workload qualification limits performance confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies maintainer-authored work, so the ordinary external-contributor proof gate does not apply. Native worker/adapter boundary coverage checks pre-send revocation and accepted settlement; historical Linux workload evidence remains source-scoped, with repaired-head performance qualification separately outstanding. Inspected changes retain stored formats and require no migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies maintainer-authored work, so the ordinary external-contributor proof gate does not apply. Native worker/adapter boundary coverage checks pre-send revocation and accepted settlement; historical Linux workload evidence remains source-scoped, with repaired-head performance qualification separately outstanding. Inspected changes retain stored formats and require no migration.
Evidence reviewed 8 items Work remains absent on current main: Fetched main still registers addresses synchronously through the native database and loops over individual identities. The reviewed head instead dispatches registration through the agent worker; related merged worker changes do not supersede this responsibility.
Previous finding resolved: GitHub's exact previous-head comparison shows the cached-map lookup moved into cache admission, removing eight net lines from the size-constrained cache module without widening its 700-line rule. The copied-array reverse is also replaced with toReversed. The captured body reports passing focused lint on this correction.
Freshness-preserving row reuse: Row reuse requires the admitted revision and requested conversations to match. The regression asserts three freshness probes with one selection, then checks local changes, expiry, and returned-object isolation; a sibling case checks foreign replacement and database reopening. These tests were inspected, not executed during this review.
Findings None None.
Security None None.

How this fits together

Conversation routing connects discovered channel addresses to agent sessions. Database workers supply current bindings and delivery receipts, while the Gateway checks live routing authority before handing messages to channel adapters.

flowchart TD
  A[Discovered channel addresses] --> B[Conversation registration worker]
  B --> C[Conversation and session records]
  D[Current bindings and configuration] --> E[Live routing authority]
  C --> E
  E --> F[Platform send handoff]
  F --> G[Delivery receipts and recovery]
Loading

Before merge

  • Resolve merge risk (P1) - The repaired head has not completed the matched all-thread SQL comparison, so the historical single-address statement-count regression is not yet demonstrated removed in the production workload.
  • Complete next step (P2) - Publish completed SQL qualification for the repaired head under the unchanged counting contract, together with the completed exact-source SDK comparison.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus test growth production +2219/-938 (net +1281); tests/support +2182/-557 (net +1625) Worker dispatch, transaction-local guards, and batching explain the production growth; the added boundary coverage protects freshness and accepted-work settlement.
New configuration surface 1 optional channel hook; 0 new configuration options The batch route-preparation contract is additive and keeps the existing scalar resolver available.

Stored data model

Persistent data-model change detected: database schema: scripts/database-worker-inventory.mjs, migration/backfill/repair: scripts/database-worker-inventory.mjs, migration/backfill/repair: src/plugins/compat/registry-records.ts, unknown-data-model-change: src/state/openclaw-state-db-schema-version.ts, unknown-truncated-pull-files. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Complete repaired-source qualification (recommended)
    Publish the unchanged-harness SQL comparison and exact-source SDK report, demonstrating singleton counts meet the established limits without removing authority checks.

Technical review

Best possible solution:

Keep the existing worker and admission owners, preserving live revocation checks and released selectors while eliminating the measured singleton overhead.

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

Not applicable to this refactor as a bug reproduction. The body records a deterministic pre-repair SQL regression and a failing negative-control test, but current-head workload qualification is pending.

Is this the best way to solve the issue?

Yes: extending the existing worker and admission owners is the maintainable direction, and the inspected repair retains freshness and final-effect checks rather than bypassing them.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 94fc0814ef64.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded internal performance and ownership improvement, with no established urgent user-facing regression.
  • merge-risk: 🚨 other: Green CI alone cannot establish that the repaired production workload removes the documented singleton SQL overhead.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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: Repository State identifies maintainer-authored work, so the ordinary external-contributor proof gate does not apply. Native worker/adapter boundary coverage checks pre-send revocation and accepted settlement; historical Linux workload evidence remains source-scoped, with repaired-head performance qualification separately outstanding. Inspected changes retain stored formats and require no migration.

Evidence

What I checked:

  • Work remains absent on current main: Fetched main still registers addresses synchronously through the native database and loops over individual identities. The reviewed head instead dispatches registration through the agent worker; related merged worker changes do not supersede this responsibility. (src/config/sessions/conversation-registry.ts:179, 94fc0814ef64)
  • Previous finding resolved: GitHub's exact previous-head comparison shows the cached-map lookup moved into cache admission, removing eight net lines from the size-constrained cache module without widening its 700-line rule. The copied-array reverse is also replaced with toReversed. The captured body reports passing focused lint on this correction. (src/state/openclaw-state-db-cache.admission.ts:51, 69d5f7a5ad7a)
  • Freshness-preserving row reuse: Row reuse requires the admitted revision and requested conversations to match. The regression asserts three freshness probes with one selection, then checks local changes, expiry, and returned-object isolation; a sibling case checks foreign replacement and database reopening. These tests were inspected, not executed during this review. (src/infra/outbound/current-conversation-bindings.queries.test.ts:121, 69d5f7a5ad7a)
  • Final-effect authority boundary: The worker supplies transaction-local conversation facts, and the host initiates the adapter under its live commit grant. Inspected final and queued tests reject foreign route replacement during preparation before sendText is called, reject closed grants, and join accepted sends after releasing worker/FIFO custody. (src/gateway/conversation-route-ownership.worker.test.ts:126, 69d5f7a5ad7a)
  • Captured proof identity and outstanding qualification: The complete GitHub body was inspected and matched captured SHA-256 e19e5d45d26d8b58287dba519a7ff7e426e9152d3ed5ed715bc30865d7a1706d, including the omitted tail. It identifies the six-workload comparison as historical, records singleton totals of 12→13 and 10→13 before repair, and explicitly leaves current-head SQL and SDK reports pending. Historical shutdown accounting and its accepted adjacent-window interpretation are retained without treating inherited lock refusals as new patch defects. (69d5f7a5ad7a)
  • Released compatibility and unchanged persistence: The optional batch route hook retains the scalar resolver for supported older hosts. Synchronous binding selectors remain covered by shipped-contract type assertions and the existing next-SDK-major compatibility record. Inspected storage changes move execution and share existing kernels; they introduce no DDL, schema version, stored-format, config-default, or retention change. Public docs: docs/plugins/sdk-runtime/channel.md. (docs/plugins/sdk-runtime/channel.md:109, 69d5f7a5ad7a)

Likely related people:

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

Rank-up moves

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

  • Publish completed repaired-head SQL qualification and the exact-source SDK comparison.

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 (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-07T14:22:09.320Z sha 565c6ad :: blocked before merge. :: none
  • reviewed 2026-10-07T14:30:46.907Z sha 565c6ad :: blocked before merge. :: none
  • reviewed 2026-10-07T15:27:12.701Z sha e7b564c :: blocked before merge. :: none
  • reviewed 2026-10-07T15:56:43.805Z sha e7b564c :: blocked before merge. :: none
  • reviewed 2026-10-07T16:14:59.252Z sha e7b564c :: blocked before merge. :: none
  • reviewed 2026-10-07T17:56:07.322Z sha 2f53a69 :: blocked before merge. :: none
  • reviewed 2026-10-07T18:22:05.263Z sha 2f53a69 :: blocked before merge. :: none
  • reviewed 2026-10-07T18:37:49.869Z sha 6ddf09c :: blocked before merge. :: [P3] Keep the state cache within its enforced 700-line limit

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Oct 6, 2026
Merge current main into the conversation binding worker cutover without rebasing.
Preserve the binding singleton cleanup, live adapter authority, both worker-test
inventories, and main's interrupted recovery fixture semantics.

Keep released synchronous binding selectors source-compatible with a focused type
assertion, and correct stale migration guidance identified during review.
@openclaw-barnacle openclaw-barnacle Bot closed this Oct 6, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 6, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 6, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Oct 6, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 6, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 6, 2026
Merge main with the MCP SDK advisory fix and current session/worktree owners.
Retain both worker test-routing inventories and the conversation binding cutover.

Fresh P2 review is scoped-clean; affected type, behavior, and all-thread SQL
comparisons are being refreshed for this integrated source.
@openclaw-barnacle openclaw-barnacle Bot removed the channel: voice-call Channel integration: voice-call label Oct 7, 2026
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Oct 7, 2026
@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Oct 7, 2026
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 699a3c5 into main Oct 7, 2026
190 checks passed
@steipete
steipete deleted the dbasync/w6binding branch October 7, 2026 19:08
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 7, 2026
5 upstream commits, including openclaw#166690 (consolidate embedded runner
execution paths) and openclaw#166259 (move binding and delivery authority to
workers). Four conflicts, all in the embedded runner, plus two semantic
breaks:

- compact-reasons.ts: upstream turned the reason if-chain into a
  COMPACTION_TEXT_REASONS table. The feature's "unknown_model" rule is now a
  table row in its original position, and the table is typed with the
  feature's CompactionReasonCode (upstream has no such union).
- run/attempt-tool-prepare.ts: upstream rewrote the tool-construction IIFE
  as an if-block. The feature's whole delta in that hunk (skillsSnapshot,
  disableContinuationTools, continueWorkOpts, requestCompactionOpts,
  drainsContinuationDelegateQueue) is re-applied at the same anchor.
- run/run-attempt-dispatch.ts: both imports kept.
- run/payloads.ts: upstream now builds an array of parsed reply directives.
  The feature's multi-hop split moves into that array: when the raw answer
  holds an earlier continuation signal and more than one non-empty hop,
  each hop is parsed into its own directive item (whitespace preserved as
  before). Otherwise the result is upstream's single canonical directive,
  the same result as the old single-text path.
- session-delivery-queue-storage.ts (semantic): openclaw#166259 removed the
  synchronous getDeliveryQueueEntryStatus. The feature's
  ackSessionDelivery idempotency check now reads the receipt through
  upstream's inspectDeliveryQueueReceipt with the same stateDir.
- delivery-queue-test-support.ts (semantic): loadDeliveryQueueEntry now
  lives in upstream's delivery-queue-sqlite.test-support.ts.

Checks, all on the canonical runner:
- Typecheck: core, plus test shards agents-embedded-runner, agents-embedded,
  agents-other, infra, messaging-auto-reply, gateway-methods,
  gateway-server, gateway-other, commands and extensions-test, all clean.
- Tests: payloads*, compact-reasons*, attempt-tool-prepare*,
  run-attempt-dispatch*, session-delivery-queue* and the embedded-runner
  continuation suites, 31 files, all green.
- Ratchets: assertion-safety and database-worker both OK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 7, 2026
…cated

Merging upstream 030003c combined two imports of messageToolOutcome in
delivery-dispatch.double-announce.test.ts: ours from the feature's
double-announce.test-support module, and upstream's from
delivery-dispatch.test-fixtures (openclaw#166259). The file failed to parse
("Identifier `messageToolOutcome` has already been declared"), which
surfaced as Mode-B 37676831899's line-cap ratchet failure.

The two helpers are byte-identical, so the feature's copy is removed and
upstream's fixture is used. The feature's delivery-outbound.runtime
passthrough mock (which wrapped the real sendDurableMessageBatchCore, with
no assertion on it) is dropped. The file passes 84/84 without it, and the
change keeps the file within its line-cap baseline.

84/84 under scripts/run-vitest.mjs; services-cron test typecheck shard clean;
oxlint and conflict-marker checks clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…rs (openclaw#166259)

* refactor(conversations): move binding and delivery authority to workers

* fix(conversations): settle cancelled preparation and route worker tests

Keep awaited origin binding preparation inside chat admission cleanup so an
abort before persistence retires the admitted run. Reuse the Kysely owner for
JSON tuple expansion and assign database consumers to their host-owned test
projects without duplicating coverage.

The repaired Goal and attachment cases pass, along with binding, registry,
query, close-order, and tooling checks. Retain the first-call MCP request timeout for separate investigation from
the corrected missing-broker failure.

* fix(conversations): release borrowers when writer admission refuses

Clone request inputs before capturing database ownership and release the borrowed executor around the complete writer admission. Preserve outcome-unknown handling after dispatch and release before awaiting transport settlement.

Four real queue/input refusal regressions failed before the fix. The complete registry suite, focused types and lint, line-cap checks, Madge, and P2 review pass.

* perf(state): reuse admitted content versions and join startup recovery

* test(worktrees): await allocation readiness without polling

* perf(conversations): reuse freshly admitted binding rows

* refactor(state): consolidate admitted cache lookup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: slack Channel integration: slack docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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