perf(review): cap vision request context to bound KV cache under load - #4369
Conversation
The self-host Ollama concurrency tuning (#4327/#4352) sized VRAM headroom assuming a bounded per-request context; vision calls had no num_ctx cap, so under concurrent load a large context is the real OOM/thrashing risk on a shared embed+vision GPU. Adds a generic providerOptions passthrough on the OpenAI-compatible chat path (Ollama-specific request extension, ignored by every other provider) and sets num_ctx: 4096 on the self-host visual-vision call.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-09 04:50:39 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4369 +/- ##
=======================================
Coverage 93.95% 93.95%
=======================================
Files 399 399
Lines 36796 36797 +1
Branches 13443 13444 +1
=======================================
+ Hits 34571 34572 +1
Misses 1569 1569
Partials 656 656
🚀 New features to boost your workflow:
|
Summary
num_ctxcap, so under concurrent load a large context is the actual OOM/thrashing risk on a shared embed+vision GPU (per the concurrency research: "the real danger is pushing the VLM to higher parallelism with uncapped context").providerOptionspassthrough oncreateOpenAiCompatibleAi's chat path (an Ollama-specific request extension field, silently ignored by every other provider — embeddings, subscription CLIs, Anthropic) and setsnum_ctx: 4096on the self-host visual-vision call.fullPage: true, so image height can far exceed the 1440px viewport width) is scoped separately — it needs a real image-processing dependency + Dockerfile/esbuild change since this self-host build bundles everything with zeronode_modulesat runtime today, filed as its own follow-up rather than bundled into this smaller, zero-dependency fix.Part of #4325.
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run typechecknpm run test:coveragelocally — newproviderOptionspassthrough branches (present/absent) covered intest/unit/selfhost-ai.test.ts; the vision call site'snum_ctxvalue asserted intest/unit/visual-vision-wiring.test.tsnpm audit --audit-level=moderate— 0 vulnerabilitiesnpm run test:ci(full unsharded suite) end-to-end — greenSafety
Notes
cf-typegenregeneration needed.