Repository navigation
fix(channels): move binding route inspection and activity into workers - #154672
Conversation
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
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed September 21, 2026, 5:40 AM ET / 09:40 UTC (Revision 2). ClawSweeper reviewWhat this changesMoves 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 Review scores
Verification
How this fits togetherConversation 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +773, Tests +747, Docs +51, Other -2. Total +1569 across 33 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
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.
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
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.
* 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
…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
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.