Skip to content

perf(models): skip unused source projection for known route overrides - #183871

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-deep-equal-comparisons-20260919
Oct 25, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-deep-equal-comparisons-20260919

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Provider route preparation projects the full runtime config back onto authored values even when the request has already established that transport overrides are present. The selected branch discards that projection, including its deep comparisons and clone.

User Impact

No routing or authorization behavior changes. Requests with an established transport override do less preparation work; unresolved override facts still inspect authored configuration.

Why This Change Was Made

Move authored-source projection into the existing branch that consumes it. No new cache, identity contract, or invalidation mechanism. Production code shrinks.

Evidence

The regression counts authored-source projections across repeated model resolutions and checks that present, none, and omitted request facts all preserve configured overrides. It fails on the unmodified base for the unnecessary projection.

Owner measurements used Node 26.12.1 on macOS arm64, baseline 49dacaa1ca264815a52533adafd506fd836cb61e and the reviewed candidate (now d81c1487123e2c14935318872c06ad41f13b1759). The rebase preserved the measured route and projection owner code.

Owner benchmark: node --expose-gc --import ./scripts/tsx.mjs scripts/perf/provider-route-overrides.ts --output .local/provider-route-overrides.json. Synthetic config has 40 plugins, 100 agents, and 8 providers with 25 models each. Each arm uses five warm timing passes of 2,000 preparations and a separate sampled-allocation pass; cloned runtime inputs exercise projection and captured config inputs are the control. Acceptance: delete the unused projection, retain routing results, reduce cloned-input CPU/allocation, and check the captured-input control for adverse movement. Sequential base/candidate/base/candidate runs expose host drift.

Input / pair CPU ms per 2,000 (base → candidate) Sampled bytes/call (base → candidate) Host load, base / candidate
cloned, pair 1 1296.193 → 17.354 346325 → 15071 83.9–87.8 / 80.2–82.3
cloned, pair 2 1122.693 → 18.019 346409 → 15088 87.4–95.1 / 88.7–88.7
captured, pair 1 23.450 → 25.167 16150 → 16164 81.8–81.8 / 82.3–82.3
captured, pair 2 23.563 → 20.104 16361 → 15869 100.7–100.7 / 88.7–88.7

Across the two paired medians, cloned-input CPU falls 98.5% and sampled allocation falls 95.6%. The second baseline allocation profile attributes 112.3 MB to Node deep-comparison frames; candidate comparison allocation is zero. The captured-config control has mixed-sign CPU deltas (+7.3%, −14.7%) and essentially stable allocation; no stable adverse effect is established. These small CPU totals are context, not a claimed captured-config speedup. Main-thread or whole-Gateway metrics were not collected.

Production delta: 4 added / 6 removed lines (net −2). The benchmark and regression are proof tooling. Independent subagent review (autoreview route unavailable) found no actionable P0–P2 findings; autoreview preflight refused the requested provider/config mismatch. Baseline: the intended regression fails (one projection instead of zero); 30 other tests pass. Candidate: 44 tests pass across src/plugins/provider-model-routes.test.ts, src/plugins/provider-model-routes.installed.test.ts, and src/agents/openai-model-routes.test.ts, using OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/plugins/provider-model-routes.test.ts src/plugins/provider-model-routes.installed.test.ts src/agents/openai-model-routes.test.ts --maxWorkers=1 (390.31 s wall including cold worker compilation/verification; plugin tests 72.67 s wall and about 6 s test execution). Changed-file oxfmt, scoped type-aware lint, and git diff --check pass. An initial default-runtime run was interrupted during artifact verification before a verdict; the complete Node rerun supplies the proof. An initial lint attempt selected the overly broad root config and timed out preparing SDK declarations; matching core/test/scripts lint configs then passed. PR CI supplies broad validation. This is a narrow discarded-work deletion; it makes no whole-Gateway CPU, latency, or throughput claim. The requested fast-path proof exemption applies, so no 10-minute Gateway stress campaign was run.

@clawsweeper

clawsweeper Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S labels Oct 25, 2026
@steipete
steipete marked this pull request as ready for review October 25, 2026 21:45
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-25T21:45:48.854992Z d81c148 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete merged commit 72379bf into main Oct 25, 2026
195 checks passed
@steipete
steipete deleted the steipete/perf-micro-deep-equal-comparisons-20260919 branch October 25, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant