feat(models): per-endpoint LLM stream timeout override - #5966
Open
ataliba wants to merge 3 commits into
Open
Conversation
agent_stream_timeout_seconds was global-only, so a single slow custom endpoint forced everyone to either eat a low ceiling or raise the timeout account-wide (odysseus-dev#2615). Add model_endpoints.stream_timeout_seconds (nullable, falls back to the global setting), route both stream_agent_loop call sites through a single resolve_stream_timeout() so interactive chat and scheduled tasks pick it up the same way, and expose it on the model-endpoints list/get/PATCH routes (clamped 30-3600s).
_migrate_add_endpoint_stream_timeout used PRAGMA table_info, which is SQLite-only and fails silently on Postgres (caught, logged, column never added). Unlike the pre-existing PRAGMA migrations — which only backfill columns that predate a given Postgres install's initial create_all() — this is a brand-new column that a running Postgres instance never got, so skipping it would leave every model_endpoints query broken (ORM expects a column the table doesn't have). Use SQLAlchemy's inspector instead, which works on both dialects.
stream_timeout_seconds was only reachable via a raw PATCH call. Add a "Timeout" button next to Enable/Disable on each model-endpoint row, using the existing styledPrompt pattern (same as endpoint rename) to set/clear the value (blank = fall back to the account-wide default).
3 tasks
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.
Summary
agent_stream_timeout_secondswas global-only, so a single slow custom/local endpoint forced everyone to either eat a low ceiling for every provider or raise the timeout account-wide. Addsmodel_endpoints.stream_timeout_seconds(nullable, falls back to the global setting), routes bothstream_agent_loopcall sites through a singleresolve_stream_timeout()so interactive chat and scheduled tasks pick it up the same way, and exposes it in the admin "Added Models" panel as a per-endpoint "Timeout" button.Target branch
dev, notmain.Linked Issue
Part of #2615 — covers the "configurable per model" ask for chat/agent. Deep Research still uses its own separate
research_run_timeout_secondssetting and wasn't touched here.Type of Change
Checklist
devuvicorn app:app) and verified the change works end-to-end — local smoke test (create endpoint → PATCHstream_timeout_seconds→ confirmed in list) plus a live production deploy where the button is now in daily use.How to Test
Timeout (Ns); a chat/task routed through that endpoint uses the new value as its LLM stream read-timeout instead of the global default.Visual / UI changes
.admin-btn-smclass, no new component/colors introduced.admin-btn-sm, existingstyledPromptmodal (same one used for endpoint rename), no new CSS.Screenshots / clips