Skip to content

improve(bench): verify Gateway work across CPU affinity - #149702

Merged
vincentkoc merged 5 commits into
mainfrom
perf/vcpu-scaling-20260916
Sep 18, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
perf/vcpu-scaling-20260916

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Related: #149700

What Problem This Solves

The Gateway concurrency benchmark could count status-only turns as successful work, mix background inference into foreground totals, and include warmup lifecycle evidence in measured turns. Failed child launches could also leave the detached mock provider running.

Why This Change Was Made

Verify canonical terminal receipts, expected output, effective model binding, and successful tool execution before counting a turn. Capture bounded request purpose, byte length, and continuation facts before log clipping. Separate setup, same-process warmup, measured load, and post-load accounting. Route failed spawns through the existing teardown owner.

Add opt-in --agent-warmup-turns and Linux Gateway-only --gateway-cpus, with actual Gateway/driver/mock placement recorded. Application runtime, configuration, and persistent data-model changes: zero. The optional CPU fields use benchmark child IPC and an explicitly requested report; the prior review's migration checkbox does not apply to application storage or Gateway protocol.

Benchmark tooling: +434/-24; tests: +481/-10. The tooling growth owns workload verification, phase accounting, and explicit process placement.

User Impact

Developers can compare verified work across fresh and warmed runtimes and Linux CPU placement. Failed launches report a controlled failure and clean up their children and fixture. This changes benchmark tooling only.

Evidence

  • Runtime revision 30793cb3c7d01b7dfeaf832ddb3e2643f6ae494d was exercised as its exact six-file overlay on pinned baseline d64c442c77723f6536cb9677851906460474880c. Blacksmith Testbox, Node 24.19.0, pnpm 12.3.4, one frozen install. Packaged build passed in 282.085 s; its stamp correctly names the baseline, and overlay hashes match before/after build and contracts.
  • Normal and tool smokes passed in 10.005 s and 20.009 s. Each verified two warmup and four measured turns, exact foreground request/continuation counts, two history probes, and six control-plane probes. Tool mode recorded two warmup and four measured tool turns. Gateway affinity was CPUs 0–1; driver/mock affinity was 0–3. These prove correctness, not an isolated-driver timing comparison.
  • Build/contract run: archive SHA256 656b34871036115ceb3284ce4531c832506130ee77ad8e8fb57a9787975793b4, 41 verified members. A later separate CPU001 test-type phase reached 600 s, so the aggregate run remains failed. Independent review accepted the completed upper case: final proof restores all 43,634 baseline blobs and the receiver, with no surviving observed child groups. CPU001 types remain unqualified.
  • Current head 2a2b7dc96e7fbb433ebb925a233f33c10568010a changes only the documentation: it names all six checkpoints and separates optional same-Gateway agent warmup from measured load. All six tested runtime/test blobs remain identical. Scoped source autoreview, independent review, formatting, and whitespace checks passed; fresh exact-head CI and ClawSweeper review remain required before landing.

Earlier AWS C7a affinity measurements did not demonstrate a normal Gateway speedup and had differing background work. They do not establish a shared-vCPU, SMT, quota, Hetzner, or bare-metal comparison; the separate worker-owner result is documented in the linked repair PR.

Reproduce

After pnpm build, run this tiny Linux fixture with valid host CPU IDs:

node scripts/bench-gateway-concurrency.ts \
  --concurrency 2 --agent-count 1 --session-count 2 \
  --history-messages 2 --history-message-chars 128 \
  --turns-per-session 2 --agent-warmup-turns 1 \
  --history-clients 1 --history-burst 1 --subscribers 1 \
  --visible-observer --control-plane --probe-rounds 2 \
  --stream-chunk-delay-ms 20 --gateway-cpus 0,1 \
  --runs 1 --warmup 0 --timeout-ms 180000 --output /tmp/gateway-bench.json

Add --tool-events and use a separate output file for the tool contract. Controlled foreground comparison and idle-worker attribution remain separate follow-ups.

Punchcard-Session: clear-workshop-brook-w2

@vincentkoc vincentkoc self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 12:00 AM ET / 04:00 UTC (Revision 6).

ClawSweeper review

What this changes

The PR verifies completed Gateway benchmark turns, separates warmup and measured work, adds optional Linux CPU placement, and handles failed child launches.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains useful work absent from current main, with no actionable findings. The previous launch-error and documentation findings are resolved; the prior migration blocker does not apply to benchmark IPC and report artifacts.

Priority: P2
Reviewed head: 2a2b7dc96e7fbb433ebb925a233f33c10568010a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused benchmark improvement with relevant runtime evidence, meaningful regression coverage, and no remaining actionable findings.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): Recorded Testbox runs exercise the changed benchmark through a built Gateway with normal/tool turns, separate warmup accounting, verified receipts, and observed CPU placement; runtime blobs remain unchanged at this head. These results establish benchmark correctness, not a CPU-affinity speedup; archived log retrieval was unavailable to this reviewer.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Recorded Testbox runs exercise the changed benchmark through a built Gateway with normal/tool turns, separate warmup accounting, verified receipts, and observed CPU placement; runtime blobs remain unchanged at this head. These results establish benchmark correctness, not a CPU-affinity speedup; archived log retrieval was unavailable to this reviewer.
Evidence reviewed 9 items Verified review scope: The merge-base-to-head delta contains the seven supplied paths. Comparison against the previously exercised runtime revision changes only docs/reference/test/performance.md, preserving all six runtime/test blobs.
Current main still needs the verification improvement: Current main returns immediately for an initial non-tool status of ok and otherwise does not verify the terminal receipt, effective model, or expected non-tool reply. Searches also found neither new benchmark option on main.
Latest release retains status-only verification: The benchmark source at the supplied latest release, v2026.9.4, returns on initial status ok and checks only completion status afterward; it does not contain this PR's receipt verification.
Findings None None.
Security None None.

How this fits together

The concurrency benchmark launches an isolated Gateway and mock provider, sends synthetic agent turns, and measures responsiveness and CPU usage. Its verification and accounting determine which completed work appears in the benchmark report.

flowchart TD
  A[Benchmark options] --> B[Isolated Gateway and mock provider]
  B --> C[Optional agent warmup]
  C --> D[Measured turns and probes]
  D --> E[Verify replies and terminal receipts]
  B --> F[Request and CPU observations]
  E --> G[Benchmark report]
  F --> G
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Tests +474, Other +410. Total +884 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 488 14 +474
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 5 434 24 +410
Total 7 922 38 +884

Review metrics

Metric Value Why it matters
Benchmark controls 2 opt-in flags; 0 application settings Warmup defaults to zero and CPU affinity remains unset unless explicitly requested.
Growth by responsibility Application runtime 0; benchmark tooling +434/-24; tests +481/-10 Tooling growth has a stated purpose: workload verification, phase accounting, and process-placement evidence.

Stored data model

Persistent data-model change detected: serialized state: scripts/lib/gateway-bench-profile-preload.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep workload verification, phase accounting, and optional CPU placement in the existing isolated benchmark owner, without application migrations.

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

Yes, source inspection establishes the existing status-only success path and missing receipt checks; no current-main runtime reproduction was executed.

Is this the best way to solve the issue?

Yes, the patch extends the existing benchmark and consumes canonical terminal evidence without adding a competing runtime owner or changing operator state.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This improves the reliability of developer performance measurements with limited impact outside benchmark tooling.
  • 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 (linked_artifact): Recorded Testbox runs exercise the changed benchmark through a built Gateway with normal/tool turns, separate warmup accounting, verified receipts, and observed CPU placement; runtime blobs remain unchanged at this head. These results establish benchmark correctness, not a CPU-affinity speedup; archived log retrieval was unavailable to this reviewer.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded Testbox runs exercise the changed benchmark through a built Gateway with normal/tool turns, separate warmup accounting, verified receipts, and observed CPU placement; runtime blobs remain unchanged at this head. These results establish benchmark correctness, not a CPU-affinity speedup; archived log retrieval was unavailable to this reviewer.

Evidence

What I checked:

  • Verified review scope: The merge-base-to-head delta contains the seven supplied paths. Comparison against the previously exercised runtime revision changes only docs/reference/test/performance.md, preserving all six runtime/test blobs. (2a2b7dc96e7f)
  • Current main still needs the verification improvement: Current main returns immediately for an initial non-tool status of ok and otherwise does not verify the terminal receipt, effective model, or expected non-tool reply. Searches also found neither new benchmark option on main. (scripts/bench-gateway-concurrency.ts:1214, f5c0aa37ef96)
  • Latest release retains status-only verification: The benchmark source at the supplied latest release, v2026.9.4, returns on initial status ok and checks only completion status afterward; it does not contain this PR's receipt verification. (scripts/bench-gateway-concurrency.ts:847, 3a9d69db306c)
  • No application migration boundary: The CPU environment fields travel through the existing private benchmark child IPC channel. Request logs live in the temporary fixture, and the report is explicitly emitted as benchmark output. The introduced diff changes no application schema, stored preference, plugin API, or Gateway protocol. (scripts/lib/gateway-bench-profile-preload.ts:14, 2a2b7dc96e7f)
  • Prior findings resolved: Both child launches await the spawn event inside existing teardown protection. The documentation now describes six checkpoints, including optional agent warmup, and lifecycle totals filter warmup from measured turns while retaining late-event validation. (scripts/bench-gateway-concurrency.ts:1824, 2a2b7dc96e7f)
  • Recorded runtime proof and inspection limits: The captured PR body records Blacksmith Testbox normal/tool runs through the real benchmark and built Gateway: each verified two warmup and four measured turns, foreground request accounting, history/control probes, and Gateway CPUs 0–1 versus driver/mock CPUs 0–3. Runtime revision 30793cb remains byte-identical at this head. The linked run https://github.com/openclaw/openclaw/actions/runs/35137334727 is aggregate-cancelled; the body explicitly leaves the later CPU001 type phase unqualified. Direct job-log retrieval was blocked by the review environment's storage-host allowlist, so archived logs were not independently reread. (30793cb3c7d0)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (5 earlier review cycles)
  • reviewed 2026-09-16T04:55:22.594Z sha 97a528e :: blocked before merge. :: [P2] Handle taskset launch errors before waiting for Gateway readiness
  • reviewed 2026-09-16T05:09:53.402Z sha 27d21eb :: blocked before merge. :: [P2] Handle taskset launch errors before waiting for Gateway readiness
  • reviewed 2026-09-16T06:11:35.699Z sha 0b88597 :: blocked before merge. :: none
  • reviewed 2026-09-16T19:30:52.273Z sha 30793cb :: blocked before merge. :: [P3] [P3] Update the documented checkpoint count and phases
  • reviewed 2026-09-16T19:51:28.381Z sha 2a2b7dc :: blocked 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 16, 2026
Punchcard-Session: brisk-summit-brook-mr
Punchcard-Session: brisk-summit-brook-mr
Punchcard-Session: brisk-summit-brook-mr
@vincentkoc
vincentkoc force-pushed the perf/worker-session-lookup-20260916 branch from a71e4b7 to 3a273a9 Compare September 16, 2026 14:16
@vincentkoc
vincentkoc force-pushed the perf/vcpu-scaling-20260916 branch from 0b88597 to 30793cb Compare September 16, 2026 19:20
@vincentkoc
vincentkoc changed the base branch from perf/worker-session-lookup-20260916 to main September 16, 2026 19:20
@vincentkoc
vincentkoc marked this pull request as ready for review September 16, 2026 19:24
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 30793cb3c7d01b7dfeaf832ddb3e2643f6ae494d. The final body records the completed build and both runtime contracts, the separate CPU001 type deadline, and the disposition of the prior data-model checklist item.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Punchcard-Session: clear-workshop-brook-w2
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Sep 16, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 2a2b7dc96e7fbb433ebb925a233f33c10568010a. This docs-only successor addresses revision 4’s checkpoint/phase finding: six checkpoints, including optional same-Gateway agent warmup separated from measured load. All six runtime/test blobs remain identical to the accepted source-bound build and normal/tool contracts described above. Scoped autoreview, independent review, targeted formatting, and whitespace checks passed; fresh exact-head CI is running.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc merged commit eb32f22 into main Sep 18, 2026
331 of 333 checks passed
@vincentkoc
vincentkoc deleted the perf/vcpu-scaling-20260916 branch September 18, 2026 04:45
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
)

* improve(bench): verify warmed Gateway work across CPU affinity

Punchcard-Session: brisk-summit-brook-mr

* fix(bench): bind inference markers through runtime context

Punchcard-Session: brisk-summit-brook-mr

* fix(bench): clean up failed Gateway launches

Punchcard-Session: brisk-summit-brook-mr

* test(perf): separate warmup lifecycle evidence from measured turns

Punchcard-Session: clear-workshop-brook-w2

* docs(perf): describe agent warmup checkpoints

Punchcard-Session: clear-workshop-brook-w2
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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L 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