Skip to content

OLS-3589: Wire LIGHTSPEED_REASONING_CONFIG env var to sandbox pod - #339

Merged
onmete merged 1 commit into
openshift:mainfrom
onmete:OLS-3589-wire-reasoning-config-env
Jul 17, 2026
Merged

OLS-3589: Wire LIGHTSPEED_REASONING_CONFIG env var to sandbox pod#339
onmete merged 1 commit into
openshift:mainfrom
onmete:OLS-3589-wire-reasoning-config-env

Conversation

@onmete

@onmete onmete commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Serializes Agent.spec.reasoningConfig as JSON and sets LIGHTSPEED_REASONING_CONFIG env var on the sandbox container
  • Covers both bare-pod mode (PodSpecBuilder) and sandbox-claim mode (EnsureAgentTemplate)
  • Includes reasoning config in template content hash for proper cache invalidation
  • When reasoningConfig is absent, the env var is omitted entirely

Implements OLS-3589. Part of the reasoning effort epic OLS-3587.

Spec: sandbox-execution.md rule 16a (merged in #332).

Depends on: OLS-3588 (#335, merged)

Test plan

  • make test passes (all unit tests)
  • TestPodSpecBuilder_ReasoningConfig_Present — env var set with correct JSON
  • TestPodSpecBuilder_ReasoningConfig_Absent — env var omitted
  • TestComputeTemplateHash_DifferentReasoningConfig — hash changes when config differs
  • E2E: Agent CR with reasoningConfig → pod has LIGHTSPEED_REASONING_CONFIG env var
  • E2E: Agent CR without reasoningConfig → pod does not have the env var

Made with Cursor

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 16, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 16, 2026

Copy link
Copy Markdown

@onmete: This pull request references OLS-3589 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Serializes Agent.spec.reasoningConfig as JSON and sets LIGHTSPEED_REASONING_CONFIG env var on the sandbox container
  • Covers both bare-pod mode (PodSpecBuilder) and sandbox-claim mode (EnsureAgentTemplate)
  • Includes reasoning config in template content hash for proper cache invalidation
  • When reasoningConfig is absent, the env var is omitted entirely

Implements OLS-3589. Part of the reasoning effort epic OLS-3587.

Spec: sandbox-execution.md rule 16a (merged in #332).

Depends on: OLS-3588 (#335, merged)

Test plan

  • make test passes (all unit tests)
  • TestPodSpecBuilder_ReasoningConfig_Present — env var set with correct JSON
  • TestPodSpecBuilder_ReasoningConfig_Absent — env var omitted
  • TestComputeTemplateHash_DifferentReasoningConfig — hash changes when config differs
  • E2E: Agent CR with reasoningConfig → pod has LIGHTSPEED_REASONING_CONFIG env var
  • E2E: Agent CR without reasoningConfig → pod does not have the env var

Made with Cursor

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested a review from blublinsky July 16, 2026 08:16
@openshift-ci

openshift-ci Bot commented Jul 16, 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 xrajesh 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

@openshift-ci
openshift-ci Bot requested a review from joshuawilson July 16, 2026 08:16
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f0f3221b-ba1e-4979-ae1c-e8f7e3eb9f62

📥 Commits

Reviewing files that changed from the base of the PR and between 638f390 and 8160f33.

📒 Files selected for processing (5)
  • controller/agenticrun/podspec_builder.go
  • controller/agenticrun/podspec_builder_test.go
  • controller/agenticrun/sandbox_templates.go
  • controller/agenticrun/sandbox_templates_test.go
  • hack/quickstart/examples/openai.yaml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/lightspeed-agentic-sandbox (manual)
🚧 Files skipped from review as they are similar to previous changes (4)
  • controller/agenticrun/podspec_builder.go
  • controller/agenticrun/podspec_builder_test.go
  • controller/agenticrun/sandbox_templates.go
  • controller/agenticrun/sandbox_templates_test.go

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for configuring AI reasoning behavior, including effort and summary settings.
    • Reasoning configuration is now applied to agent workloads and sandbox templates.
    • Updated the OpenAI quickstart example with high-effort, automatic-summary reasoning settings.
  • Bug Fixes

    • Prevented outdated reasoning configuration from persisting when settings are removed.
    • Template revisions now update when reasoning settings change.

Walkthrough

The change serializes AgentSpec.ReasoningConfig into LIGHTSPEED_REASONING_CONFIG for pods and sandbox templates, incorporates it into template hashing, removes stale values, and adds coverage plus a quickstart configuration example.

Changes

Reasoning configuration propagation

Layer / File(s) Summary
Pod environment propagation
controller/agenticrun/podspec_builder.go, controller/agenticrun/podspec_builder_test.go, hack/quickstart/examples/openai.yaml
PodSpecBuilder.Build serializes non-empty reasoning configuration into LIGHTSPEED_REASONING_CONFIG; tests cover present and absent configuration, and the quickstart Agent sets effort and summary.
Sandbox template hashing and environment synchronization
controller/agenticrun/sandbox_templates.go, controller/agenticrun/sandbox_templates_test.go
Sandbox template hashes include serialized reasoning configuration, derived templates set or remove LIGHTSPEED_REASONING_CONFIG, and tests cover hash differences, environment updates, and cleanup of inherited values.

Sequence Diagram(s)

sequenceDiagram
  participant AgentSpec
  participant EnsureAgentTemplate
  participant computeTemplateHash
  participant SandboxTemplate
  participant PodSpecBuilder
  AgentSpec->>EnsureAgentTemplate: ReasoningConfig
  EnsureAgentTemplate->>computeTemplateHash: reasoningConfigJSON
  computeTemplateHash-->>EnsureAgentTemplate: template hash
  EnsureAgentTemplate->>SandboxTemplate: Set or remove LIGHTSPEED_REASONING_CONFIG
  AgentSpec->>PodSpecBuilder: ReasoningConfig
  PodSpecBuilder->>PodSpecBuilder: JSON marshal configuration
  PodSpecBuilder-->>SandboxTemplate: Pod environment includes LIGHTSPEED_REASONING_CONFIG
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the env var wiring change and matches the main change in the PR.
Description check ✅ Passed The description matches the implemented reasoningConfig serialization, env var wiring, hash update, and omission behavior.
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.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@controller/agenticrun/sandbox_templates.go`:
- Around line 246-250: Update the reasoning configuration handling around
setEnvVar so an empty reasoningConfigJSON removes LIGHTSPEED_REASONING_CONFIG
from the derived environment inherited via base.DeepCopy(). Preserve the
existing setEnvVar behavior for non-empty configurations, and add coverage for a
base template that already defines the variable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bb74898f-6960-4206-90da-ce9a7d569be6

📥 Commits

Reviewing files that changed from the base of the PR and between 58a4bf8 and 4b5dff3.

📒 Files selected for processing (4)
  • controller/agenticrun/podspec_builder.go
  • controller/agenticrun/podspec_builder_test.go
  • controller/agenticrun/sandbox_templates.go
  • controller/agenticrun/sandbox_templates_test.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/lightspeed-agentic-sandbox (manual)

Comment thread controller/agenticrun/sandbox_templates.go

@onmete onmete left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OLS-3589 review (adversarial)

Verdict: needs_review — 97/100 (jira mode)

Adherence: 4/4 ACs pass. Wiring matches spec rule 16a for bare-pod and sandbox-claim.

Code quality

  1. should-fix — Sandbox-claim path has no unit test asserting LIGHTSPEED_REASONING_CONFIG is set/omitted on the derived template (only hash churn). A regression that hashes but skips setEnvVar would still pass CI.
  2. nice-to-have — Absent reasoningConfig does not strip an inherited base-template env var (set-only after DeepCopy()). Latent; same pattern as other optional LIGHTSPEED_* vars; no in-repo base sets this.
  3. nice-to-have — Hash test only compares empty vs one JSON string.

Note: GitHub blocks REQUEST_CHANGES on own PRs, so this is posted as COMMENT.

Full write-up: .ols/reviews/OLS-3589.md

Comment thread controller/agenticrun/sandbox_templates.go
Comment thread controller/agenticrun/sandbox_templates_test.go
@onmete
onmete force-pushed the OLS-3589-wire-reasoning-config-env branch from 4b5dff3 to 638f390 Compare July 16, 2026 08:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In @.ols/reviews/OLS-3589.md:
- Line 18: Update the review findings in lines 18, 33, and 44–49 to remove the
stale inherited-environment/Issue 2 defect, since the empty reasoningConfigJSON
path calls removeEnvVar and sandbox_templates_test.go covers base-template
cleanup. Retain only the valid gap concerning missing end-to-end environment
assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: becb1747-e3aa-4572-8838-7bfe3b78ced4

📥 Commits

Reviewing files that changed from the base of the PR and between 4b5dff3 and 638f390.

📒 Files selected for processing (5)
  • .ols/reviews/OLS-3589.md
  • controller/agenticrun/podspec_builder.go
  • controller/agenticrun/podspec_builder_test.go
  • controller/agenticrun/sandbox_templates.go
  • controller/agenticrun/sandbox_templates_test.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/lightspeed-agentic-sandbox (manual)
🚧 Files skipped from review as they are similar to previous changes (3)
  • controller/agenticrun/sandbox_templates.go
  • controller/agenticrun/podspec_builder.go
  • controller/agenticrun/sandbox_templates_test.go

Comment thread .ols/reviews/OLS-3589.md Outdated
Serialize Agent.spec.reasoningConfig as JSON and propagate as
LIGHTSPEED_REASONING_CONFIG env var on the sandbox container.
Covers both bare-pod and sandbox-claim template modes.

When reasoningConfig is absent, the env var is omitted entirely.
Template hash includes the serialized config for proper cache
invalidation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@onmete
onmete force-pushed the OLS-3589-wire-reasoning-config-env branch from 638f390 to 8160f33 Compare July 16, 2026 11:31
@openshift-ci

openshift-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown

@onmete: 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.

@onmete
onmete merged commit 8be7766 into openshift:main Jul 17, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants