Skip to content

improve: reduce isolated Gateway CI test time - #154366

Merged
steipete merged 7 commits into
mainfrom
codex/ci-gateway-worker-hillclimb
Sep 21, 2026
Merged

steipete merged 7 commits into
mainfrom
codex/ci-gateway-worker-hillclimb

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Related: #154108

What Problem This Solves

The isolated Gateway CI cohort inherited a two-worker ceiling even on runners with eight available CPUs, leaving the recurring slow job underutilized.

User Impact

No product behavior changes. Eligible CI jobs can finish this cohort sooner, at the cost of higher peak memory and slightly more aggregate CPU. Smaller runners retain the two-worker fallback. Current hosted CI has exercised that fallback; the historical benchmark below is not a whole-pipeline saving claim.

Why This Change Was Made

Give only the measured Gateway isolated/database cohort eight workers when its job runs serially on a current-target self-hosted allocation with at least eight available CPUs and 28 GiB RAM. Enforce that resource floor in the existing executor. Hosted, frozen, overlapping, and smaller allocations retain two workers; ordinary Gateway server tests and other cohorts keep their existing policies.

Preserve every selected file, runtime partition, runner class, matrix cap, packing budget and conservative timing floor. Main's latest packing integration retains its 500-second parallel budget, 360-second settled serial Gateway row, and ordinary singleton two-worker ceiling. Group-level assertions now require the measured Gateway cohort's eight-worker cap and the neighboring groups' two-worker caps. The Gateway cohort remains on Node under every runtime policy.

The upstream compiler fixture repair uses PID plus process start time because Windows can reuse a joined child's PID; this PR retains its same-process negative control. The session-history benchmark stays in the existing Node-required partition after its Bun-parent invocation timed out. No benchmark profiles, assertions, deadlines or coverage are reduced. The precise Bun timeout cause remains unproved; this is conservative runtime admission under the existing policy for observed Bun failures.

Evidence

Candidate e8a147530aafe41ef04bbdef4cf88abad37f4cb0 builds on main 11e376cd584f4f37fc0ea75131cc071b1951b62b. The final rebase is patch-identical and includes the two main-owned CI repairs described below. The necessary conflict resolution preserves main's measured full-CLI worker policy, tooling worker estimates and auto-reply timing identities alongside the isolated Gateway policy. A second necessary integration adopts main's stronger compiler-lifetime implementation from b541b50c6686 unchanged; only the existing same-process negative control is retained using main's field name. The other six commits are patch-identical across that integration. Independent P2 reviews of the worker change and subsequent substantive repairs are clean. Final exact-head CI remains the landing gate.

  • Integration proof on the preceding base: 22 packing/resource/coverage cases passed in 29.20 seconds; five CLI-worker/runtime-routing cases passed in 17.94 seconds. The six-profile comparison at base bb3a9b0f40e1 passed in 68.72 seconds and matched that main planner for inventory, placement, predicted cost and all non-target workers; GitHub plans were byte-identical. Push/PR Node rows: Blacksmith 46/108, hybrid 41/105, GitHub 51/112, within existing caps. At that source, main/PR isolated inventories retained 160/159 files using the canonical lifecycle-proof filter.
  • Historical controlled benchmark, source 39b3aa10677c, eight CPUs and 30.95 GiB: fixed 2/8/8/2-worker runs passed the same 114 files. Wall times were 481.535 / 225.123 / 225.151 / 474.459 seconds: midpoint 478.0 to 225.1 seconds (-52.9%). Eight-worker peak aggregate RSS was 20.70 GiB and midpoint CPU cost rose 8.1%. Benchmark run.
  • Later native functional/resource proof at source 34962e6bd20e: all 130 selected files accounted for, 129 passed and one platform skip; 2,787 tests passed and two existing skips. Actual eight-worker execution took 347.766 seconds, peaked at 20.36 GiB aggregate RSS, and left no surviving descendants or OOM kills. Native proof. Later mainline application changes mean these are source-bound results, not renewed current-source performance claims.
  • Windows lifetime repair: forcing equal numeric PIDs reproduced the original failure (17.628 seconds) and passed after repair (18.491 seconds). With real PIDs restored, three transform cases passed in 13.60 seconds and eleven owner cases in 143.58 seconds. All five Windows jobs passed on subsequent CI heads. Main now owns the stronger processStartTime/isMainThread implementation in b541b50c6686; this branch adopts it unchanged and retains the same-process control. All three transform cases passed after this integration in 12.36 seconds.
  • Node runtime repair: two existing routing-table cases failed before admission changed; 29 routing/resource cases passed afterward in 4.97 seconds. On Linux Node 24.19, the actual shard launcher selected Node and the unchanged 80/10,000-message benchmark passed in 10.710 seconds (13.81 seconds invocation wall). A complete original pinned-Bun group replay passed 738 files plus one existing skip, so it did not reproduce or explain the original timeout. The Linux replay had four CPUs/16.56 GB versus CI's eight CPUs/33.23 GB. Replay carrier.

CI 35593175124 tested head 48d06e3e via merge 32300921466a and failed the benchmark plus one Control UI test. The historical UI failure has an accepted maintainer exception for this landing; its cause remains unresolved: Chromium passed button actionability and scrolling, then stalled during the input action or its post-action renderer check; a separate renderer read also timed out while the browser stayed connected. An exact-source replay of original Linux shard 2/12 passed all 52 files and 242 tests in 482.84 seconds with unchanged deadlines, including the failed case in 1.723 seconds. This is nonreproduction, not a UI fix. One additional instrumented Linux replay passed all 20 question/settings cases and retained renderer profiles and DOM markers without reproducing the stall. Prior-head CI 35599061782 subsequently passed the same 430-pixel case and both required gates. No UI source change, weakened assertion, timeout increase, or retry workaround is included; the failed run and the unresolved cause remain documented.

Earlier CI integration failures have owning repairs: planner fixtures now respect main's lifecycle-proof tier while retaining full main coverage, and upstream 103115f2f0b1 drains agent/shared-state work and asserts settled custody before fixture deletion. This PR preserves that upstream repair unchanged. Earlier complete CI 35586833825 passed, but reported only two CPUs/about 8 GB for the Gateway tail and therefore proves fallback behavior, not eight-worker activation.

The next integration, CI 35627759300, exposed two concrete main-owned fixture defects, both repaired on main before this fresh publication. In c1224ba09be81aca92ad8478ed49ebc541919cbb, the async-question assertion now selects transcript content: the old page-wide lookup also matched the intentional screen-reader announcement. All 15 current browser cases passed in 44.48 seconds; scoped lint and P2 review passed. In 11e376cd584f4f37fc0ea75131cc071b1951b62b, the hosted-lifecycle fixture waits for actual approval publication and existing queue settlement after persistence moved into a worker. Its original 47-file order reproduced the first-case failure while 1,476 tests passed; all nine lifecycle cases passed after repair in 56.93 seconds cold wall, with every authority, host, lane and audit assertion preserved. Fresh P2 review and scoped lint passed. No production behavior, test deadlines or coverage changed. These failures are distinct from the accepted historical Chromium stall.

@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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M maintainer Maintainer-authored PR labels Sep 21, 2026
@steipete
steipete marked this pull request as ready for review September 21, 2026 03:39
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 maintainer review before merge. Reviewed September 21, 2026, 1:55 PM ET / 17:55 UTC (Revision 12).

ClawSweeper review

What this changes

The branch increases isolated Gateway CI workers on sufficiently provisioned runners, preserves conservative fallbacks, keeps the session-history benchmark on Node, and updates regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful and is not implemented on fetched main. No blocking correctness or security defect was found; the resource guards and recorded native measurements support the bounded change.

Priority: P2
Reviewed head: e8a147530aafe41ef04bbdef4cf88abad37f4cb0

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused implementation, explicit resource safeguards, preserved coverage, and carefully bounded native measurements provide strong review evidence.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Recorded native runs exercise the actual Gateway test cohort at eight workers, report memory and descendant cleanup, and separately demonstrate the conservative fallback and real Node shard-launcher benchmark. Results remain bound to their recorded sources; linked raw logs could not be downloaded by this review host.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Recorded native runs exercise the actual Gateway test cohort at eight workers, report memory and descendant cleanup, and separately demonstrate the conservative fallback and real Node shard-launcher benchmark. Results remain bound to their recorded sources; linked raw logs could not be downloaded by this review host.
Evidence reviewed 11 items Introduced change ownership: Reviewed the pinned merge-base-to-head diff. The branch changes CI planning, execution, documentation, and regression coverage; the four UI paths identified as base-only changes are outside this PR’s introduced delta.
Resource admission and fallback: The executor admits the measured allowance only for serial, non-frozen, self-hosted CI execution with the existing eight-CPU resource check and the group’s memory floor. Fallback limits intersect existing lower worker caps before compiler preparation and child execution.
Bounded planner policy: Only the isolated Gateway family receives an eight-worker cap and 28-GiB floor. Final placement retains neighboring group caps, while split timing lookup preserves prior complete two-worker observations as conservative floors.
Findings None None.
Security None None.

How this fits together

OpenClaw’s CI planner groups tests into runner jobs and passes execution limits to the shard launcher. The launcher checks available resources before starting test processes, affecting feedback time and peak memory.

flowchart TD
  A[Test inventory and timing history] --> B[CI job planner]
  B --> C[Packed test groups and limits]
  C --> D[Shard launcher]
  E[Runner resources and execution mode] --> D
  D --> F{Eligible serial host?}
  F -->|Yes| G[Up to eight Gateway workers]
  F -->|No| H[Two-worker fallback]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +172, Docs +34, Config +1, Other +31. Total +238 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 198 26 +172
Docs 3 35 1 +34
Config 1 2 1 +1
Generated 0 0 0 0
Other 3 40 9 +31
Total 12 275 37 +238

Review metrics

Metric Value Why it matters
Worker admission 2 → up to 8 workers; ≥8 CPUs and ≥28 GiB The higher allowance is confined to the measured isolated Gateway cohort on eligible serial self-hosted jobs.
Historical performance tradeoff 52.9% lower cohort wall time; 8.1% higher aggregate CPU The controlled comparison demonstrates the tradeoff without claiming a current-source or whole-pipeline speedup.

Technical review

Best possible solution:

Retain the existing planner and executor as the policy owners, with resource-qualified parallelism, conservative timing floors, and unchanged test coverage.

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

Not applicable as a product-bug reproduction: this is CI optimization, supported by source inspection and recorded controlled runtime measurements; no execution was performed in this review.

Is this the best way to solve the issue?

Yes: extending the existing group limits and executor admission is a narrow solution that preserves inventory, neighboring worker policies, and conservative estimates.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded improvement to recurring CI feedback time, without a demonstrated urgent product regression.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Recorded native runs exercise the actual Gateway test cohort at eight workers, report memory and descendant cleanup, and separately demonstrate the conservative fallback and real Node shard-launcher benchmark. Results remain bound to their recorded sources; linked raw logs could not be downloaded by this review host.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded native runs exercise the actual Gateway test cohort at eight workers, report memory and descendant cleanup, and separately demonstrate the conservative fallback and real Node shard-launcher benchmark. Results remain bound to their recorded sources; linked raw logs could not be downloaded by this review host.

Evidence

What I checked:

  • Introduced change ownership: Reviewed the pinned merge-base-to-head diff. The branch changes CI planning, execution, documentation, and regression coverage; the four UI paths identified as base-only changes are outside this PR’s introduced delta. (e8a147530aaf)
  • Resource admission and fallback: The executor admits the measured allowance only for serial, non-frozen, self-hosted CI execution with the existing eight-CPU resource check and the group’s memory floor. Fallback limits intersect existing lower worker caps before compiler preparation and child execution. (scripts/ci-run-node-test-shard.mts:491, e8a147530aaf)
  • Bounded planner policy: Only the isolated Gateway family receives an eight-worker cap and 28-GiB floor. Final placement retains neighboring group caps, while split timing lookup preserves prior complete two-worker observations as conservative floors. (scripts/lib/ci-node-test-plan.mts:963, e8a147530aaf)
  • Workflow boundary coverage: The workflow forwards the memory floor through its packed group descriptor. The existing executable manifest round-trip test now verifies this field survives into the shard runner; executor cases cover below-floor, at-floor, larger-host, hosted, frozen, overlapping, and lower-cap behavior. (test/scripts/ci-workflow-guards.test.ts:16990, e8a147530aaf)
  • Runtime routing repair: The session-history benchmark joins the existing Node-required partition. Its unchanged test still launches the real benchmark and asserts both 80-message and 10,000-message results; neither its deadline nor its profiles are reduced. The captured body reports a successful run through the actual shard launcher and explicitly leaves the original Bun timeout unexplained. (scripts/lib/ci-test-runtime.mts:46, e8a147530aaf)
  • Native performance and resource evidence: The captured PR body reports a fixed 2/8/8/2-worker comparison at source 39b3aa1: midpoint wall time fell from 478.0 to 225.1 seconds, peak aggregate RSS reached 20.70 GiB, and aggregate CPU increased 8.1%. A later native run at source 34962e6 accounted for 130 files, passed 2,787 tests, peaked at 20.36 GiB, and left no surviving descendants or OOM kills. These are explicitly historical source-bound results, not current-head or whole-pipeline speedup claims. The linked native carrier is https://github.com/openclaw/openclaw/actions/runs/35557654527. Public docs: docs/ci/capacity.md. (docs/ci/capacity.md:231, e8a147530aaf)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-21T06:28:05.450Z sha d43be7f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T07:48:43.027Z sha 94ed74b3115d7e0b4fa94e454ce921c5404762e2 :: needs changes before merge. :: none
  • reviewed 2026-09-21T08:15:22.518Z sha 3cdd292 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T09:29:18.961Z sha 0d1324644ab71495a515124bfc9903337ce65b1a :: needs changes before merge. :: none
  • reviewed 2026-09-21T10:24:38.897Z sha ca11faf :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T11:25:04.213Z sha 48d06e3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T12:33:36.362Z sha 26e6338 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T16:54:02.965Z sha 276d696 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Sep 21, 2026
@steipete
steipete force-pushed the codex/ci-gateway-worker-hillclimb branch from 5e5a352 to 0ea879a Compare September 21, 2026 05:15
@steipete
steipete force-pushed the codex/ci-gateway-worker-hillclimb branch 2 times, most recently from 94ed74b to 3cdd292 Compare September 21, 2026 08:02
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 21, 2026
@steipete
steipete force-pushed the codex/ci-gateway-worker-hillclimb branch from 0d13246 to ca11faf Compare September 21, 2026 10:05
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Sep 21, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 21, 2026
@steipete
steipete force-pushed the codex/ci-gateway-worker-hillclimb branch 3 times, most recently from 5b9b499 to 276d696 Compare September 21, 2026 16:46
Admit up to eight workers for the Gateway isolated/database-worker cohort only on roomy serial self-hosted jobs, with a 28 GiB memory floor and the existing two-worker fallback. Preserve sibling caps, timing history, coverage and matrix budgets.
Use the upstream synthetic Gateway fixture for recipient and worker-cap assertions after rebase. Keep the fixture isolated from the changing project inventory and preserve every placement and execution-policy assertion.
Keep the upstream settled serial row, prediction, inventory, and neighboring packing assertions while checking the measured Gateway and unmeasured sibling worker limits at their group owner.
Retain the observed-failing Node process and SQLite lifecycle benchmark in the existing Node-required runtime partition. Preserve the complete test, profiles, assertions, and deadline, with routing coverage for bun-compatible and dual policies.
@steipete
steipete force-pushed the codex/ci-gateway-worker-hillclimb branch from 276d696 to e8a1475 Compare September 21, 2026 17:47
@steipete
steipete merged commit 8f5be79 into main Sep 21, 2026
156 checks passed
@steipete
steipete deleted the codex/ci-gateway-worker-hillclimb branch September 21, 2026 18:11
vincentkoc added a commit that referenced this pull request Sep 21, 2026
* commit '8a26ae487b5fb9b72ea2c12bf384e9c776659429': (154 commits)
  fix(ui): preserve skill group expansion when filtering (#150911)
  test(gateway): consolidate server history and lifecycle fixtures (#155063)
  test(codex): select HTTP fallback in native finalizer fixtures (#155008)
  improve: reduce isolated Gateway CI test time (#154366)
  test(gateway): await approval registration acknowledgments
  fix(workboard): explain blocked-card claim recovery (#154990)
  perf(agents): consolidate exec target policy tests (#155060)
  perf(config): consolidate environment test fixtures (#155062)
  fix(ui): keep the chat rail anchored through composer resize
  fix: recovery tests wait for committed outcomes (#154995)
  fix(codex): keep inference bursts from failing turns (#154945)
  fix(memory): keep generated REM reflections out of promotion rankings (#154994)
  fix(sqlite): reclaim scratch files when storage is full (#154937)
  test(cli): spawn the compiled Doctor entry in the output process test (#155055)
  fix(update): distinguish config validation execution failures (#154892)
  test(doctor): await session cleanup before deleting fixture state
  fix(update): report unavailable service inspection accurately (#154896)
  test(gateway): observe plugin approval response completion
  perf(msteams): reduce file-consent test scaffolding (#155050)
  fix(ui): retain saved permissions during delayed startup reads (#154982)
  ...
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
* ci: use measured Gateway test worker limits

Admit up to eight workers for the Gateway isolated/database-worker cohort only on roomy serial self-hosted jobs, with a 28 GiB memory floor and the existing two-worker fallback. Preserve sibling caps, timing history, coverage and matrix budgets.

* test(ci): preserve measured Gateway placement expectations

* test: identify compiler lifetimes across PID reuse

* test(ci): respect proof tiers in Gateway policy coverage

* test(ci): retain synthetic Gateway placement ownership

Use the upstream synthetic Gateway fixture for recipient and worker-cap assertions after rebase. Keep the fixture isolated from the changing project inventory and preserve every placement and execution-policy assertion.

* test(ci): preserve Gateway caps through dense packing

Keep the upstream settled serial row, prediction, inventory, and neighboring packing assertions while checking the measured Gateway and unmeasured sibling worker limits at their group owner.

* ci: keep session history benchmark on Node

Retain the observed-failing Node process and SQLite lifecycle benchmark in the existing Node-required runtime partition. Preserve the complete test, profiles, assertions, and deadline, with routing coverage for bun-compatible and dual policies.

Co-authored-by: Peter Steinberger <[email protected]>
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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: M 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