Skip to content

OLS-3743 Wire Agent.spec.timeouts to HTTP client and sandbox requests - #438

Open
vimalk78 wants to merge 1 commit into
openshift:mainfrom
vimalk78:OLS-3743-timeout-wiring
Open

OLS-3743 Wire Agent.spec.timeouts to HTTP client and sandbox requests#438
vimalk78 wants to merge 1 commit into
openshift:mainfrom
vimalk78:OLS-3743-timeout-wiring

Conversation

@vimalk78

@vimalk78 vimalk78 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Wire Agent.spec.timeouts (analysisSeconds, executionSeconds, verificationSeconds) through to the HTTP client timeout and the timeout_ms field in the sandbox request body
  • Previously the HTTP client used a hardcoded 5-minute timeout and timeout_ms was never sent, so configured timeouts were silently ignored
  • Add timeoutForStep helper that reads the per-step timeout from the Agent CR and falls back to the 5-minute default when unset
  • HTTP client gets a 15s grace period beyond timeout_ms so the sandbox can return a structured timeout response instead of being cut off by a transport error

Test plan

  • Unit tests: timeoutForStep returns correct duration per step, defaults for nil/unset agent
  • Unit tests: timeout_ms propagated in request body, omitted when nil
  • Unit tests: end-to-end callWithSandbox threads Agent CR timeout to both HTTP client and request body
  • Unit tests: HTTP client timeout = stepTimeout + 15s grace period
  • Cluster test: analysisSeconds: 9 with a slow mock agent → sandbox returns structured "Agent timed out after 9000ms" instead of raw transport error
  • make test, make fmt, make vet pass

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added configurable timeouts for agent requests.
    • Timeouts can be set independently for analysis, execution, and verification steps.
    • Configured timeout values are passed to the agent service.
    • Requests use a five-minute default when no valid step-specific timeout is available.
  • Bug Fixes

    • Improved handling of missing, unavailable, or invalid timeout settings.

Walkthrough

Changes

Timeout propagation

Layer / File(s) Summary
HTTP client timeout API
controller/agenticrun/client.go, controller/agenticrun/client_test.go
The client accepts configurable timeouts, sends optional timeout_ms values, and defaults non-positive client timeouts to five minutes. Tests cover propagation and omission.
Sandbox step timeout wiring
controller/agenticrun/sandbox_agent.go, controller/agenticrun/*_test.go
Sandbox calls select analysis, execution, or verification timeouts, apply the five-minute default when needed, and pass values to client creation and requests.

Sequence Diagram(s)

sequenceDiagram
  participant SandboxAgentCaller
  participant AgentConfiguration
  participant AgentHTTPClient
  participant AgentEndpoint
  SandboxAgentCaller->>AgentConfiguration: Read step timeout
  AgentConfiguration-->>SandboxAgentCaller: Return configured or default timeout
  SandboxAgentCaller->>AgentHTTPClient: Create client with timeout
  SandboxAgentCaller->>AgentHTTPClient: Run with timeoutMs
  AgentHTTPClient->>AgentEndpoint: Send timeout_ms
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies wiring per-step Agent timeouts to the HTTP client and sandbox requests, which is the main change.
Description check ✅ Passed The description directly explains the timeout wiring, fallback behavior, grace period, and tests for the changeset.

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign joaofula for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

The Agent CRD's per-step timeout fields (analysisSeconds,
executionSeconds, verificationSeconds) were defined but never read by
the controller. The HTTP client used a hardcoded 5-minute timeout and
the sandbox received no timeout_ms in the request body.

Thread the per-step timeout from Agent.Spec.Timeouts through
callWithSandbox to both NewAgentHTTPClient (sets http.Client.Timeout)
and the request body (sets timeout_ms so the sandbox can gracefully
wind down). Fall back to the existing 5-minute default when the Agent
CR has no timeout configured for the step.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Vimal Kumar <vimal78@gmail.com>
@vimalk78
vimalk78 force-pushed the OLS-3743-timeout-wiring branch from d2aa1af to 619af28 Compare August 11, 2026 10:08
@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown

@vimalk78: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 12, 2026
@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant