Repository navigation
perf(ai): reuse request schema depth admission - #185159
Merged
steipete merged 2 commits intoOct 26, 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 26, 2026 23:18
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-tool-schema-projection-20260919
branch
from
October 26, 2026 23:23
1b1d2b5 to
da7ff9c
Compare
steipete
deleted the
steipete/perf-micro-tool-schema-projection-20260919
branch
October 26, 2026 23:40
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 27, 2026
* perf(ai): reuse request schema depth admission * test(perf): narrow published schema fixture to an object
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
Provider request conversion repeats a full schema-depth walk immediately after request preparation has already bounded and detached the same schema, even on normalization-cache hits.
User Impact
Reduces allocation and CPU during repeated non-strict OpenAI tool conversion. Provider payloads, schema hashes, strict-mode selection, and mutable input validation retain their existing behavior.
Why This Change Was Made
Reuse membership in the existing synchronous preparation map as the depth-admission fact. Its owner restores the prior map when conversion returns, so the optimization adds no retained cache, invalidation mechanism, or provider policy. Direct inputs still pass through depth checking. Published schemas continue to use their existing immutable publication.
Runtime production delta: +9 lines. The small addition exposes the existing owner's preparation fact so the duplicate traversal can be removed without weakening the direct mutable-input boundary. The required non-test/non-doc diff is +187 lines: +9 runtime and +178 reproducible benchmark tooling. Simplification pass retained only this owner fact, one regression, and reproducible measurement.
Evidence
Acceptance rule, recorded before measurements: unchanged payload bytes and SHA-256 plus canonical schema fingerprint; repeated and fresh-run workloads improve allocation or CPU; published control is neutral. Timing is untraced, allocation is sampled separately. Two counterbalanced AB/BA pairs, 2,000 requests per arm per timing/allocation pass, Node 24.22.1 on macOS. Fresh-run mode creates 100 catalogs outside measurement and uses each for 20 requests. Strict mode verifies that
strict: trueis actually emitted. Baseline source:f6115599b4f3; the measured runtime patch is unchanged after rebasing.The repeated 80-tool case saves 900,526 B and 264.69 µs CPU per request; fresh-run mode saves 897,234 B and 283.44 µs. Payload bytes/SHA-256 and canonical schema fingerprints match across all arms. Selected-mode payloads are also checked before and after warming outside measurements. The non-strict 80-tool payload is 56,951 bytes, SHA-256
9cff19f74526d9120bc578e9112474142840ea01f189c43efe9461f5914f7ed5.The short published control is noisy: paired CPU deltas were +6.51% and +30.34%, while four identical-source A/A pairs produced +0.25%, +7.37%, +21.90%, and −1.21%. Lengthened 20,000-request AB/BA controls gave 36.56 → 31.65 µs CPU and 92,105 → 92,303 B/request (+198 B, +0.216%). This unchanged short-circuit path is treated as neutral, not a speedup or a regression. All original observations are included rather than discarded.
Local one-minute host load ranged 28.5–33.0 for the improved workloads. All processes were bounded below 30 seconds (maximum 16.52 seconds). The remote benchmark host's guard refused admission because load reached 139 and dirty memory exceeded 5 GB; no remote measurement ran, and the task sandbox/lock were cleaned up.
Reproduce using the committed script header, for example:
Use
--mode across-runs,--mode published, or--strictfor the other cases; run base/candidate in AB/BA order.The regression fails on the base with one redundant traversal instead of zero. Candidate focused schema suites pass 52 tests, covering deep schemas, strict downgrade, mutable source updates, option isolation, quarantine/recovery, and scope expiry. The schema test command took 84.5 seconds, mostly cold worker preparation. Prompt-prefix stability and required import-closure tests also passed (40 tests; 238.9-second command). Core typecheck, changed-file lint/format, export-name collision guard, and diff checks passed.
Independent subagent review (autoreview route unavailable). The configured review-route preflight rejected the requested provider selection; no configuration was changed. The independent review checked the production owner, callers, lifecycle, and regression.
This is owner-boundary proof for a synchronous duplicate-work deletion. No whole-Gateway performance claim or production load test is made.
PR CI passed on final head
da7ff9cabe29399456ee63efd1e57995546ef050: run 40419389706. All selected tests, typechecks, lint, prompt snapshots, boundary checks, and the CI gate passed. Automated code review also completed on this head with no findings.