Skip to content

fix(scripts): prevent gateway benchmarks from stalling on probes - #119063

Merged
vincentkoc merged 3 commits into
mainfrom
fix/gateway-bench-probe-deadline
Aug 4, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix/gateway-bench-probe-deadline

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where developers running the Gateway startup, restart, or concurrency benchmarks could see healthy probes time out or benchmark phases overrun their intended deadline when response bodies stalled or response headers kept trickling.

Why This Change Was Made

Gateway benchmark probes now use the probe endpoints' existing HEAD contract and settle from the response status without waiting for a body. Each attempt also has an explicit 100 ms wall-clock deadline, with one settlement guard covering response, timeout, and socket-error races. Normal response completion clears the deadline and preserves the reusable socket; timeout and failure paths destroy the request.

This changes benchmark tooling only. Gateway runtime behavior, probe endpoint semantics, and product configuration are unchanged.

User Impact

Gateway benchmarks now measure readiness from the status line and keep every probe attempt within its intended budget, including under partial or continuously active HTTP responses.

Evidence

  • Exact head: bed8e7061ed6812a7abdea0728d75f57cc8fd2c8.
  • Final-head concurrency Vitest: 8/8 passed on Node 24.18 and Node 26.4.
  • Earlier focused sibling sweep: 95 tests passed across:
    • test/scripts/bench-gateway-startup.test.ts
    • test/scripts/bench-gateway-restart.test.ts
    • test/scripts/bench-gateway-concurrency.test.ts
    • src/gateway/server-http.probe.test.ts
  • Regression coverage proves:
    • healthy probe headers succeed without response-body completion;
    • the client uses HEAD;
    • continuously trickled, incomplete headers still time out by wall clock;
    • two sequential successful samples reuse one HTTP connection.
  • oxfmt --check: passed.
  • Scoped oxlint: passed.
  • git diff --check: passed.
  • Exact-head P1 autoreview and TruffleHog: clean.
  • The changed-gate remote delegation was unavailable because the selected Azure broker route returned 403 admin_required; trusted-source focused local proof was used as the documented fallback.

Repair Boundary

  • Root cause: Node's request timeout measured socket idleness rather than total attempt time, and the shared helper waited for response-body end even though readiness is decided by the status line.
  • Architectural owners: the shared Gateway benchmark requestStatus() transport helper and the concurrency sampler's request lifecycle.
  • Canonical fix: use the Gateway probe endpoints' HEAD contract, enforce absolute attempt deadlines, resolve successful responses without destroying their sockets, and reserve request destruction for failed or timed-out attempts.
  • Removed paths: the GET body-drain/idle-timeout probe path and success-path request destruction.
  • Production delta: +59/-25 lines, net +34; tests +209/-3, net +206.
  • Sibling coverage: startup health/readiness, restart initial and recovery probes, concurrency initial readiness, trickled-body deadlines, and successful connection reuse.

@vincentkoc vincentkoc self-assigned this Aug 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 4, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Aug 4, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 4:12 AM ET / 08:12 UTC.

ClawSweeper review

What this changes

The PR makes Gateway benchmark probes use HEAD status responses and wall-clock deadlines, and bounds concurrency benchmark HTTP reads so trickled responses cannot stall a run.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for the protected maintainer landing decision. The exact head repairs a current benchmark-only timeout/body-drain defect with no actionable review finding; its base should be refreshed against current main before normal landing.

Priority: P2
Reviewed head: bed8e7061ed6812a7abdea0728d75f57cc8fd2c8
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is narrowly scoped, contract-aligned, and supported by meaningful boundary regressions; only current-base landing verification remains.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This is a maintainer-authored PR, so the external-contributor real-behavior-proof gate does not apply; focused behavior tests and CI reported in the PR remain supplemental evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored PR, so the external-contributor real-behavior-proof gate does not apply; focused behavior tests and CI reported in the PR remain supplemental evidence.
Evidence reviewed 7 items Current-main defect: Current main sends GET, waits for the response body to end, and relies on a 100 ms request timeout in the shared probe helper; an active but incomplete response can therefore prevent settlement.
Gateway HEAD contract: Gateway probe routing accepts GET and HEAD, computes the same readiness status, and omits only the HEAD body; the existing probe test verifies HEAD /readyz returns its status with no body.
Exact-head owner-boundary repair: The branch moves the shared probe helper to HEAD/status settlement with a settled guard and explicit 100 ms wall-clock timer, while the concurrency reader retains GET because it consumes response bodies.
Findings None None.
Security None None.

How this fits together

Gateway benchmark scripts start or restart a local Gateway and poll its health/readiness endpoints before collecting timing samples. Probe status and bounded HTTP reads determine whether each benchmark phase advances or fails within its budget.

flowchart LR
  A[Benchmark scripts] --> B[Probe and sample requests]
  B --> C[Shared probe helper]
  C --> D[Gateway health and readiness endpoints]
  D --> E[Status and wall-clock deadline]
  E --> F[Benchmark timing result]
  B --> G[Concurrency response reader]
  G --> E
Loading

Decision needed

Question Recommendation
Should this maintainer-owned benchmark fix land after GitHub verifies its clean merge result against current main? Verify current-base result and land: Confirm the clean merge result and required exact-head checks, then use the normal maintainer landing path.

Why: The PR carries the protected maintainer label and current main has advanced since the recorded integration proof, so a maintainer must make the final landing decision.

Before merge

  • Resolve merge risk (P1) - The PR is behind current main; its recorded clean integration used an earlier base, so the normal maintainer path should verify the exact current merge result before landing.
  • Complete next step (P2) - No repair is needed; protected maintainer ownership and current-base verification remain the only actions before normal landing.
Agent review details

Security

None.

PR surface

Tests +206, Other +34. Total +240 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 209 3 +206
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 59 25 +34
Total 4 268 28 +240

Review metrics

Metric Value Why it matters
Production vs test delta production +34 net; tests +206 net The production growth is justified by one canonical deadline/settlement owner boundary, with targeted regressions covering both timeout and socket-reuse behavior.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the shared-helper and concurrency lifecycle repair after current-base merge verification, preserving HEAD status probing and bounded GET body reads as the two distinct benchmark contracts.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the shared-helper and concurrency lifecycle repair after current-base merge verification, preserving HEAD status probing and bounded GET body reads as the two distinct benchmark contracts.

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

Yes in source: current main waits for a GET response body and uses a socket-idle timeout, while the Gateway already exposes equivalent HEAD status responses; the added exact-head tests model the stalling paths, though this read-only review did not execute them.

Is this the best way to solve the issue?

Yes. Repairing the shared probe helper and the common concurrency HTTP lifecycle is preferable to changing Gateway endpoints or relying on request socket timeouts, because the endpoint already supports HEAD and the callers that require bodies retain GET.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b1f2aae3034f.

Labels

Label justifications:

  • P2: This is a bounded repair to developer benchmark tooling, with limited blast radius outside benchmark operators.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored PR, so the external-contributor real-behavior-proof gate does not apply; focused behavior tests and CI reported in the PR remain supplemental evidence.

Evidence

What I checked:

  • Current-main defect: Current main sends GET, waits for the response body to end, and relies on a 100 ms request timeout in the shared probe helper; an active but incomplete response can therefore prevent settlement. (scripts/lib/gateway-bench-probes.ts:134, b1f2aae3034f)
  • Gateway HEAD contract: Gateway probe routing accepts GET and HEAD, computes the same readiness status, and omits only the HEAD body; the existing probe test verifies HEAD /readyz returns its status with no body. (src/gateway/server-http.ts:192, b1f2aae3034f)
  • Exact-head owner-boundary repair: The branch moves the shared probe helper to HEAD/status settlement with a settled guard and explicit 100 ms wall-clock timer, while the concurrency reader retains GET because it consumes response bodies. (scripts/lib/gateway-bench-probes.ts:136, bed8e7061ed6)
  • Regression coverage: The branch adds tests for headers without body completion, continuously trickled incomplete headers, trickled response bodies, and successful keep-alive socket reuse. (test/scripts/bench-gateway-concurrency.test.ts:154, bed8e7061ed6)
  • Node timeout contract: Installed Node type documentation states that ClientRequest.setTimeout applies socket.setTimeout, supporting the distinction between an inactivity timeout and the branch's independent wall-clock timer. (/usr/local/lib/node_modules/webpack/node_modules/@types/node/http.d.ts:1108)
  • Feature provenance: Blame attributes the current GET/body-drain helper to the shared benchmark-probe refactor lineage carried by Vincent Koc; the PR's three commits are also by Vincent Koc. (scripts/lib/gateway-bench-probes.ts:134, dc11c7892777)

Likely related people:

  • vincentkoc: Current helper blame and the shared benchmark-probe refactor history point to Vincent Koc; all three focused PR commits are also his. (role: original shared-probe refactor author and recent area contributor; confidence: high; commits: 887297e04a09, dc11c7892777, e77d831793a3; files: scripts/lib/gateway-bench-probes.ts, scripts/bench-gateway-concurrency.ts, test/scripts/bench-gateway-concurrency.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Verify the clean merge result and required checks against current main before landing.

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 (6 earlier review cycles)
  • reviewed 2026-08-04T04:03:32.966Z sha 02370cd :: found issues before merge. :: [P2] Bound the concurrency sampler’s HTTP requests
  • reviewed 2026-08-04T05:02:42.284Z sha cb312e3 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T05:31:49.840Z sha cb312e3 :: found issues before merge. :: [P2] Preserve completed response sockets
  • reviewed 2026-08-04T06:05:52.209Z sha bed8e70 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T07:13:22.586Z sha bed8e70 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T07:30:34.857Z sha bed8e70 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/gateway-bench-probe-deadline branch from 02370cd to cb312e3 Compare August 4, 2026 04:19
@clawsweeper clawsweeper Bot added 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 Aug 4, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 4, 2026 05:25
@vincentkoc

Copy link
Copy Markdown
Member Author

Draft workflow step complete; please refresh the exact-head readiness verdict after the normal merge gates run. @clawsweeper re-review

@clawsweeper clawsweeper Bot added 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. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed 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. labels Aug 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head bed8e7061ed6812a7abdea0728d75f57cc8fd2c8 resolves every prior before-merge item and rank-up move:

  • normal response completion clears the deadline and resolves without destroying the request;
  • timeout and failure paths still destroy the request;
  • the new two-successful-request regression proves one HTTP connection is reused;
  • final-head concurrency tests pass 8/8 on Node 24.18 and Node 26.4;
  • exact-head formatting, diff checks, P1 autoreview, and TruffleHog are clean.

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper could not start a re-review for this item.

Reason: re-review requires an open issue or PR.

@clawsweeper clawsweeper Bot added 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. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

The remaining exact-head merge gates are complete for bed8e7061ed6812a7abdea0728d75f57cc8fd2c8:

  • CI is complete: 73 successful, 26 skipped, 0 failed, 0 pending.
  • Maintainer exact-commit review is clean through P1 with no actionable findings.
  • The durable review already reports no repair finding and identifies the shared probe helper as the correct owner boundary.

Please refresh the durable checklist against this exact head.

@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 Aug 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head: bed8e7061ed6812a7abdea0728d75f57cc8fd2c8.

The remaining stale-base and maintainer-handling items are resolved:

  • A clean no-commit merge into current main 32c5f0205075b92b2333764a86086a4e56bc248f had zero conflicts and zero touched-file overlap.
  • The merged state passed 97 focused tests across Gateway startup, restart, concurrency, and HTTP probe coverage.
  • Scoped script lint, formatting, and git diff --check passed.
  • The exact-head review has no code finding; as member owner, I approve the bounded probe-deadline behavior and normal maintainer landing path.

Please refresh the durable Before merge list. This PR will not be merged while it contains an unresolved item.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head bed8e7061ed6812a7abdea0728d75f57cc8fd2c8 has completed protected maintainer review and is approved for the normal landing path. Exact-head CI is green; the clean current-main integration proof and 97 focused tests are recorded in the PR body and prior review request.

Please refresh the durable Before merge and Rank-up moves: lists against this completed maintainer decision.

@vincentkoc
vincentkoc merged commit 98feafe into main Aug 4, 2026
122 of 133 checks passed
@vincentkoc
vincentkoc deleted the fix/gateway-bench-probe-deadline branch August 4, 2026 08:23
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Post-landing verification for merge commit 98feafe78506fabb7c928585a79bb803305ad061 on current origin/main b6a445c393ec378d066ced0d31b679ad4c6c2f72:

  • the merge commit is an ancestor of current main
  • no later main commit changed the benchmark helper, concurrency benchmark, or the two regression-test files
  • current-main focused proof passed 97/97 tests across:
    • test/scripts/bench-gateway-startup.test.ts
    • test/scripts/bench-gateway-restart.test.ts
    • test/scripts/bench-gateway-concurrency.test.ts
    • src/gateway/server-http.probe.test.ts
  • the landed helper uses HEAD, resolves on response status, enforces a wall-clock deadline, and preserves successful socket reuse
  • the landed concurrency request path separately bounds trickled bodies by the benchmark deadline

This supplies the exact-current-main verification that was still listed before merge.

vincentkoc added a commit that referenced this pull request Aug 4, 2026
…checkpoint

* origin/main: (46 commits)
  fix(agents): recover from invalid compaction summaries (#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (#119166)
  fix(plugins): preserve metadata reloads during models status (#119183)
  fix(test): bound direct gateway server runs (#119184)
  test(tui): prove command surfaces through PTY (#119165)
  fix(testbox): restore claims across path aliases (#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (#119164)
  fix(testbox): remove changed-gate sync residue (#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (#118998)
  fix(auto-reply): suppress false no-reply fallback during continuations (#119154)
  fix(scripts): prevent gateway benchmarks from stalling on probes (#119063)
  test(channels): verify built sanitizer semantics (#119151)
  fix: prevent live updater from leaving Gateway offline indefinitely (#119116)
  test(qa): restore memory tools primary ownership (#119142)
  fix(agents): settle yielded fanout at harness boundary (#118703)
  fix(codex): cap compaction override warning cache via createDedupeCache (#101745)
  fix(daemon): skip unlabeled launchd plists (#119091)
  test(qa): repair QA catalog integrity (#119140)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
…nclaw#119063)

* fix(scripts): bound gateway benchmark probes

* fix(scripts): bound concurrency response deadlines

* fix(perf): preserve benchmark socket reuse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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