Skip to content

Let operators set the agent's HTTP read timeouts - #207

Draft
aszarama wants to merge 7 commits into
mainfrom
as/onb-293-configurable-read-timeouts
Draft

aszarama wants to merge 7 commits into
mainfrom
as/onb-293-configurable-read-timeouts

Conversation

@aszarama

@aszarama aszarama commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What

Two environment variables set the agent's read timeouts: WEBHOOK_READ_TIMEOUT and CORTEX_API_PROXY_READ_TIMEOUT. Each takes a Go duration and defaults to 30s.

Before: fixed at 30s (#176). After: an operator can raise one without a new build. The relay reflector setting is gone, because #212 removed the reflector.

Why

Review feedback on #176: 30s can be short for a slow webhook upload or a large Cortex API request body.

How

Review focus: config.go.

  • A bad value stops the agent at startup. A zero field in AgentConfig means 30s.
  • The /cortex-api/ bound covers only the request body. The proxy clears the deadline after the body is read. This fixes a Let the relay reflector wait 30 seconds for a request #176 bug that canceled slow upstream calls.
  • Docs move to README.md, next to "Calling the Cortex API". The relay command has no webhook server.

Verification

  • New tests cover defaults, overrides, bad values, a late body, and a slow upstream.
  • go test ./... in agent/ passes, except TestLoopbackOnlyRefusesOffHostConnection, which fails the same way on main locally.

The deadline was still set when the upstream call ran. For a request without a body, net/http's background read uses it, and when it fires it cancels the request context, so a slow upstream failed. Also correct the read timeout text in README.relay.md and config.go.
…le-read-timeouts

# Conflicts:
#	README.relay.md
#	agent/config/config.go
#	agent/server/snykbroker/reflector.go
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.

1 participant