fix: make proxy response_header_timeout configurable#164
Conversation
The Olla engine hardcoded the HTTP transport's ResponseHeaderTimeout to
DefaultResponseHeaderTimeout (30s) with no override. Backends that load models
on demand (e.g. Lemonade) send no response header until the model is resident,
so a cold load exceeding 30s aborts the request with a 502 ("request timeout
after 30.0s ...") even when response_timeout is set far higher -- that governs a
later deadline and never gets a chance to apply.
Add a `response_header_timeout` proxy config key, threaded through to the Olla
transport, defaulting to DefaultResponseHeaderTimeout (30s) so existing
behaviour is unchanged. Operators with on-demand backends can raise it (e.g.
180s) to tolerate cold model loads.
Refs thushan#163
WalkthroughThis PR extends the proxy configuration to make ChangesConfigurable proxy response header timeout
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/content/configuration/reference.md (1)
187-197:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd
response_header_timeoutto the “Complete default configuration” proxy block.This section now documents the field, but the default YAML later in the page still omits it, so the reference is internally inconsistent for copy/paste users.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/content/configuration/reference.md` around lines 187 - 197, The documentation's "Complete default configuration" proxy YAML is missing the response_header_timeout field described earlier; update the proxy block in the "Complete default configuration" section to include response_header_timeout (e.g., set to the documented default `30s`), ensuring the proxy keys (connection_timeout, response_timeout, read_timeout, response_header_timeout) match the earlier example and keep formatting consistent for copy/paste users.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@docs/content/configuration/reference.md`:
- Around line 187-197: The documentation's "Complete default configuration"
proxy YAML is missing the response_header_timeout field described earlier;
update the proxy block in the "Complete default configuration" section to
include response_header_timeout (e.g., set to the documented default `30s`),
ensuring the proxy keys (connection_timeout, response_timeout, read_timeout,
response_header_timeout) match the earlier example and keep formatting
consistent for copy/paste users.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fa5af72d-9b66-4753-87a2-bb48d87585cd
📒 Files selected for processing (10)
docs/content/configuration/reference.mddocs/content/integrations/backend/lemonade.mdinternal/adapter/proxy/config.gointernal/adapter/proxy/config/unified.gointernal/adapter/proxy/factory.gointernal/adapter/proxy/olla/service.gointernal/adapter/proxy/olla/service_transport_test.gointernal/app/config.gointernal/app/services/proxy.gointernal/config/types.go
Resolves #163
Problem
The Olla engine hardcodes the transport's
ResponseHeaderTimeouttoDefaultResponseHeaderTimeout(30s) with no override. Backends that load models on demand (Lemonade especially) send no response header until the model is resident, so a cold load over 30s aborts with a502 "request timeout after 30.0s ..."-- even whenresponse_timeoutis set much higher (that governs a later deadline and never applies).Change
Add a
response_header_timeoutkey underproxy, threaded through to the Olla transport, defaulting toDefaultResponseHeaderTimeout(30s) so existing behaviour is unchanged.config/types.go: newresponse_header_timeoutyaml field.proxy.Configuration+BaseProxyConfig: field +GetResponseHeaderTimeout()(defaults to 30s when unset).factory.go: picked up via the existing olla-specific type-assertion block (noports.ProxyConfigurationinterface change).olla/service.go: transport usesconfig.GetResponseHeaderTimeout()instead of the hardcoded constant.Verification
make readypasses (test-race, fmt, vet, golangci-lint 0 issues, better-align).response_header_timeout: 180s, a cold model load that previously 502'd at 30s now completes.Independent of #161 (the Lemonade model-state fix); they compose but don't depend on each other.
Summary by CodeRabbit
Release Notes
New Features
response_header_timeoutsetting for proxy configurations, enabling users to extend header wait times for backends with extended initialisation periods.Documentation
response_header_timeoutoption.