Repository navigation
perf(gateway): skip suppressed ambient channel discovery - #184078
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
October 26, 2026 01:52
Contributor
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. |
Avoid catalog and environment-prefix preparation when ambient channel credentials are suppressed. Explicit channel configuration and persisted credential discovery remain independent, with unchanged readiness gates. Add a work-count regression and collected-allocation startup profiling through the external readiness boundary.
steipete
force-pushed
the
steipete/perf-gateway-startup-readyz-20261026
branch
from
October 26, 2026 02:05
93eecd7 to
23e0de8
Compare
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 26, 2026
…4078) * perf(gateway): skip suppressed ambient channel discovery Avoid catalog and environment-prefix preparation when ambient channel credentials are suppressed. Explicit channel configuration and persisted credential discovery remain independent, with unchanged readiness gates. Add a work-count regression and collected-allocation startup profiling through the external readiness boundary. * test(gateway): fix startup profiler check contracts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Gateway startup prepares bundled-channel catalogs, external-channel environment metadata, and prefix tables even when ambient channel credentials are suppressed. Those results are discarded by the existing suppression branch.
User Impact
A small startup allocation/CPU reduction with identical readiness and channel-presence semantics. Explicit configuration and persisted credentials remain available; ambient credentials are still suppressed unless explicitly enabled. No new configuration, cache, schema, or readiness deferral.
Why This Change Was Made
Move the environment-only preparation inside its existing allowed-ambient branch. Production LOC delta is 0 (13 lines relocated); there is no extra mechanism. Startup profiling shows module/filesystem loading and plugin runtime preparation dominate; this PR removes only the bounded redundant channel-discovery work.
The benchmark's opt-in heap profiler now samples collected objects before Gateway entry imports and stops on the first successful external
/readyzresponse plus IPC delivery. Timing runs remain unprofiled. The existing synthetic startup fixture is increased to 10,000 sessions, eight agents, and 44 plugins.Evidence
Acceptance before comparison: preserve outputs, prove zero catalog work with ambient suppression, reduce owner CPU/allocation, and retain readiness behavior. The startup-only deletion uses focused startup measurements rather than a steady-state stress campaign.
Owner workload: 40 synthetic plugins and 40 configured channels; 250 warmups, 5,000 measured calls per arm per pair, AB/BA order; separate untraced timing and collected-object allocation sampling (4 KiB interval), Node 26.12.1 on macOS.
Both pairs agree on CPU and allocation direction. Output checksums match. Timing host load was high; CPU uses
process.threadCpuUsage, not wall-time scheduling delay. Reproduction:node --expose-gc --import ./scripts/tsx.mjs scripts/perf/channel-presence-suppression.ts --iterations 5000 --mode timingand repeat with--mode allocationon each revision.The work-count regression fails on base: both sync and async suppressed discovery still call the channel catalog. It verifies explicit config and persisted-auth signals as well as zero catalog/environment metadata reads after the fix.
Startup baseline:
ab3425a265a8d3e78b7d47f00d3b4ce5059f1329. Separate diagnostic CPU/heap passes reach readiness on synthetic state. The CPU profile's largest main-thread samples are filesystem open/stat/read, plugin generation path handling, module compilation, and GC; channel-presence discovery is approximately 6 ms inclusive. Collected allocation sampling attributes about 1.35 MiB to channel-presence work out of 3,764.97 MiB total. These diagnostic runs are not latency comparisons.Focused proof: all 73 tests across
src/channels/config-presence.test.ts,src/gateway/server-startup-config.ambient-channels.test.ts,src/gateway/server-startup-log.test.ts, andtest/scripts/bench-gateway-startup.test.tspass. Total wrapper wall time 287 s (cold compilation dominated); channel tests took 17.71 s wall / ~3.2 s test time, startup benchmark tests 208 s wall / 34.9 s test time (existing subprocess coverage). The added profiler case is a small real Node subprocess. The export-name collision guard and both eager-import/PR-wrapper source closure files pass (22 tests, 50.38 s wrapper wall).Independent subagent review (autoreview route unavailable): clean at P2. The configured autoreview provider selector was rejected before inference; operator configuration was not changed.
Setup issues excluded from measurements: the first saved-build launch lacked packaged root launcher modules, corrected before any valid startup sample; a test fixture needed to retain its IPC channel; one test compilation was rejected because source changed during compilation, then rerun with frozen inputs. The stable-input focused run is green.
Both built sourcePerformance artifacts, changed-file lint, formatting, and
pnpm tsgo:scriptspass. The initial tooling typecheck caught the IPC overload nullability and lint caught a shadowed callback name; both are corrected and the incremental review is clean.Synthetic Gateway startup
Five serial alternating launches per arm, same retained synthetic fixture, fixed built artifacts; no profiler on timing runs. Both arms had separate diagnostic starts first, so these are warmed retained-state starts, not cold-disk or first-install timings. Every
/healthz,/readyz, and seededsessions.listprobe succeeded; all shutdowns were graceful.The readiness median rose 9.5%, but the signed paired mean was +0.207 s (+0.77%), with mixed signs and wide overlapping ranges; aggregate process-tree CPU mean changed by −0.58%. This does not demonstrate a startup wall-time improvement or establish a material regression. The isolated owner saving is the supported performance claim. No adverse claim is made from these noisy low-count startup timings, and no tail percentile is used as a gate. The trace heap is an internal startup mark, not a forced-GC retained-heap measurement.
Median critical-path phase spans (overlap/nesting means they must not be summed): model-runtime preparation 7.493→7.954 s; post-bind plugin loading 6.656→7.286 s; process bootstrap 4.303→5.480 s; session admission 0.823→0.898 s; session projection 0.800→0.812 s. The plugin-loading and database-admission owners remain unchanged.
Startup reproduction:
pnpm build sourcePerformance, preserve each revision's packaged root modules anddistwith the same dependency installation; seed withnode --import ./scripts/tsx.mjs scripts/bench-gateway-startup.ts --case teamBoot --fixture-root <synthetic-root> --seed-only; alternate each built--entry <revision>/dist/entry.jswith--runs 1 --warmup 0 --timeout-ms 180000 --output <report.json>. Separate diagnostic runs add either--cpu-prof-dir <dir>or--heap-prof-dir <dir>. CPU ranking uses the main-thread profile prefix through external readiness. Profiles are diagnostic, not a substitute for the unprofiled comparison.Runtime production LOC is +13/−13 (net 0). Non-test/non-doc delta including tooling is +261: the additional code is the requested reproducible owner benchmark and start-to-readiness allocation capture, not new Gateway machinery.
Limitations: synthetic metadata plugins and sessions, no real-provider/channel turns, no live production traffic, and no 10-minute steady-state stress campaign under the startup-only fast-path exception. These measurements do not establish production deploy downtime savings. Baseline build is the SHA above; candidate measurements use that baseline plus the reviewed runtime hunk, before the required publication rebase. Exact-head CI is reported separately.
Publication rebase onto
7e15500187cd1430cf954ad43e2fd4fb89ac1dd2preserved both reviewed patches (git range-diffidentical). Exact PR head:23e0de8df1f1ba93aa4a591d30f81135d32692f5. Exact-head CI: green — CI run 40257379167 and security/dependency gate. Final live check read: 62 passed, 58 skipped, none pending or failed. GitHub Codex code review completed on this exact head with no findings. The PR remains ready and unmerged for maintainer handoff.The first CI run caught two tooling-only issues: the profiler listener returned a Promise to a void event callback, and a test asserted a heap-profile field absent from Node’s declared type. The repair uses a synchronous listener and retains the stronger named-allocation checks while removing the redundant field assertion. Focused lint, the affected root-script test-type check, and all 45 startup-benchmark tests pass after repair. Independent incremental review is clean at P2. All other selected jobs in the first CI run passed; no rerun was used to chase green.