Skip to content

Speed up Auto Efficient decisions and benchmark all reasoning efforts - #7273

Merged
iscekic merged 3 commits into
mainfrom
igor/auto-efficient-efforts
Oct 8, 2026
Merged

iscekic merged 3 commits into
mainfrom
igor/auto-efficient-efforts

Conversation

@iscekic

@iscekic iscekic commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Start uncached classification while settings, capabilities, and routing-table reads run.
  • Preserve coding-plan eligibility checks before classification.
  • Keep the six-question classifier, billing, cache, stickiness, and owner custom pools unchanged.
  • Store platform model selections without a reasoning effort.
  • Expand each selected model into every reasoning variant from the live catalog.
  • Keep one default pair for a model without reasoning variants.
  • Reconcile exact pairs on config saves, daily sync, queue drains, and publication.
  • Publish canonical variants and rank each model/effort pair independently.
  • Show current-engine effort coverage and queue status for each selected model.
  • Collapse each route to its first-ranked pair; expand it to show all pair metrics.

VM measurements and decision

Used an e2-standard-8 Google Cloud VM in europe-west3-a.
Compared 72 golden cases, three repetitions per design, with interleaved ordering and concurrency three.
All requests resolved to typesafe/jev-1.13-20260917.

Design Route p95 Total p95 Weighted score Mean cost
Current six questions 336.18 ms 336.40 ms 0.84560 $0.000274785
Compact six questions 332.37 ms 332.83 ms 0.84097 $0.000231609
One routing + five analytics 330.92 ms 350.02 ms 0.84398 $0.000292320

Keep the current payload: the split saved little routing latency, increased cost by 6.4%, and reduced the measured weighted score.
The implementation removes serial preparation waits instead.

Actual Worker HTTP measurements used 72 cold-session requests before and after, alternating constrained and unconstrained requests.

Request path Before p50 After p50 Before p95 After p95
Unconstrained 359.68 ms 334.62 ms 552.43 ms 397.52 ms
Constrained 364.67 ms 334.21 ms 1020.11 ms 561.45 ms

Constrained p95 fell 45.0% in this VM sample. These numbers do not establish production latency guarantees.

Verification

  • VM typechecks passed for contracts, auto-routing, auto-routing-benchmark, and web.
  • Contracts: 95 tests passed.
  • Auto-routing request path: 77 tests passed.
  • Benchmark package: 291 tests passed.
  • Targeted web checks: nine tests passed; the seven UI tests also passed after the mobile sizing fix.
  • Changed-file formatting and lint passed.
  • Actual HTTP config save expanded GLM 5.3 Flash into none, high, and xhigh registry entries.
  • The real CLI/container/gateway smoke returned odd for high and xhigh, with recorded cost.
  • The provider rejected the catalog-advertised none effort with Reasoning is mandatory; failures remain visible.
  • Actual repeated-session requests preserved zero classifier cost on cache hits.
  • Owner custom-pool HTTP requests preserved the selected exact pair without platform expansion.
  • Verified collapse, expansion, keyboard controls, and layouts at 375, 768, 1024, and 1440 pixels.
  • Ranking screenshots use the explicitly labelled local vm-ui-smoke-fixture, not completed benchmark scores.
  • The full local benchmark was started; this PR does not claim all 540 cases completed.

Updated the benchmark README and Auto Efficient architecture decision record. No database migration is required.

@iscekic iscekic self-assigned this Oct 8, 2026
@iscekic

iscekic commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Verified against the live web app on the Google Cloud VM. The ranking data uses the explicitly labelled local vm-ui-smoke-fixture; these are not completed benchmark scores. The model selector and registry coverage use the actual catalog and queued profiles. Keyboard expansion and collapse passed. The screenshots show the 375px collapsed summary and the 1440px expanded exact-pair table.

375px collapsed route summary with labelled UI fixture

1440px expanded model-effort pair ranking with labelled UI fixture

@kilo-code-bot

kilo-code-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental change bounds the platform catalog fetch with a 10-second AbortSignal deadline that covers body reads, resolving the previously flagged unbounded queue-drain wait; no new issues found in the changed lines.

Files Reviewed (3 files)
  • services/auto-routing-benchmark/README.md
  • services/auto-routing-benchmark/src/platform-models.test.ts
  • services/auto-routing-benchmark/src/platform-models.ts
Previous Review Summary (commit 98fc417)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 98fc417)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The auto-routing/benchmark refactor is internally consistent and well-tested; the one concern is an unbounded catalog fetch newly added to the scheduled queue-drain path.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
services/auto-routing-benchmark/src/platform-models.ts 47 New catalog fetch has no timeout and now runs inside the sequential drainQueue('platform') path, delaying the user-queue drain too
Files Reviewed (30 files)
  • apps/web/src/app/admin/api/auto-routing/benchmark-config/route.test.ts
  • apps/web/src/app/admin/auto-routing/BenchmarksSection.test.ts
  • apps/web/src/app/admin/auto-routing/BenchmarksSection.tsx
  • apps/web/src/components/shared/model-combobox-options.ts
  • docs/adr/0002-auto-routing-efficient.md
  • packages/auto-routing-contracts/src/benchmark.ts
  • packages/auto-routing-contracts/src/contracts.test.ts
  • packages/auto-routing-contracts/src/index.ts
  • packages/auto-routing-contracts/src/reasoning-variants.ts
  • packages/web-shared/src/lib/ai-gateway/auto-routing-benchmark-admin-client.test.ts
  • services/auto-routing-benchmark/README.md
  • services/auto-routing-benchmark/src/admin.test.ts
  • services/auto-routing-benchmark/src/admin.ts
  • services/auto-routing-benchmark/src/auto-decider-sync.test.ts
  • services/auto-routing-benchmark/src/auto-decider-sync.ts
  • services/auto-routing-benchmark/src/config.test.ts
  • services/auto-routing-benchmark/src/config.ts
  • services/auto-routing-benchmark/src/db-schema.ts
  • services/auto-routing-benchmark/src/db.test.ts
  • services/auto-routing-benchmark/src/db.ts
  • services/auto-routing-benchmark/src/platform-models.test.ts
  • services/auto-routing-benchmark/src/platform-models.ts - 1 issue
  • services/auto-routing-benchmark/src/profile-runs.test.ts
  • services/auto-routing-benchmark/src/reasoning-effort.ts
  • services/auto-routing-benchmark/src/routing-table-builder.test.ts
  • services/auto-routing-benchmark/src/routing-table-builder.ts
  • services/auto-routing-benchmark/src/run-process-job.test.ts
  • services/auto-routing-benchmark/src/run.ts
  • services/auto-routing/src/decide.ts
  • services/auto-routing/src/index.test.ts

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 36.6K · Output: 4.8K · Cached: 215K

Review guidance: REVIEW.md from base branch main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants