Skip to content

feat: set generous request timeouts on LLMModel gateway routes - #168

Merged
jbouder merged 1 commit into
mainfrom
increase-route-timeouts
Aug 17, 2026
Merged

feat: set generous request timeouts on LLMModel gateway routes#168
jbouder merged 1 commit into
mainfrom
increase-route-timeouts

Conversation

@jbouder

@jbouder jbouder commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The ai-gateway controller translates each model's AIGatewayRoutes into HTTPRoutes with a default request: 60s timeout, and the operator never overrode it for LLMModels (it sets 120s for passthrough models only). CPU inference and long/thinking generations easily exceed 60s — streams die mid-token and clients see "The agent could not complete the model request". The only workaround was live-patching each model's AIGatewayRoutes with kubectl patch, which the next reconcile or resource recreation undid.

Changes

  • New CRD field: spec.endpoints.requestTimeout on LLMModel — a Gateway API duration string (pattern-validated, e.g. 600s, 10m) defaulting to 600s. Applies to both the external and internal endpoint.
  • Route builder: BuildRoutingResources resolves the timeout (falling back to a DefaultRequestTimeout = "600s" constant for CRs stored before the default existed) and stamps timeouts: {request: <value>} onto the rule of both generated AIGatewayRoutes.
  • Manifests: regenerated the CRD (make generate manifests) and synced the chart copy at charts/nebari-llm-serving/crds/llmmodel-crd.yaml.
  • Docs: added the field to the spec.endpoints table in configuration.mdx.
  • Tests: default-applied and explicit-override cases in routing_test.go, plus a ruleRequestTimeout helper.

Why no migration is needed

The reconciler's createOrUpdateUnstructured does a full spec Update against existing AIGatewayRoutes, so deploying the new operator re-reconciles every LLMModel and pushes the timeout onto existing routes — and re-asserts it if anything strips it later, which the manual patch couldn't do.

Passthrough routes keep their existing hardcoded 120s; the reported failure is specific to locally served (CPU-inference) models. The same field can be extended there later if parity is wanted.

Testing

  • go build ./...
  • go test ./internal/controller/... — all pass
  • make lint (golangci-lint) — 0 issues

🤖 Generated with Claude Code

The ai-gateway controller renders each AIGatewayRoute into an HTTPRoute
with a default request timeout of 60s, and the operator never overrode
it for LLMModels (only passthrough routes got 120s). CPU inference and
long/thinking generations easily exceed 60s, so streams died mid-token
and clients saw failed model requests. The only workaround was live-
patching each model's AIGatewayRoutes, which reconciliation undid.

Expose spec.endpoints.requestTimeout on the LLMModel CRD (Gateway API
duration string, default 600s) and stamp it onto the rule of both
generated routes. The reconciler's full-spec Update pushes the timeout
onto existing AIGatewayRoutes on the next reconcile, so no manual
patching or resource recreation is needed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📄 Docs preview for increase-route-timeouts:
https://increase-route-timeouts.llm-serving-pack.pages.dev

@jbouder
jbouder requested a review from dcmcand August 14, 2026 23:40
@jbouder
jbouder merged commit 4cfb58c into main Aug 17, 2026
13 checks passed
@jbouder
jbouder deleted the increase-route-timeouts branch August 17, 2026 18:23
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