Skip to content

fix(channels): move binding route inspection and activity into workers - #154672

Merged
steipete merged 1 commit into
mainfrom
codex/binding-worker-main-b49-20260921
Sep 21, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/binding-worker-main-b49-20260921

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144592

What Problem This Solves

Runtime conversation routing awaited activity updates but still read and wrote binding SQLite state on the caller thread. Route inspection and generic/account-scoped lookup now use the shared-state workers, with the existing writer broker owning repair and activity transactions. Read-only inspection does not create a missing store or prune expired rows.

User Impact

Shared conversation route inspection and activity updates run through the existing SQLite workers while preserving account scope, replacement handling, and durable activity. No configuration, schema, or retention change is required.

Why This Change Was Made

The route waits for activity persistence and reinspects ownership before returning. Rebinding can reuse the same ID, so settlement also checks creation time and target identity. A replacement receives its own activity update within a bounded retry; repeated replacement produces an explicit retryable error. Adapter and registry ownership are revalidated after reads and at transaction/commit admission. The worker and legacy facade share database kernels, preserving account scoping, expiry, metadata, and shipped legacy-key repair.

The shared SDK exposes awaited lookup, inspection, activity, and lifecycle-setter contracts. Shipped synchronous methods and external legacy adapters retain their documented deprecation window. Generic/account bind, unbind, list, separate lifecycle persistence, remaining bundled stores, and core reply callers are subsequent cuts; this does not claim a fully migrated binding service.

Evidence

Validation covers 206 distinct owner/consumer cases across 11 files, plus 29 focused cases on the current-main carry. The full committed build, production and affected test types, typed lint, ownership/SDK/compatibility guards, and independent P2 review passed. Three test-observer style errors from the aggregate lint run were corrected and verified with targeted typed lint, types, and both real worker cases; the remaining canonical checks then passed.

Compiled Node 24.21.0 and Bun 1.4.2 each exercised five actual routes: missing store, generic/account activity, and durable reopen. All eight caller-thread SQLite counters were zero in every measured route. Activity advanced durably; both runtimes exited naturally without cleanup errors. Source, built artifacts, dependency links, and installation metadata were unchanged across proof. The original compiled Node routes reproduced caller-thread SQLite work. This proof covers the shared route and its workers, not live channel transport or the whole Gateway.

Measured test cost: the earlier 195-case regression batch took 647.61 seconds across five shards; the final 18-case route/incarnation batch took 257.78 seconds; two final observer cases took 76.35 seconds; and the current-main 29-case batch took 93.63 seconds. These are whole-command wall times including setup/transformation, with overlapping case coverage; they must not be summed as unique tests or presented as isolated file costs. Real SQLite workers, live replacement interleavings and durable reopen are necessary to exercise these boundaries.

The compiled Node/Bun route processes exited in 3.43/5.76 seconds. Earlier failing counterfactual runs used different setup and assertions. No matched outbound latency benchmark is claimed: this change proves that the measured route moves SQLite calls off the caller thread, not that end-to-end routing becomes faster.

Run generic and account-scoped binding inspection, lookup repair, and activity writes through the shared-state workers. Reuse connection-bound kernels in the worker and retained synchronous facade, and revalidate host ownership at transaction and commit admission.

Settle activity for the binding incarnation returned by routing, including replacements that reuse a binding ID. Keep read-only inspection noncreating and retain shipped synchronous SDK contracts during the documented deprecation window. Bind, unbind, list, lifecycle persistence, and remaining callers are subsequent cuts.

Refs #144592
@clawsweeper

clawsweeper Bot commented Sep 21, 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.

@steipete
steipete marked this pull request as ready for review September 21, 2026 09:12
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation plugin: file-transfer size: XL maintainer Maintainer-authored PR labels Sep 21, 2026
@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 Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 21, 2026, 5:40 AM ET / 09:40 UTC (Revision 2).

ClawSweeper review

What this changes

Moves conversation-binding reads and activity updates into SQLite workers, adds awaited plugin APIs, and preserves synchronous compatibility.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This remains a useful, protected storage conversion that current main does not implement. No blocking code defect was found; the prior test-timing request is only partially satisfied.

Priority: P2
Reviewed head: 955fa7ee3577c91a4f368e848804112424e580c1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation and scoped runtime evidence are sound; the remaining follow-up is the previously requested test-cost evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied compiled Node/Bun observations exercise the changed binding route and actual workers, reporting zero caller-thread SQLite calls and durable activity after reopen; they establish storage offloading, not whole-Gateway latency.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied compiled Node/Bun observations exercise the changed binding route and actual workers, reporting zero caller-thread SQLite calls and durable activity after reopen; they establish storage offloading, not whole-Gateway latency.
Evidence reviewed 9 items Pinned introduction and merge identities: Reviewed the introduced delta from b49fd15 to 955fa7e. The recorded test merge has exactly the pinned base followed by the PR head as parents; unrelated base changes were excluded.
Current main still uses synchronous routing: Fetched main resolves runtime bindings through synchronous inspection and touch. The latest supplied release also exposes synchronous lookup and touch contracts, so the proposed worker conversion remains distinct work.
Shipped compatibility contract: v2026.9.5 contains synchronous service and adapter methods. The PR retains those methods, documents fallback for legacy adapters, and records deprecation through the next Plugin SDK major rather than silently changing their return types.
Findings None None.
Security None None.

How this fits together

Conversation bindings connect channel conversations to agent sessions. Routing reads the binding, records activity, and returns the selected session to downstream message handling.

flowchart TD
  A[Channel conversation] --> B[Binding service]
  B --> C[Read worker]
  C --> D[Current binding]
  D --> E[Writer worker records activity]
  E --> F[Recheck ownership and replacement]
  F --> G[Selected session route]
Loading

Before merge

  • Complete next step (P2) - Complete the prior timing request with per-file changed-test wall times, before/after benchmarks for existing affected outbound test files, and available CI durations; no end-to-end routing latency benchmark is required.
Agent review details

Security

None.

PR surface

Source +773, Tests +747, Docs +51, Other -2. Total +1569 across 33 files.

View PR surface stats
Area Files Added Removed Net
Source 20 1181 408 +773
Tests 10 765 18 +747
Docs 1 51 0 +51
Config 0 0 0 0
Generated 0 0 0 0
Other 2 0 2 -2
Total 33 1997 428 +1569

Review metrics

Metric Value Why it matters
Production versus test growth Production net +773 lines; tests and test support net +747 lines Production growth supplies worker commands, ownership checks, and staged SDK contracts while extracting a shared persistence kernel.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/plugins/compat/registry-records.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: partial_overlap
Canonical: #144592
Summary: This PR implements a bounded conversation-binding slice of the broader asynchronous storage program.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Use the existing read and writer workers with one shared database kernel, preserving the documented SDK compatibility window during caller migration.

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

Not applicable as a user-reported bug: this is an internal storage conversion, and current-main source confirms the remaining synchronous route operations.

Is this the best way to solve the issue?

Yes: reusing the existing workers and shared persistence kernel preserves one storage owner and avoids breaking shipped plugin contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied compiled Node/Bun observations exercise the changed binding route and actual workers, reporting zero caller-thread SQLite calls and durable activity after reopen; they establish storage offloading, not whole-Gateway latency.

Label justifications:

  • P2: This is a bounded runtime-storage improvement without evidence of an urgent user-facing outage.
  • merge-risk: 🚨 compatibility: Public binding APIs gain asynchronous alternatives and deprecations; the explicitly documented staged migration preserves shipped synchronous methods and legacy adapter fallback.
  • 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. Sufficient (live_output): The supplied compiled Node/Bun observations exercise the changed binding route and actual workers, reporting zero caller-thread SQLite calls and durable activity after reopen; they establish storage offloading, not whole-Gateway latency.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied compiled Node/Bun observations exercise the changed binding route and actual workers, reporting zero caller-thread SQLite calls and durable activity after reopen; they establish storage offloading, not whole-Gateway latency.

Evidence

What I checked:

  • Pinned introduction and merge identities: Reviewed the introduced delta from b49fd15 to 955fa7e. The recorded test merge has exactly the pinned base followed by the PR head as parents; unrelated base changes were excluded. (c9c2f3f36a9c)
  • Current main still uses synchronous routing: Fetched main resolves runtime bindings through synchronous inspection and touch. The latest supplied release also exposes synchronous lookup and touch contracts, so the proposed worker conversion remains distinct work. (src/channels/plugins/binding-routing.ts:131, d2580ac064bc)
  • Shipped compatibility contract: v2026.9.5 contains synchronous service and adapter methods. The PR retains those methods, documents fallback for legacy adapters, and records deprecation through the next Plugin SDK major rather than silently changing their return types. (src/infra/outbound/session-binding-service.ts:63, ec9c1a13db89)
  • Explicit staged SDK migration: The maintainer-authored proposal explicitly retains synchronous compatibility and leaves bind/unbind, list, lifecycle persistence, and remaining callers to subsequent cuts. Both routes reuse the database kernel; the retained compatibility is documented scope rather than an accidental competing store. Public docs: docs/plugins/sdk-runtime/channel.md. (docs/plugins/sdk-runtime/channel.md:134, 955fa7ee3577)
  • Ownership and durable-effect safeguards: Worker writes request current ownership at transaction and commit admission. Added real-SQLite cases assert unchanged committed bytes after revocation, reject a shadowed account manager, preserve sibling accounts, and compare synchronous versus asynchronous account-touch bytes. (src/infra/outbound/current-conversation-bindings.worker.test.ts:114, 955fa7ee3577)
  • Runtime observations and review continuity: The supplied complete body, corroborated by the REST read at the unchanged head, reports compiled Node 24.21.0 and Bun 1.4.2 exercising missing-store, generic/account activity, and durable-reopen routes, with all eight caller-thread SQLite counters zero and durable activity advancement. New batch timings partially address the previous review, but explicitly are not per-file measurements. No code or tests were executed during this read-only review. (955fa7ee3577)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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.

  • Record per-file changed-test wall times, before/after timings for existing affected outbound test files, and available CI durations.

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-21T09:20:47.611Z sha 955fa7e :: needs changes before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 21, 2026
@steipete
steipete merged commit 0fcbb70 into main Sep 21, 2026
291 checks passed
@steipete
steipete deleted the codex/binding-worker-main-b49-20260921 branch September 21, 2026 10:36
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 21, 2026
Await core conversation-binding reads and activity updates, preserve selected binding and agent provenance, and revalidate the current owner before ACP turns and prepared question answers. Settle committed input once after late refusal while retaining direct and configured targets.

Keep harness question and answer types in a dependency-free leaf to avoid the full import-graph cycle. Carry the qualified feature onto current main while retaining its delivery-reader migration, combined worker-test inventory, and deferred ACP abort synchronization with direct settlement assertions.

Follow-up to #154672. Remaining channel route, list, unbind, and lifecycle persistence conversions stay separate.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
Run generic and account-scoped binding inspection, lookup repair, and activity writes through the shared-state workers. Reuse connection-bound kernels in the worker and retained synchronous facade, and revalidate host ownership at transaction and commit admission.

Settle activity for the binding incarnation returned by routing, including replacements that reuse a binding ID. Keep read-only inspection noncreating and retain shipped synchronous SDK contracts during the documented deprecation window. Bind, unbind, list, lifecycle persistence, and remaining callers are subsequent cuts.

Refs openclaw#144592
steipete added a commit that referenced this pull request Oct 12, 2026
Keep one path for channel configuration forwarding, Google thinking
preparation, status projections and rendering, and voice digest settlement.
Remove speculative catalog, transport, and lifecycle coordination while
preserving security-effect authority and ordinary durable settlement.

Best-effort tradeoffs accepted:
- Replacing the process-default AI host mid-session leaves old runtime-local
  caches for global cleanup or bounded expiry. #158901 tested replacement
  synthetically; explicit runtime owners and stream authority remain.
- A throwing synchronous custom-API registrar fails setup instead of requeuing
  a partial drain. #111669 supports initialization ordering, not recovery from
  an arbitrary throwing registrar; restart after repairing it.
- Reentrant toJSON cleanup can replace a continuation claim during serialization.
  #128848's synthetic callback is unlike provider JSON; the next turn can replay
  full history. Credential isolation and cache limits remain.
- A concurrent channel rebind may miss its activity touch. #154672's forced
  incarnation swaps no longer trigger a retry protocol; routing still rereads.
- An admitted CLI registry load may finish during shutdown. The work scope
  joins and disposes it; new command admission remains closed (#142388/#142838).
- Unsupported writers during offline NOCOW copying are no longer detected by
  a second inventory/fuser/fingerprint scan. #160877/#161501 used synthetic
  interleavings; initial exclusivity, integrity, atomic exchange, and retained
  originals still protect normal maintenance and recovery.
- Remote keyword listings changing between pages may repeat or skip entries,
  rather than reject the cursor (#163459). Request binding and limits remain.
- A missing subscription acknowledgment can leave stale observation until
  a fresh subscription or reconnect, without compensating requests. #126760
  and #159564 forced ACK loss; server authorization and acknowledged leases remain.
- A retained thinking callback may reject during plugin reload until the
  catalog refreshes or the caller retries. #162470 used forced retirement;
  the plugin instance continues to reject revoked execution.

Use the existing compiled CLI fixture for native-resource lifetime proof so
cold source transformation occurs before its unchanged runtime deadline.
No schema, dependency, protocol shape, or permission change.
steipete added a commit that referenced this pull request Oct 12, 2026
* refactor(ui): consolidate page state and refresh bookkeeping

* refactor: simplify transient plugin and client bookkeeping

Keep one path for channel configuration forwarding, Google thinking
preparation, status projections and rendering, and voice digest settlement.
Remove speculative catalog, transport, and lifecycle coordination while
preserving security-effect authority and ordinary durable settlement.

Best-effort tradeoffs accepted:
- Replacing the process-default AI host mid-session leaves old runtime-local
  caches for global cleanup or bounded expiry. #158901 tested replacement
  synthetically; explicit runtime owners and stream authority remain.
- A throwing synchronous custom-API registrar fails setup instead of requeuing
  a partial drain. #111669 supports initialization ordering, not recovery from
  an arbitrary throwing registrar; restart after repairing it.
- Reentrant toJSON cleanup can replace a continuation claim during serialization.
  #128848's synthetic callback is unlike provider JSON; the next turn can replay
  full history. Credential isolation and cache limits remain.
- A concurrent channel rebind may miss its activity touch. #154672's forced
  incarnation swaps no longer trigger a retry protocol; routing still rereads.
- An admitted CLI registry load may finish during shutdown. The work scope
  joins and disposes it; new command admission remains closed (#142388/#142838).
- Unsupported writers during offline NOCOW copying are no longer detected by
  a second inventory/fuser/fingerprint scan. #160877/#161501 used synthetic
  interleavings; initial exclusivity, integrity, atomic exchange, and retained
  originals still protect normal maintenance and recovery.
- Remote keyword listings changing between pages may repeat or skip entries,
  rather than reject the cursor (#163459). Request binding and limits remain.
- A missing subscription acknowledgment can leave stale observation until
  a fresh subscription or reconnect, without compensating requests. #126760
  and #159564 forced ACK loss; server authorization and acknowledged leases remain.
- A retained thinking callback may reject during plugin reload until the
  catalog refreshes or the caller retries. #162470 used forced retirement;
  the plugin instance continues to reject revoked execution.

Use the existing compiled CLI fixture for native-resource lifetime proof so
cold source transformation occurs before its unchanged runtime deadline.
No schema, dependency, protocol shape, or permission change.

* fix: preserve runtime cleanup error cause

Keep the existing aggregate errors and message while attaching the caught error as the standard cause. No signature or import graph changes.

* refactor(ui): finish subscription compensation cutover

* test: retire obsolete subscription recovery expectations

* fix(ui): guard legacy group import at the write boundary
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…169375)

* refactor(ui): consolidate page state and refresh bookkeeping

* refactor: simplify transient plugin and client bookkeeping

Keep one path for channel configuration forwarding, Google thinking
preparation, status projections and rendering, and voice digest settlement.
Remove speculative catalog, transport, and lifecycle coordination while
preserving security-effect authority and ordinary durable settlement.

Best-effort tradeoffs accepted:
- Replacing the process-default AI host mid-session leaves old runtime-local
  caches for global cleanup or bounded expiry. openclaw#158901 tested replacement
  synthetically; explicit runtime owners and stream authority remain.
- A throwing synchronous custom-API registrar fails setup instead of requeuing
  a partial drain. openclaw#111669 supports initialization ordering, not recovery from
  an arbitrary throwing registrar; restart after repairing it.
- Reentrant toJSON cleanup can replace a continuation claim during serialization.
  openclaw#128848's synthetic callback is unlike provider JSON; the next turn can replay
  full history. Credential isolation and cache limits remain.
- A concurrent channel rebind may miss its activity touch. openclaw#154672's forced
  incarnation swaps no longer trigger a retry protocol; routing still rereads.
- An admitted CLI registry load may finish during shutdown. The work scope
  joins and disposes it; new command admission remains closed (openclaw#142388/openclaw#142838).
- Unsupported writers during offline NOCOW copying are no longer detected by
  a second inventory/fuser/fingerprint scan. openclaw#160877/openclaw#161501 used synthetic
  interleavings; initial exclusivity, integrity, atomic exchange, and retained
  originals still protect normal maintenance and recovery.
- Remote keyword listings changing between pages may repeat or skip entries,
  rather than reject the cursor (openclaw#163459). Request binding and limits remain.
- A missing subscription acknowledgment can leave stale observation until
  a fresh subscription or reconnect, without compensating requests. openclaw#126760
  and openclaw#159564 forced ACK loss; server authorization and acknowledged leases remain.
- A retained thinking callback may reject during plugin reload until the
  catalog refreshes or the caller retries. openclaw#162470 used forced retirement;
  the plugin instance continues to reject revoked execution.

Use the existing compiled CLI fixture for native-resource lifetime proof so
cold source transformation occurs before its unchanged runtime deadline.
No schema, dependency, protocol shape, or permission change.

* fix: preserve runtime cleanup error cause

Keep the existing aggregate errors and message while attaching the caught error as the standard cause. No signature or import graph changes.

* refactor(ui): finish subscription compensation cutover

* test: retire obsolete subscription recovery expectations

* fix(ui): guard legacy group import at the write boundary
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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: file-transfer 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