Repository navigation
perf(gateway): prepare session event field order once per audience - #183877
Merged
steipete merged 2 commits intoOct 25, 2026
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
steipete
marked this pull request as ready for review
October 25, 2026 21:47
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. |
steipete
force-pushed
the
steipete/perf-micro-session-event-broadcast-20260919
branch
from
October 25, 2026 21:57
31a87e4 to
b33b2c8
Compare
steipete
deleted the
steipete/perf-micro-session-event-broadcast-20260919
branch
October 25, 2026 22:11
This was referenced Oct 25, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 26, 2026
…penclaw#183877) * perf(gateway): prepare session event field order once per audience * fix(perf): type session field-order benchmark instrumentation
This was referenced Oct 26, 2026
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
Session-event fanout repeatedly enumerates and sorts the same presented row when recipients have different delivered histories and negotiate field references.
User Impact
Reduces allocation and CPU work during session updates while preserving each recipient's payload, delivery history, and live permission checks.
Why This Change Was Made
Retain the filtered, sorted field list on the existing publication-local audience. Field-reference comparisons still use each delivery's own payload. Projection/access revision invalidation already replaces the audience, so the prepared order has the same lifetime as its row. Runtime code grows by one net line to carry this prepared value; there is no second preparation path.
Evidence
2992c0b8dd4f7165c0420601cbb7b51720225b54: two audience rows were each enumerated twice, failing the expected once-per-audience count. Existing decoded-payload, mixed-capability, history, and permission-revocation assertions remain.All five divergent-history pairs improved CPU and allocation. Mean paired percentage changes were −28.79% CPU and −20.23% allocation; table percentages compare the means. The aligned control is effectively neutral, with mixed CPU signs and a small allocation increase. Per-arm host-load observations were 1.37–1.98 for divergent histories and 1.70–1.77 for aligned histories. No samples were discarded.
Reproduce from the committed script's header: save the PR-base projection source (
72379bfe686ab07ff8e69162013779f72ee0d4ea) for a fresh comparison, then runnode --import ./scripts/tsx.mjs scripts/perf/session-event-field-order.ts --baseline-source <saved-source> --publications 500 --pairs 5. Measurements ran in an isolated Linux sandbox under the shared measurement lock.Pre-rebase validation: 9/9 focused tests passed across
session-row-delta-audiences,session-row-publication-authority, andsession-row-delta-delivery; changed-file type-aware lint, formatting, diff whitespace, and export-name collision checks passed. The changed audience test file took 6.71 seconds of test execution; the first uncached baseline invocation took 725.67 seconds including module-cache preparation. Exact-head CI completed successfully; see the final validation result below.Independent subagent review (autoreview route unavailable) found no actionable P0–P2 findings. The canonical helper refused the configured provider route because it did not match the operator configuration; no configuration was changed. An earlier lint invocation selected the wrong configuration and timed out preparing plugin declarations before lint; the corrected source-backed lint configurations passed.
The required eager-import and PR-wrapper closure checks passed (22/22 tests; 112.38 seconds total). Runtime source delta: +1 line; regression delta: +11 lines; benchmark/tooling delta: +356 lines (+357 non-test lines total). The committed benchmark and exact executable-root registration provide reproducible measurement tooling.
The benchmark measures the real projection/broadcast owners with synthetic state and in-memory sockets. It does not establish whole-Gateway latency or throughput; the scoped duplicate-work deletion uses owner measurements and focused boundary proof rather than a ten-minute Gateway stress campaign.
Rebased cleanly onto
72379bfe686ab07ff8e69162013779f72ee0d4eabefore the final push. The upstream projection change adds one nullable envelope field; the optimization patch is unchanged and incremental independent review is clean. The numerical comparison above remains evidence from the explicitly pinned base, and exact-head PR CI passed on the integrated head.The first CI run found an implicit-any parameter in the benchmark instrumentation. It is now typed from the built-in
Object.entriescontract; targetedpnpm tsgo:scriptsand benchmark lint pass, and independent review of the repair is clean. The repair has no runtime effect.Final validation: CI run 40237891003 completed successfully on
b33b2c87b0406c915407389056b8f5be1a6a4e01, including the browser-extension end-to-end job. GitHub code review also completed on that exact head with no findings. The initial failing CI run was superseded by the benchmark type repair; no jobs were rerun to chase green.