Repository navigation
test(gateway): measure populated startup through usable session access - #178087
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: needs maintainer review before merge. What this changesThis PR adds a populated startup workload, measures successful session access, records shutdown outcomes, and traces two existing bootstrap steps. Example: The populated workload serves agent:incident-agent-01:bench-0, then exits with code 23 during teardown.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds useful startup measurement coverage, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe startup benchmark creates isolated synthetic state, launches a Gateway, probes HTTP and WebSocket access, and produces timing and lifecycle results. flowchart LR
A[Benchmark options] --> B[Synthetic fixture]
B --> C[Gateway child process]
C --> D[HTTP readiness probes]
C --> E[Session RPC probe]
C --> F[Process tree shutdown]
D --> G[Benchmark report]
E --> G
F --> G
Technical reviewBest possible solution: Retain the populated benchmark and existing lifecycle owners, then land after the exact-head required checks pass. Do we have a high-confidence way to reproduce the issue? Current main finishes HTTP probing without requiring session RPC success and does not reject teardown-time failures; source inspection establishes both measurement gaps without executing target code. Is this the best way to solve the issue? The change extends the existing benchmark, WebSocket client, state writers, and process cleanup owner, providing a focused solution without retaining the rejected cache optimization. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5b1e93eaef0e. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +6, Tests +177, Docs +48, Other +283. Total +514 across 4 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 20, 2026, 2:58 AM ET / 06:58 UTC (Revision 2). |
81859bc to
40e2c4e
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40e2c4ef36
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Use Node 26.8 read-only compilation caching while retaining writable worker caches and existing older-runtime behavior. Add populated-session startup measurements and trace the parallel prekernel catalog/runtime preparation.
40e2c4e to
d98c789
Compare
|
The paired measurements are complete. The cache experiment improved the seeded-session RPC by only 0.36% cold and 1.93% prewarmed, below the recorded 5% threshold, so it has been removed. The final scope is startup tracing and the populated readiness/lifecycle benchmark. The CI-reported raw fixture write now uses the existing async state writer, and the port-allocation review finding is fixed with a regression. A fresh fixture boot serves the seeded session and exits cleanly; all 28 focused tests pass and independent review is clean. The current head is d98c789; CI is running. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
openclaw#178087) test(gateway): measure populated startup through usable session access (openclaw#178087) Add a populated synthetic startup workload and require successful access to its seeded session over WebSocket RPC. Preserve startup spans, reject unclean populated benchmark shutdowns, and bound high-port allocation. Keep catalog and model-runtime preparation parallel while exposing their trace spans. The compile-cache experiment was removed after paired measurements remained below the 5% threshold; no runtime startup speedup is claimed. Validation: 28 focused tests, real isolated Gateway session-access and shutdown checks, independent review, and all selected exact-head CI checks passed.
What Problem This Solves
Gateway startup measurements could stop at HTTP readiness without proving access to the populated session roster. They also accepted a process killed by the benchmark's two-second teardown timeout. That makes startup optimizations difficult to assess against both usable readiness and lifecycle behavior.
User Impact
Developers can measure startup through access to a populated session roster and detect unclean benchmark shutdowns. There is no change to Gateway readiness or cache behavior.
Why This Change Was Made
Add an opt-in
teamBootworkload with 44 synthetic startup-active external plugins, eight agents, 4,096 sessions, a 135,950,336-byte state database, and eight 1,228,800-byte agent databases. Prepared fixture roots and a shared future start time support concurrent paired runs without measuring fixture generation.Measure the first successful
sessions.listover the real WebSocket transport. The populated case must return the exact seeded session; refused connections, empty rosters, and unrelated sessions do not count. Preserve all startup trace lines and expose the already-parallel catalog-snapshot and model-runtime bootstrap steps. Benchmark ports are at least 40000. Hosts unable to supply that range fail with a bounded, explicit setup error.Record shutdown duration and forced cleanup. The populated case allows 30 seconds for teardown and fails on nonzero exit, signal termination, or forced cleanup. Other workloads retain their existing teardown policy.
This final change does not alter Gateway cache policy, readiness, plugin activation, or recovery ordering. Runtime production changes are eight added and two removed lines of trace instrumentation (net +6); the remaining growth is the requested benchmark, fixture, documentation, and regression coverage.
Measurement and Decision
A read-only main-thread compile-cache experiment was rejected and removed: it did not meet the pre-recorded >5% startup improvement threshold. The benchmark and tracing remain as the requested measurement infrastructure; no startup speedup is claimed for this final PR.
The experiment compared baseline
de3473171a22ad4c062f65f4b1ff3dccf462419fplus identical trace instrumentation against the cache candidate on Node 26.8.2. Four concurrent pairs ran per condition under one exclusive measurement lock at a time, with separate state/cache roots, synchronized starts, 16 CPUs per side, and alternating CPU halves. The remaining short pairs were batched under one lock acquisition. Cold bytecode and explicitly prewarmed bytecode were measured separately. The decision uses within-pair candidate-minus-baseline differences.Cold paired RPC changes were +0.01%, +0.14%, -0.72%, and -0.78%; prewarmed changes were -4.89%, -1.19%, -1.75%, and -2.11%. With only four samples, nearest-rank p95 is the maximum: cold 17,816.33 → 17,818.01 ms; prewarmed 15,456.12 → 14,699.62 ms. Median process-tree CPU was 22.0 → 22.5 seconds cold and 22.0 → 22.0 seconds prewarmed (individual readings have whole-second granularity). Median peak RSS moved from about 4,235 → 4,126 MiB cold and 4,247 → 4,155 MiB prewarmed. Per-pair
mpstatrecords were retained; mean idle across the measured CPU set ranged from 72.5–93.4% cold and 88.5–93.5% prewarmed, including the benchmark itself.The first cold baseline sample's critical path was bootstrap 0–3.00 s, HTTP listening around 5.71 s, session projection complete around 6.41 s, post-bind plugin startup 6.73–16.41 s, and final sidecar readiness at 17.68 s. The 44 external fixture plugins spent 8.86 s preparing sources serially. That phase awaits isolated worker preparation; catalog and model-runtime bootstrap work already overlap. Main-session recovery overlaps projection before readiness; subagent recovery is already after readiness.
The fixture establishes a repeatable populated workload, not the external/bundled plugin mix or remote-worker topology of any production deployment. The <8-second target was not reached. The experiment used prior-base artifacts and was rejected; its numbers are not an exact-head performance claim. Broader plugin-preparation concurrency needs a separate change that preserves ordered selection, registration, rollback, and memory-plugin ownership.
Evidence
pnpm tsgo:corecheck passed using tsrs before the benchmark-only teardown follow-up.d98c789a94cd6362b848d72a5e20ac3396e6352d, including the database-writer guard, Node tests, types, lint, and all three PostgreSQL conformance shards: CI run 39382826822. The required CI and security gates are green; fresh ClawSweeper and Codex reviews report no outstanding findings.