Repository navigation
fix: run agents-core CI files safely in parallel - #154133
Conversation
|
🦞👀 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 September 21, 2026, 2:40 AM ET / 06:40 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR parallelizes agents-core CI tests, adjusts scheduling estimates, repairs fixture isolation, and makes local model service shutdown retain ownership until cleanup completes. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: the work remains useful on current main, and source review found no blocking code or security defect. Priority: P2 Review scores
Verification
How this fits togetherThe CI planner turns test inventories and timing history into bounded worker jobs. Local model service management starts and stops provider processes for model requests and Gateway teardown; parallel testing exposed races in that lifecycle. flowchart TD
A[Test inventory and timing history] --> B[CI planner]
B --> C[Parallel test workers]
C --> D[CI results]
C --> F[Local service lifecycle]
E[Model requests and Gateway teardown] --> F
F --> G[Join process shutdown]
G --> H[Release ownership or start replacement]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +111, Tests +484, Docs +9, Other +126. Total +730 across 16 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the existing scheduling and lifecycle owners, with completed published-updater qualification establishing safe packaged restart and cleanup. Do we have a high-confidence way to reproduce the issue? Yes, from source: main retires the service-map entry before process shutdown settles, allowing overlapping shutdown or reacquisition to miss that cleanup. This review did not execute the regression. Is this the best way to solve the issue? Yes: coalescing cleanup in the existing service owner and reusing shared worker scheduling are focused repairs without new configuration or competing implementations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8e4c007a6829. LabelsLabel 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 (5 earlier review cycles)
|
d519ecd to
962fe39
Compare
962fe39 to
73abad8
Compare
* fix(agents): retain local service ownership through shutdown * test(agents): await heartbeat cleanup completion * test(agents): inject permission failures into native filesystem bindings * perf(agents): narrow watched-session title import * ci: parallelize agents-core files with effective worker costs * test(ci): retain agents-core split timing assertions
* refactor(agents): simplify old runtime bookkeeping Use one catalog discovery pass, local-process stop promise, presentation completion path, diagnostic recovery batch, and generated-media rollback owner. Reuse directory parameter declarations and keep sandbox validation at its existing boundary without repeating the same blocked-path checks. Remove the duplicate full-map primary-probe prune. Trust JSON-normalized result previews and group identical session-export style declarations without changing their visibility or cascade rules. Keep auth/approval/sandbox policy, normal child and write settlement, transcript/user-data durability, public signatures and Phase E unchanged. Production reduction: 147 net lines across ten old-only files. Best-effort tradeoffs accepted - MCP list_changed during held sibling discovery: #138694 added a synthetic forced-overlap replay, not a cited human incident. The next load refreshes the catalog instead; retirement and execution authority remain enforced. - Competing catalog producer finalization: the same private owner forbids a replacement while its promise is present, so the identity recheck is an internal invariant, not a realistic concurrency boundary. - Local-service post-readiness exit: #154133 describes synthetic parallel qualification, not a human report requiring another health check. The following request reports an exit after readiness; normal shutdown still joins the child, streams and pending termination work. - Local-process stop identity: replacement starts only after the retained authoritative process finishes stopping. The duplicate process reference and identity comparisons cannot observe another production replacement; failed-stop retry and the retiring marker remain intact. - Synchronous presentation self-drain: #156187 extracted this reservation without a cited human incident. Production adapters drain after projection; callbacks return their own work instead of reserving it before invocation. - Quarantine recovery overlap: #161579 explicitly introduced per-key and generation fencing for synthetic before-dispatch/after-reply controls. Same-key overlap can leave a stale or missing status warning until a later failing run or existing TTL. Actual tool exclusion, logs/events, accepted writes, stored shapes and worker/SQL contracts remain unchanged. - Primary-probe cache insertion order: #82707 introduced duplicate pruning. Post-write expiry and capacity bounds remain; refreshing an expired key can retain an earlier insertion position and permit an earlier reprobe after capacity eviction. This is a bounded best-effort throttle cache. - Preview host-prototype pollution: #147278 added own-property gates as part of result retention, not a human inherited-property failure report; linked #147105 proposes the feature. The sole caller passes freshly parsed JSON. A polluted host Object.prototype can affect bounded descriptive samples; retained JSON, reference identity and execution authority remain unchanged. * test(agents): warm MCP sibling before held discovery The discovery/revocation fixture held HTTP tools/list while cold-starting its stdio sibling. Slow startup could exhaust the existing ten-second listing deadline before the test reached revocation, producing a timeout diagnostic or an empty healthy-tool list instead of exercising its overlap. Warm the non-held sibling through its actual runtime owner first, then hold the other server's discovery across revocation. Keep every assertion, deadline, runtime authority check, and cleanup path unchanged. The two affected cases pass through the production materialization path; focused lint, format, and the owning test type graph also pass. The earlier four short-deadline MCP runtime failures remain separately unattributed. * refactor(apple): simplify source resources and microphone permission Use cancellation of owned source-resource tasks instead of a revision counter. Use native async microphone permission APIs instead of manual authorization-state switches and callback continuations. Best-effort tradeoffs accepted: - Resource revision tracking (#148906, feature request #148850, not a human invalidation-race incident): invalidation between prepared context and favicon task admission may allow one lookup with that snapshot; later lookups rediscover. Live route authority and Gateway disabled-fetch policy remain enforced. No protocol, persisted shape, config, permission-prompt or signing changes. Net production reduction: 26 lines (+10/-36); no test changes. Phase E untouched. Pager/notification changes were excluded after #171772 made their files recent under the seven-day rule. BELOW-500 coordinator bundle. Remaining source is byte-identical to the independently reviewed checkpoint. macOS/iOS Simulator/watchOS Simulator arm64 platform builds passed. Actual production-package focused tests passed: 17 VoiceNote XCTest cases and 18 source-resource SwiftTesting declarations including parameters. SwiftFormat, SwiftLint, runtime/madge cycles (zero), lint-suppressions, native-state guard and localization verification passed. Broad check-changed is not green: one bounded reproduction retained ten 20-second artifact-fixture subprocess timeouts and one 120-second signing fixture timeout. Unchanged tooling paths do not run these Swift sources; these are unresolved local failures, not proven hosted-main-red. Intel execution, app-hosted native UI tests requiring an OS sandbox and live microphone effects are not proven. No release_gate or remote lease. * refactor(apple): consolidate activity refresh and watch connection paths * refactor(agents): retain recent MCP contracts in old-code bundle Keep the recently edited reload regression file and its current combined-catalog implementation unchanged from main. Preserve the final source-lane trees for quarantine and Live Activity while retaining newer main behavior. This supersedes the historical source-commit inventories and MCP/quarantine/activity timing tradeoffs. Final bundle: 162 production lines removed; 112 net lines removed including tests (+166/-278, 14 files). Credit source lanes q10, q01 and q02. Fresh final-index review found no actionable P0-P2 defects. Focused proof and exact-head PR CI remain the landing gates. * fix(test): synchronize MCP connection invalidation fixture Hold sibling initialization across client-observed catalog invalidation. Preserve the existing assertions and deadlines; isolate scenario setup so the oversized runtime test does not grow.
…aw#172002) * refactor(agents): simplify old runtime bookkeeping Use one catalog discovery pass, local-process stop promise, presentation completion path, diagnostic recovery batch, and generated-media rollback owner. Reuse directory parameter declarations and keep sandbox validation at its existing boundary without repeating the same blocked-path checks. Remove the duplicate full-map primary-probe prune. Trust JSON-normalized result previews and group identical session-export style declarations without changing their visibility or cascade rules. Keep auth/approval/sandbox policy, normal child and write settlement, transcript/user-data durability, public signatures and Phase E unchanged. Production reduction: 147 net lines across ten old-only files. Best-effort tradeoffs accepted - MCP list_changed during held sibling discovery: openclaw#138694 added a synthetic forced-overlap replay, not a cited human incident. The next load refreshes the catalog instead; retirement and execution authority remain enforced. - Competing catalog producer finalization: the same private owner forbids a replacement while its promise is present, so the identity recheck is an internal invariant, not a realistic concurrency boundary. - Local-service post-readiness exit: openclaw#154133 describes synthetic parallel qualification, not a human report requiring another health check. The following request reports an exit after readiness; normal shutdown still joins the child, streams and pending termination work. - Local-process stop identity: replacement starts only after the retained authoritative process finishes stopping. The duplicate process reference and identity comparisons cannot observe another production replacement; failed-stop retry and the retiring marker remain intact. - Synchronous presentation self-drain: openclaw#156187 extracted this reservation without a cited human incident. Production adapters drain after projection; callbacks return their own work instead of reserving it before invocation. - Quarantine recovery overlap: openclaw#161579 explicitly introduced per-key and generation fencing for synthetic before-dispatch/after-reply controls. Same-key overlap can leave a stale or missing status warning until a later failing run or existing TTL. Actual tool exclusion, logs/events, accepted writes, stored shapes and worker/SQL contracts remain unchanged. - Primary-probe cache insertion order: openclaw#82707 introduced duplicate pruning. Post-write expiry and capacity bounds remain; refreshing an expired key can retain an earlier insertion position and permit an earlier reprobe after capacity eviction. This is a bounded best-effort throttle cache. - Preview host-prototype pollution: openclaw#147278 added own-property gates as part of result retention, not a human inherited-property failure report; linked openclaw#147105 proposes the feature. The sole caller passes freshly parsed JSON. A polluted host Object.prototype can affect bounded descriptive samples; retained JSON, reference identity and execution authority remain unchanged. * test(agents): warm MCP sibling before held discovery The discovery/revocation fixture held HTTP tools/list while cold-starting its stdio sibling. Slow startup could exhaust the existing ten-second listing deadline before the test reached revocation, producing a timeout diagnostic or an empty healthy-tool list instead of exercising its overlap. Warm the non-held sibling through its actual runtime owner first, then hold the other server's discovery across revocation. Keep every assertion, deadline, runtime authority check, and cleanup path unchanged. The two affected cases pass through the production materialization path; focused lint, format, and the owning test type graph also pass. The earlier four short-deadline MCP runtime failures remain separately unattributed. * refactor(apple): simplify source resources and microphone permission Use cancellation of owned source-resource tasks instead of a revision counter. Use native async microphone permission APIs instead of manual authorization-state switches and callback continuations. Best-effort tradeoffs accepted: - Resource revision tracking (openclaw#148906, feature request openclaw#148850, not a human invalidation-race incident): invalidation between prepared context and favicon task admission may allow one lookup with that snapshot; later lookups rediscover. Live route authority and Gateway disabled-fetch policy remain enforced. No protocol, persisted shape, config, permission-prompt or signing changes. Net production reduction: 26 lines (+10/-36); no test changes. Phase E untouched. Pager/notification changes were excluded after openclaw#171772 made their files recent under the seven-day rule. BELOW-500 coordinator bundle. Remaining source is byte-identical to the independently reviewed checkpoint. macOS/iOS Simulator/watchOS Simulator arm64 platform builds passed. Actual production-package focused tests passed: 17 VoiceNote XCTest cases and 18 source-resource SwiftTesting declarations including parameters. SwiftFormat, SwiftLint, runtime/madge cycles (zero), lint-suppressions, native-state guard and localization verification passed. Broad check-changed is not green: one bounded reproduction retained ten 20-second artifact-fixture subprocess timeouts and one 120-second signing fixture timeout. Unchanged tooling paths do not run these Swift sources; these are unresolved local failures, not proven hosted-main-red. Intel execution, app-hosted native UI tests requiring an OS sandbox and live microphone effects are not proven. No release_gate or remote lease. * refactor(apple): consolidate activity refresh and watch connection paths * refactor(agents): retain recent MCP contracts in old-code bundle Keep the recently edited reload regression file and its current combined-catalog implementation unchanged from main. Preserve the final source-lane trees for quarantine and Live Activity while retaining newer main behavior. This supersedes the historical source-commit inventories and MCP/quarantine/activity timing tradeoffs. Final bundle: 162 production lines removed; 112 net lines removed including tests (+166/-278, 14 files). Credit source lanes q10, q01 and q02. Fresh final-index review found no actionable P0-P2 defects. Focused proof and exact-head PR CI remain the landing gates. * fix(test): synchronize MCP connection invalidation fixture Hold sibling initialization across client-observed catalog invalidation. Preserve the existing assertions and deadlines; isolate scenario setup so the oversized runtime test does not grow.
Related: #153435
What Problem This Solves
Agents-core forces 584 test files to run serially inside CI children, retaining 16 groups across 11 parents even when two workers are available.
User Impact
CI runs the same inventory with parallel files, one fewer Node row on Blacksmith and hybrid, and two fewer on GitHub. Local model service shutdown now joins an idle stop already in progress, protects replacement ownership from late lease release, and recovers on a later call after a failed stop observation. There are no configuration or migration changes. Compact children retain a two-worker cap; local runs inherit shared scheduling, including its one-worker throttle.
Why This Change Was Made
The shared runner already resets mocks, evaluated modules, timers, environment, and lifecycle state between files. Qualification exposed fixture isolation problems and a production shutdown ownership bug:
finally.Three real-process lifecycle regressions fail on the preceding implementations and pass after the repairs. Existing diagnostic formatters move unchanged to one internal module to preserve the 700-line cap; no baseline exception is added. CLI and Gateway teardown consume the existing lifecycle flag/API, so this also preserves update/restart cleanup without changing config or persisted state.
No new serial exceptions are needed. The planner converts legacy serial history into effective-worker estimates while retaining indivisible file costs. Separate parallel timing identities prevent a second discount. Splitting measured parallel parents accounts for each child's effective workers; exact child observations replace estimates, and complete-child wall totals are not multiplied again. Existing CLI stripes remain. The 851 planner descriptors still cover exactly 584 active files; the other 267 are excluded by the config.
One import-cost repair uses the existing Gateway core entry for the watched-session title helper. The watched-session module's measured import fell from 1.62 s to 0.587 s. Standalone runner wall was 22.36 s before and 24.47 s after, so this does not claim a whole-file speedup. The MCP SDK wrapper and runtime config accessor retain their required lifecycle and fallback semantics.
Evidence
Qualified candidate:
962fe39f0f168d2c8e6d1257c91ac4bf5883db44, rebased onto356b0f186b785dfbb51f7b1f26f6797416e6e309with both cron and agents-core timing conversions preserved.All six fresh complete Linux replays passed: 3/3 at the planner cap of two workers and 3/3 at eight workers, through
scripts/ci-run-node-test-shard.mts. Every replay independently verified 584 files (582 passed, two existing skips) and 12,209 passed tests with 25 existing skips. Each replay runs all 14 canonical CI children sequentially. No serial carveouts were added.The two-worker median is 39.4% lower than the fresh control; eight workers are 49.4% lower. Actual host capacity was four CPUs and 15.42 GiB. The serial control used main's 16 groups with file parallelism disabled, followed immediately by the three candidate two-worker samples in the same invocation, source tree, and lease. This measures scheduling/packing and cache-order effects together. Eight-worker proof used a separate lease of the same host class. GNU time maximum RSS is not the sum of concurrent process RSS.
Blacksmith Testbox lease runs: paired serial/two-worker proof, eight-worker proof, and standalone/build/changed checks. Fresh qualification replaces the earlier pre-rebase comparison.
All nine touched test owners/import consumers passed 10/10 alone at cap eight: 90 invocations. Ten standalone runs per file is the explicitly requested maintainer scope for this lane; it takes precedence over the later generic twenty-run recommendation. The four required planner suites passed 2,156 tests, and the final build passed. The final canonical all-16-file changed checks, type-aware lint, formatting, and diff checks passed. A fresh floating-promise canary produced the expected
no-floating-promisesdiagnostic and its temporary file was removed.The linked campaign’s exact 38-path changed set and the broad fallback produce identical PR counts. All nine current-main/candidate profile/scenario comparisons preserve coverage and remain within 90 compact / 130 PR Node / 70 push Node rows.
Per-parent walls at the planner's two-worker cap
Serial values sum each parent's child walls. Parallel values are independent parent medians across three replays; their sum need not equal the median whole replay.
Standalone file costs and corresponding CI jobs
One-worker values are complete isolated wrapper walls measured with
--maxWorkers=1. CI did not publish per-file timing artifacts. The final column is the owning CI job's complete wall, including unrelated groups and setup; it is not a per-file CI measurement.src/agents/provider-local-service.test.tssrc/agents/provider-local-service.env-case.test.tssrc/agents/provider-local-service.shutdown.test.tssrc/agents/provider-local-service.linux-oom.test.tssrc/agents/bash-tools.test.tssrc/agents/auth-profiles.permissions.test.tssrc/agents/watched-sessions-prompt.test.tstest/scripts/ci-node-test-plan.test.tstest/vitest-scoped-config.test.tsThe planner file's existing integration inventory makes its whole-file cost exceed 30 seconds; the new cases use bounded synthetic file weights through the actual planner to protect worker pricing, excluded-file handling, and child projection. The provider shutdown tests exercise actual process-tree exit and replacement ownership, including the existing four-second TERM/KILL budget; a mocked timer/process would omit the contract exposed by parallel qualification.
Qualification exposed and repaired the Bash cleanup race, native-filesystem mock mismatch, pending provider shutdown race, late lease deletion, and failed-stop promise poisoning. Independent review also found the parallel-parent split underestimate; the executable probe now prices two 200-second singleton children as 200 + 200 seconds, not 100 + 100. No failed test sample was rerun unchanged. Assertions and existing time limits remain intact; no retry policy, baseline exception, or new serial list was added. Earlier harness preflight and transport interruptions remain recorded separately from successful tests.
Fresh Codex branch autoreview is scoped-clean through P2, with no actionable findings. A preceding review's cancellation/reacquisition scenario was rejected after independent and lead source traces; the final review with full owner context confirms that caller cancellation stays separate from shared startup and that the synchronous stopping fence prevents bypassing retirement.
Exact-head CI run 35544335558 passed on attempt one: 147 successful jobs, 15 skipped, zero failures, including
openclaw/ci-gate, in 16m58s. No jobs were rerun. Published ClawSweeper reviews found no code or security defects; this section supplies the requested refreshed qualification, flake repairs, and costs.Remaining pre-merge blocker: the published-updater survivor cell failed on its first attempt. Testbox run 35547884479 used the existing
legacy-operator-state/auto-authcell with published[email protected]and the exact public candidate. Canonical preparation passed, then the cell exited 1 after 260.117 seconds. No retry, version bump, assertion relaxation, package publication, or operator Gateway change occurred.The core updater reported
status: ok; every core step exited zero, and the installed and serving build ID matched the prepared candidate:2026.9.5-962fe39f0f16-2026-09-21T00-33-25.590Z. Gateway verification reported the service running and ready, with channels ready and no plugin startup errors. The prepared tarball’s SHA-256 was5592cf61932692891e9ad1af8fd7e367284f3814bb24adb1e3dfe73059a54112.The complete cell nevertheless failed
successful update failed plugin convergence: the fixture first installs the published Discord tarball, then its candidate-phase registry advertises rebuilt bytes under the same immutable@openclaw/[email protected]identity. The product correctly reports an integrity drift and aborts that plugin update. The assertion prevents the later restart bookkeeping/remaining survivor assertions from running, soupdateRestartSourceremains null. This is not a passing survivor qualification.The owning follow-up is companion registry selection in configure_plugin_registry: preserve published package identity across same-version phases, or use an explicit real version transition. That fixture repair is outside this agents-core lane. The three real-process regressions separately prove local-provider cleanup ordering, replacement ownership, and recovery. This PR remains unmerged as requested.