Repository navigation
perf(agents): reuse roster ids per config generation - #183853
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 completeClawSweeper finished reviewing this revision. The review result is being finalized. |
steipete
force-pushed
the
steipete/perf-micro-agent-roster-per-request-20260919
branch
from
October 25, 2026 21:33
5b4c65a to
891a64f
Compare
steipete
marked this pull request as ready for review
October 25, 2026 21:43
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
deleted the
steipete/perf-micro-agent-roster-per-request-20260919
branch
October 25, 2026 21:57
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 26, 2026
* perf(agents): reuse roster ids per config generation * fix(plugin-sdk): preserve distinct roster compatibility export
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 request agent resolution rebuilt the configured roster, projected every entry, normalized every ID, and allocated a new set/list on every lookup even when runtime config had not changed.
User Impact
Repeated session reads do less CPU and allocation work. Agent selection, legacy roster handling, and database admission behavior remain unchanged. No configuration changes or migration are required.
Why This Change Was Made
Move the existing roster-facts owner down to the roster module and let
listAgentIdsconsume it. Published config uses its publication revision; immutable captures use object identity; synchronous batches retain their existing lifetime. Config republication replaces the derived IDs. Unbound mutable configs still derive fresh results.Only internal ID lists are shared and frozen. Entry projections retain their mutable contract. The existing Plugin SDK facade copies the shared IDs, preserving independently writable arrays across all three public exports; a boundary regression proves mutations do not affect later reads. The internal caller audit found no mutations of returned ID arrays. Production delta is +14 lines: the existing owner moved intact, and the added field/read/store removes repeated roster derivation without adding a second cache or invalidation policy.
Evidence
Acceptance declared in the benchmark: identical IDs, fewer rebuilt lists, lower warm CPU and sampled allocation per lookup. Synthetic 200-agent roster, 10,000 lookups per mode, five batches of 2,000; separate timing and allocation passes. Base
2649110d60a13f32a33a7ae7bc8c242f4abb2bdc. Local host load was approximately 30–60. A reversed-order confirmation measured published CPU at 193.0 ms base versus 0.556 ms candidate; captured CPU was 195.1 ms versus 0.705 ms.Rerun:
node --import ./scripts/tsx.mjs scripts/perf/agent-roster-ids-measure.ts, then separately with--allocations. The script header documents optional base-module selection. This is warm owner attribution, not a whole-Gateway throughput or latency claim. The lane's explicit duplicate-recomputation fast path uses owner proof rather than a long Gateway A/A campaign; no production load was generated.Regression covers shared immutable IDs, same-object republication removing an agent, rejection of the removed ID, interleaved old captures, and fresh mutable reads after clearing publication.
Pinned-base regression: fails at repeated-list identity as intended (1 failed, 21 skipped; 418.49 s including compiled-worker preparation). Candidate: all 77 tests across five focused files passed in 544 s including worker preparation. The new roster regression took 12 ms and the SDK mutation regression 2 ms.
node scripts/run-vitest.mjs src/agents/agent-scope-config.test.ts src/plugin-sdk/agent-scope-runtime.test.ts src/gateway/session-request-agent.test.ts test/scripts/eager-import-closure.test.ts test/scripts/pr-wrapper-source-closure.test.ts --maxWorkers=1: passed.pnpm tsgo:core: passed.git diff --check, andscripts/check-export-name-collisions.mts: passed.The initial baseline setup was invalidated by a source edit during compiler preparation; the reported red/green proof comes from fresh runs with fixed source. PR CI supplies broad validation. Independent subagent review (autoreview route unavailable): no actionable P0/P1/P2 findings. The autoreview helper refused startup because the selected provider route did not match operator configuration; configuration was not changed.