Repository navigation
fix: queued workers miss cooperative checkpoints under shared pressure - #164537
Conversation
Move scheduling, task transport, native-section fences, and retained settlement into a private workspace package. Keep database policy, native lifetime sources, shared admission, and the existing plugin SDK contracts with their host owners. Skip already-signaled host exchanges when repeated queue pressure requests a checkpoint. Record hostWaitMs separately from runMs and include it in benchmark diagnostics. Preserve method receivers for host lifecycle callbacks. Validation: 165 scoped tests plus 53 tests on the final refinements, full TypeScript checks, changed-source lint, SDK export checks, and independent review. The extraction passed the full build. Five untouched files retain pre-existing max-lines lint failures; the build also reported the existing-scope UI startup size diagnostic. No schema, configuration, or operator migration is required.
|
🦞👀 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: blocked before merge. Reviewed October 3, 2026, 7:54 PM ET / 23:54 UTC (Revision 5). ClawSweeper reviewWhat this changesThe PR moves worker scheduling into a private workspace package, lets repeated compute pressure reach another cooperative worker, and adds host-wait diagnostics. Merge readiness⛔ Blocked before merge - 2 items remain This PR remains useful because fetched main and the latest release still contain the checkpoint-selection defect. No actionable introduced bug was found, and source inspection resolves the earlier generic compatibility concern. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's worker pools run bounded background computation for agents, sessions, and database readers. Shared capacity coordinates queued tasks, while host adapters retain worker creation, database context, and resource cleanup. flowchart TD
A[Background tasks] --> B[Worker pool admission]
B --> C[Shared compute capacity]
C --> D[Worker execution]
D --> E[Host response wait]
C -->|Queue pressure| E
E -->|Cooperative checkpoint| C
D --> F[Results and diagnostics]
D --> G[Host-owned cleanup]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. 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 single extracted scheduler with host-owned lifecycle policy and preserved public SDK contracts. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the repeated-pressure defect, and the linked report supplies a deterministic production-pool scenario with mocked Worker transport; this review did not execute it. Is this the best way to solve the issue? Yes, skipping already-signaled exchanges repairs the owning scheduler invariant, and the extraction preserves existing host and SDK responsibilities. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bf4fe3ace570. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review Please review current head 91505d0. The CI follow-up fixes declaration-only package aliases and the missed test type import; 64 affected tests, scoped typechecks/lint, and an isolated review pass. The PR body now addresses compatibility explicitly: no authored configuration/default, database schema, stored-data, retention, or migration change. The original generic compatibility flags came from an incomplete file listing. The private workspace package uses only an existing workspace dependency, and SDK entrypoints remain stable. |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
openclaw#164537) * refactor(infra): extract worker runtime and fix checkpoint fairness Move scheduling, task transport, native-section fences, and retained settlement into a private workspace package. Keep database policy, native lifetime sources, shared admission, and the existing plugin SDK contracts with their host owners. Skip already-signaled host exchanges when repeated queue pressure requests a checkpoint. Record hostWaitMs separately from runMs and include it in benchmark diagnostics. Preserve method receivers for host lifecycle callbacks. Validation: 165 scoped tests plus 53 tests on the final refinements, full TypeScript checks, changed-source lint, SDK export checks, and independent review. The extraction passed the full build. Five untouched files retain pre-existing max-lines lint failures; the build also reported the existing-scope UI startup size diagnostic. No schema, configuration, or operator migration is required. * fix(build): complete worker runtime declaration boundaries
Backport the shared worker-runtime alias-owner entries from openclaw#164537. Reuse the shared aliases in standalone UI Vitest and cover them following openclaw#164061.
Backport the worker-runtime mappings from openclaw#164537 into the shared alias owner and reuse the UI projection pattern from openclaw#164061. Exercise channel-identity add and remove through the existing real-Gateway profile E2E, including fresh reads after reload.
* improve: show configured names for shared operator profiles * fix(ui): preserve unnamed shared owner labels across consumers * test(ui): align sidebar shared owner name expectation * fix(test): share package aliases with UI Vitest projects Backport the shared worker-runtime alias-owner entries from #164537. Reuse the shared aliases in standalone UI Vitest and cover them following #164061. * fix(ui): reconcile named shared-owner locale expectations and scan coverage * chore: prepare reviewed contributor base integration * fix(ui): preserve shared profile labels across main integration * chore: remove duplicate scan target * style(ui): format shared profile name fixture --------- Co-authored-by: TheAngryPit <[email protected]> Co-authored-by: Vyctor H. Brzezowski <[email protected]>
…#164593) * improve: show configured names for shared operator profiles * fix(ui): preserve unnamed shared owner labels across consumers * test(ui): align sidebar shared owner name expectation * fix(test): share package aliases with UI Vitest projects Backport the shared worker-runtime alias-owner entries from openclaw#164537. Reuse the shared aliases in standalone UI Vitest and cover them following openclaw#164061. * fix(ui): reconcile named shared-owner locale expectations and scan coverage * chore: prepare reviewed contributor base integration * fix(ui): preserve shared profile labels across main integration * chore: remove duplicate scan target * style(ui): format shared profile name fixture --------- Co-authored-by: TheAngryPit <[email protected]> Co-authored-by: Vyctor H. Brzezowski <[email protected]>
Closes #164536
What Problem This Solves
Queued worker tasks can wait unnecessarily when repeated shared-compute pressure keeps selecting an already-signaled host exchange instead of reaching a later cooperative worker.
User Impact
Repeated pressure can now reach the next eligible host exchange and let queued work progress. Worker diagnostics expose host-wait time separately from the existing run duration. Public plugin SDK entrypoints, resource limits, database ownership, and cancellation/cleanup guarantees are preserved; no configuration or migration is required.
Why This Change Was Made
Extract the existing scheduler, task protocol, native-section fences, and retained settlement into the private
@openclaw/worker-runtimeworkspace package. OpenClaw supplies worker construction, runtime generations, database context, shared capacity, and the live-pool registry through host adapters. Separate host, worker, and lifecycle entrypoints keep worker-side imports independent of application policy, with a scoped import-boundary guard.This retains the lifecycle contracts our callers need while making the engine easier to maintain. The scheduling fix skips exchanges whose pressure signal is already aborted. Additive
hostWaitMsaccounting covers replies, rejection, and cancellation without changingrunMs; the existing benchmark collector consumes it.Evidence
pnpm test src/infra/worker-task-pool.owned.test.ts --maxWorkers=1: 29 passed on the published tree; 54.07 s wrapper wall time, 42.12 s Vitest duration, with transformation accounting for 95% of that duration. CI seconds are not yet available.pnpm buildand verification of all 151 public SDK subpaths. Final cleanup and callback-binding refinements were subsequently verified by types, scoped lint, compiled-worker tests, and review. One intermediate test-preparation attempt was invalidated by running the build concurrently; the serial rerun passed.Full-repository lint still reports pre-existing max-lines violations in five files verified byte-identical to the starting commit
fc7e71bad25845ba8c23ddd6f3c44ded11a9f427:extensions/voice-call/src/runtime.test.ts,extensions/crabbox/src/crabbox-worker-provider.ts,src/gateway/worker-environments/transcript-commit.test.ts,src/state/openclaw-state-read.worker.ts, andsrc/plugins/doctor-contract-registry.ts. No baseline or lint exception was added. The successful full build also reported a UI startup-size diagnostic (364.9 KiB versus 364.7 KiB); this PR does not change UI code.CI follow-up
The first CI run exposed missing declaration aliases in clean plugin boundary builds (local package artifacts masked them), a missed core test type import, and two config-test assumptions. The follow-up maps all worker-runtime entrypoints to the SDK declaration graph, completes the type import migration, selects lint policy overrides by identity, and includes the existing heartbeat worker in the schema-inlining test. The SDK contract test keeps the declaration producer checks without freezing unrelated package inventory.
The follow-up passed isolated review at P0–P2, affected core and script typechecks, and scoped lint. A broad lint attempt timed out preparing unrelated plugin declarations; the repository core lint scope passed without that preparation. With worker-runtime package build artifacts hidden, full Codex, Telegram, Slack, and XAI declaration projects compile with zero diagnostics. The two tooling suites pass 54 tests (166.70 s wrapper wall; original CI file times 10.146 s and 0.476 s), and the package contract suite passes 10 tests (9.24 s wrapper wall; 0.821 s test time).
Other first-run failures came from main and have separate fixes: dashboard iframe sizing (
11515ce5b3dad), memory-host roster boundaries (3f12395208355), and retained SQLite snapshot diagnostics (20f485c7af918). These failures are recorded as failures, not passing proof.Compatibility review: no authored configuration, default, protocol version, database schema, stored-data shape, retention, or migration behavior changes. OAuth changes only repoint imports to the unchanged native-section owner. The dependency graph adds a private local workspace package using an existing workspace dependency; there is no new registry dependency. ClawSweeper's initial generic compatibility flags were based on an incomplete file listing; its source review found no actionable introduced bug.
Final CI disposition
Run
37156024642, attempt 1, tested merge1de96bfd050111bb72d2113a4c13d3aaa9967881(main06da0de86c0a27dc1e92995f9d0a2428880ce90cplus reviewed head91505d067ce3d84179e4862314b046262159088c). All selected checks completed; two jobs and their aggregate gate failed, with no cancelled jobs.GatewayLockErrorbefore snapshot cleanup fault injection (2 failed / 11 passed; 256.65 s wrapper). The new main ownership check reaches the existing quarantine refusal before repair. The separate owner repair landed on main as6d4ee0afd92e9636b81b6e9bdb65a7367f072bc6, with all 56 Doctor/admission/Gateway-lease tests on Node 24.19, the required changed checks, and isolated review passing. The PR's source is unchanged. The same full-file baseline also reproduces on CI’s actual Node 24.19 (2 failed / 11 passed; 207.27 s wrapper); the nested cause is the existing quarantine guard, before any worker task.These failures remain recorded for the native inherited-failure admission policy. ClawSweeper completed current-head review with no actionable source finding and explicitly resolved compatibility concerns by inspecting the complete diff.
The separate automatic ARM preparation run
37156024467ended cancelled after its two-hour timeout window. Its live log stops after Go 1.27.1 was cached, before validation; no ARM result is claimed. This setup gap is separate from the completed main CI run and its two attributed failures.