Skip to content

perf(intelligent-assistant): make GET /v1/models non-blocking - #4839

Open
JslYoon wants to merge 2 commits into
redhat-developer:mainfrom
JslYoon:perf-models-vision-probe-background
Open

JslYoon wants to merge 2 commits into
redhat-developer:mainfrom
JslYoon:perf-models-vision-probe-background

Conversation

@JslYoon

@JslYoon JslYoon commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

GET /v1/models probed each LLM's vision capability inline, awaiting up to VISION_PROBE_TIMEOUT_MS (10s) per model. On a cold cache this delayed the response by up to ~10s.

This change serves vision support from the capabilities cache and moves probing off the request path:

  • Warm at startup — on router load, the model list is fetched and every un-cached LLM is probed in the background, so the first real request is already enriched.
  • Non-blocking on miss — a request never awaits a probe. A cache hit returns the real value; a miss returns the conservative default (supportsVision: false) immediately and triggers a single background probe (deduped per model via an in-flight set).
  • Self-healing — because only cache misses are probed, the cache re-probes models that are new to the LCS list or whose previous probe failed and was not cached, while leaving known models untouched.

The per-user POST /v1/validate-model-vision path is unchanged (it still awaits, since it needs the answer).

Behavior change

On a cold cache, an LLM may report supportsVision: false for the brief window between the first request and the background probe completing; the next request reports the real value.

Testing

  • Updated the supportsVision enrichment suite for the non-blocking + warm-on-boot contract; added coverage for startup warm-up and lazy self-heal when the LCS list changes.
  • yarn backstage-cli package test — 335/335 pass.
  • yarn tsc:full — clean.
  • Verified live against a running backend + Lightspeed service: /v1/models returns in ~50ms (was up to 10s), fully enriched.

🤖 Generated with Claude Code

@rhdh-gh-app

rhdh-gh-app Bot commented Sep 17, 2026

Copy link
Copy Markdown

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-intelligent-assistant-backend workspaces/intelligent-assistant/plugins/intelligent-assistant-backend patch v5.2.0

The /v1/models handler probed each LLM's vision support inline, awaiting
up to VISION_PROBE_TIMEOUT_MS per model, so a cold cache could delay the
response by ~10s. Serve vision support from the capabilities cache
instead: warm the cache at router startup and probe cache misses in the
background (deduped per model), returning the model list immediately. The
cache self-heals on a miss — a model new to the LCS list, or one whose
previous probe failed and was not cached.

Signed-off-by: Lucas <[email protected]>
Assisted-by: Claude Opus 4.8
Co-Authored-By: Claude Opus 4.8 <[email protected]>
@JslYoon
JslYoon force-pushed the perf-models-vision-probe-background branch from 2a148c1 to c737658 Compare September 17, 2026 03:39
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.14%. Comparing base (ef6ab36) to head (741535b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4839      +/-   ##
==========================================
- Coverage   63.60%   60.14%   -3.46%     
==========================================
  Files        2685     2673      -12     
  Lines      107077   106101     -976     
  Branches    30010    29801     -209     
==========================================
- Hits        68101    63819    -4282     
- Misses      37165    41772    +4607     
+ Partials     1811      510    -1301     
Flag Coverage Δ *Carryforward flag
adoption-insights 84.77% <ø> (ø) Carriedforward from c737658
ai-integrations 79.83% <ø> (-2.81%) ⬇️ Carriedforward from c737658
app-defaults 54.82% <ø> (ø) Carriedforward from c737658
augment 46.67% <ø> (ø) Carriedforward from c737658
boost 84.97% <ø> (ø) Carriedforward from c737658
bulk-import 73.12% <ø> (ø) Carriedforward from c737658
cost-management 13.53% <ø> (ø) Carriedforward from c737658
dcm 73.47% <ø> (ø) Carriedforward from c737658
e2e-adoption-insights 60.00% <ø> (ø) Carriedforward from c737658
e2e-extensions 62.31% <ø> (ø) Carriedforward from c737658
e2e-global-header 51.82% <ø> (ø) Carriedforward from c737658
e2e-homepage 61.11% <ø> (ø) Carriedforward from c737658
e2e-intelligent-assistant 46.01% <ø> (ø) Carriedforward from c737658
e2e-orchestrator 49.49% <ø> (ø) Carriedforward from c737658
e2e-orchestrator-plugin 49.48% <ø> (ø) Carriedforward from c737658
e2e-quickstart 55.21% <ø> (ø) Carriedforward from c737658
e2e-scorecard 50.00% <ø> (ø) Carriedforward from c737658
e2e-theme 16.36% <ø> (ø) Carriedforward from c737658
extensions 58.30% <ø> (ø) Carriedforward from c737658
global-floating-action-button 71.18% <ø> (ø) Carriedforward from c737658
global-header 67.76% <ø> (ø) Carriedforward from c737658
homepage 48.49% <ø> (-6.68%) ⬇️ Carriedforward from c737658
install-dynamic-plugins 71.77% <ø> (ø) Carriedforward from c737658
intelligent-assistant 78.07% <94.44%> (+0.03%) ⬆️
konflux 91.98% <ø> (ø) Carriedforward from c737658
lightspeed 69.02% <ø> (ø) Carriedforward from c737658
mcp-integrations 84.46% <ø> (ø) Carriedforward from c737658
orchestrator 77.32% <ø> (-0.37%) ⬇️ Carriedforward from c737658
quickstart 63.74% <ø> (ø) Carriedforward from c737658
sandbox 79.56% <ø> (ø) Carriedforward from c737658
scorecard 88.40% <ø> (-0.31%) ⬇️ Carriedforward from c737658
theme 87.91% <ø> (-0.03%) ⬇️ Carriedforward from c737658
translations 5.12% <ø> (ø) Carriedforward from c737658
x2a 13.86% <ø> (-64.58%) ⬇️ Carriedforward from c737658

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef6ab36...741535b. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant