Skip to content

fix(perf): retry stress setup while Gateway sidecars start - #194563

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-team-stress-startup-readiness-20261107
Nov 7, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-team-stress-startup-readiness-20261107

Conversation

@steipete

@steipete steipete commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes canonical Team-shaped stress setup aborting when /readyz passes before Gateway startup sidecars admit the first sessions.create request.

User Impact

Benchmark operators can finish setup through this temporary refusal. There is no Gateway runtime behavior change. The first setup request gets a maximum 120-second total budget; transport errors, unrelated refusals, and measured RPC failures still fail immediately.

Why This Change Was Made

The Gateway explicitly reports a pre-admission UNAVAILABLE error with retryable: true, details.reason: "startup-sidecars", and retryAfterMs. The existing script WebSocket client now supports an opt-in retry for exactly that response, honoring the delay within one request-and-wait deadline and logging every wait. Only the first synthetic session creation opts in, before warmup or measurement.

The existing client owns the retry; there is no new module, product configuration, schema, or production runtime code. Added tooling is necessary to respect the existing startup response contract.

Evidence

  • Existing real-WebSocket suite: 10/10 pass, 1.96 seconds including wrapper startup. Cases cover success after the advertised delay, a stalled retry within the same deadline, an advertised delay beyond the deadline, an unrelated refusal, and unchanged default behavior.
  • The recovery regression fails against unmodified 10bbb1ed21821aac4ab7409a5be75699a02fd671: the request settles immediately with the startup refusal instead of waiting. It fails on behavior, not imports, type arity, or fixture setup.
  • pnpm tsgo:test:root: all four strict root shards pass, including scripts and tooling. Changed-file format, lint, and git diff --check pass.
  • The single existing regression file grows by 78 lines, covered by an exact test-line allocation. No new test file or product exports.
  • Codex autoreview: local review and final branch review both scoped-clean at the requested default P0 threshold, with no accepted/actionable findings. Final reviewed range: 10bbb1ed21821aac4ab7409a5be75699a02fd671 → bf33a13ead512afb903ca191dfece9b6accd2bef. The exact branch command was python3 ~/.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --engine codex, with AUTOREVIEW_* / CODEX_* environment overrides removed.

The observed canonical setup failure is reproduced at the actual WebSocket request boundary. A new full Gateway stress campaign has not yet run with this tooling fix; this PR makes no performance or shutdown-latency claim.

CI on exact head bf33a13ead512afb903ca191dfece9b6accd2bef completed with one inherited baseline-ratchet failure (and its aggregate gate); the other concrete checks passed. Run 42359026079 tested merge 0b1005ff54f580e3decbc16ddfa09b17c0eb0e0c, whose parents are main 87c57b41c5906fc25205aaf18363d37750f07b2a and this PR head. Its only changes from that main parent are these five PR files, including exactly 78 new test lines and 78 lines of allocated credit. The ratchet reports 6,560,791 test lines against a 6,560,781 ceiling; subtracting this PR's 78 from each proves the unchanged main parent already had a 10-line deficit (6,560,713 against 6,560,703). The main CI run is green but skips this ratchet, so it is not cited as a direct ratchet pass. No unrelated allocation, CI rerun, or runtime change was added to chase green.

@clawsweeper

clawsweeper Bot commented Nov 7, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T09:18:20.392856Z bf33a13 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S labels Nov 7, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 7, 2026
@clawsweeper

clawsweeper Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds bounded, opt-in retries for startup-sidecar refusals on the first synthetic session creation.

Example: The first sessions.create receives UNAVAILABLE with reason startup-sidecars and retryAfterMs 500.

  • Before: Stress setup aborts immediately.
  • After: Setup waits 500 milliseconds and retries within a shared 120-second deadline.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused implementation with meaningful transport coverage and no concrete finding; confidence is limited to supplied harness evidence.
Proof confidence 🦐 gold shrimp (3/6) The supplied real-WebSocket tests exercise the changed client against injected startup refusals, but no post-fix stress-command trace is supplied; this maintainer-authored PR is outside the ordinary contributor proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Benchmark operators can lose an otherwise valid stress run when its first session creation arrives before startup admission opens.
Reason: The maintainer-authored direction is narrow and useful, preserves runtime admission policy, and adds no product setting or persisted state.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a concrete stress-setup failure that remains on main. No introduced correctness or security bug was found; the required test-line CI gate remains red.

Priority: P2
Reviewed head: bf33a13ead512afb903ca191dfece9b6accd2bef

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not include the stress command recovering from a real Gateway startup refusal; the body explicitly acknowledges that limit.
Agent review details

How this fits together

The stress driver uses a shared script WebSocket client to create synthetic sessions before warmup; Gateway responses determine whether setup continues or fails.

flowchart LR
  A[Stress controller] --> B[Setup RPC]
  B --> C[Script WebSocket client]
  C --> D[Gateway admission]
  D --> E[Startup refusal]
  E --> C
  D --> F[Session creation]
  F --> G[Warmup and measurement]
Loading

Technical review

Best possible solution:

Keep the bounded retry in the existing client and handle inherited test-line debt separately.

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

Source establishes the failure path: the Gateway emits a retryable pre-admission refusal, the base client returns it immediately, and the stress RPC wrapper throws; this review did not execute target code.

Is this the best way to solve the issue?

The patch is a small, coherent repair: one existing client owns retry scheduling, one setup call opts in, and the shared deadline prevents retries from extending indefinitely.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned change and current main: The introduced diff contains only the retry, its setup opt-in, documentation, regression coverage, and allocation. The affected executable paths are unchanged between the merge base and fetched main, so main still fails immediately on this refusal. (scripts/perf/transcript-broadcast-measure.ts:5811, d02defd90c72)
  • Replay is limited to pre-admission refusal: The router returns the structured startup refusal before session authorization and handler work. Each retry sends a fresh request through normal dispatch; transport failures and other refusal reasons are not retried. (src/gateway/server-methods/request-authorization.ts:319, bf33a13ead51)
  • Focused transport regression: The existing real-WebSocket fixture covers recovery after the advertised delay, a stalled retry, deadline exhaustion, unrelated refusal, and unchanged default behavior. The body reports the recovery case failing on the base and passing on the head; no tests were executed during this review. (test/scripts/gateway-ws-client.test.ts:99, bf33a13ead51)
  • Failed CI and inherited ceiling debt: The failed job identifies test-lines as the failing ratchet: https://github.com/openclaw/openclaw/actions/runs/42359026079/job/128363618990. Read-only accounting finds 6,560,830 test lines against a 6,560,303 ceiling; removing this PR's 78 test lines and matching allocation preserves the same 527-line excess. The allocation therefore does not introduce that debt. The CI log download redirected to a blocked host, so its exact diagnostic remains unavailable. (config/test-lines-allocations/team-stress-startup-readiness.txt:1, bf33a13ead51)
  • Existing capability checked: The package Gateway client already handles startup refusal during connection authentication, but that reconnect path does not provide the script client's bounded post-connect sessions.create retry. (packages/gateway-client/src/client.ts:929, bf33a13ead51)
  • Policy and history applied: Read root, scripts, and test guidance, plus the maintainer, simplification, and test-audit guidance; no maintainer-notes directory exists. History identifies Vincent Koc's shared-client introduction and Peter Steinberger's sustained stress-tooling work. Following history reached a missing older object; relevant current and original client blobs remained readable. The checkout remains clean. (AGENTS.md:1, bf33a13ead51)

Likely related people:

  • Peter Steinberger: Raw commit cd2d13f adds scripts/perf/transcript-broadcast-measure.ts:5735 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cd2d13f73d69; files: scripts/perf/transcript-broadcast-measure.ts)
  • Vincent Koc: Raw commit d0f05d9 adds scripts/lib/gateway-ws-client.ts:69 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d0f05d98d24e; files: scripts/lib/gateway-ws-client.ts)

PR surface

Tests +78, Docs +6, Other +52. Total +136 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 78 0 +78
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 3 58 6 +52
Total 5 142 6 +136

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The failure blocks a benchmark setup path while leaving deployed Gateway behavior and measured RPC handling unchanged.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 7, 2026, 4:31 AM ET / 09:31 UTC.

@clawsweeper

clawsweeper Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: applying reviewed decision.

I am applying the reviewed decision for this pull request: fix(perf): retry stress setup while Gateway sidecars start This is item 1/1 in the current shard. Shard 1/1.

This transient lease prevents a newer review from overlapping label, comment, or close mutations.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 83f7614 into main Nov 7, 2026
127 of 131 checks passed
@steipete
steipete deleted the steipete/fix-team-stress-startup-readiness-20261107 branch November 7, 2026 20:23
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: S 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