Skip to content

OLS-3435: add writable home volume for agent container#268

Open
tremes wants to merge 2 commits into
openshift:mainfrom
tremes:add-emptyDir-volume
Open

OLS-3435: add writable home volume for agent container#268
tremes wants to merge 2 commits into
openshift:mainfrom
tremes:add-emptyDir-volume

Conversation

@tremes

@tremes tremes commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The Claude Code Bash tool requires a writable ~/.claude directory on startup. With readOnlyRootFilesystem: true and no writable volume at /home/agent, executions fail with EACCES when the tool tries to mkdir /home/agent/.claude.

Add an emptyDir volume "home" mounted at /home/agent in the bootstrap SandboxTemplate, bare-pod PodSpecBuilder, and e2e test sandbox template.

Assisted-by: Claude Code:claude-opus-4-6

The Claude Code Bash tool requires a writable ~/.claude directory on
startup. With readOnlyRootFilesystem: true and no writable volume at
/home/agent, executions fail with EACCES when the tool tries to
mkdir /home/agent/.claude.

Add an emptyDir volume "home" mounted at /home/agent in the bootstrap
SandboxTemplate, bare-pod PodSpecBuilder, and e2e test sandbox template.

Signed-off-by: Tomáš Remeš <tremes@redhat.com>
Assisted-by: Claude Code:claude-opus-4-6
@openshift-ci openshift-ci Bot requested review from joshuawilson and xrajesh July 2, 2026 06:38
@openshift-ci

openshift-ci Bot commented Jul 2, 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 joshuawilson 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

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tremes, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dd010832-4159-43a2-8849-f4917fc46ed6

📥 Commits

Reviewing files that changed from the base of the PR and between 058e0bf and 0958f7c.

📒 Files selected for processing (5)
  • controller/proposal/podspec_builder.go
  • controller/proposal/podspec_builder_test.go
  • controller/sandbox/bootstrap.go
  • controller/sandbox/bootstrap_test.go
  • test/agent/sandboxtemplate/sandboxtemplate.yaml
📝 Walkthrough

Walkthrough

This PR adds a new "home" emptyDir volume mounted at /home/agent for agent containers, applied in the PodSpecBuilder, the sandbox bootstrap template generation, and the corresponding test manifest, replacing prior skills-volume-only configuration in bootstrap.go.

Changes

Home volume mount addition

Layer / File(s) Summary
PodSpecBuilder home volume
controller/proposal/podspec_builder.go
Appends a home emptyDir volume and mounts it at /home/agent in the main container.
Sandbox bootstrap template home volume
controller/sandbox/bootstrap.go
Adds a volumeMounts entry for home at /home/agent in the agent container and defines home as emptyDir, replacing the prior skills volume config with an image reference.
Test manifest update
test/agent/sandboxtemplate/sandboxtemplate.yaml
Updates the manifest to mount home at /home/agent and define it as emptyDir, keeping the existing skills volume.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately describes the writable /home/agent volume change across the three affected templates.
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 accurately summarizes the main change: adding a writable home volume for the agent container.

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.

❤️ Share

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.

🧹 Nitpick comments (2)
controller/proposal/podspec_builder.go (2)

64-67: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider a SizeLimit on the new emptyDir.

The home emptyDir has no size bound, so unbounded writes under .claude (cache, session artifacts) could consume node disk. Not critical since it's ephemeral per-pod, but worth capping given this runs untrusted agent workloads.

♻️ Proposed fix
 	volumes = append(volumes, corev1.Volume{
 		Name:         "home",
-		VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}},
+		VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{
+			SizeLimit: resource.NewQuantity(256*1024*1024, resource.BinarySI),
+		}},
 	})
🤖 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 `@controller/proposal/podspec_builder.go` around lines 64 - 67, The new home
emptyDir in podspec_builder.go is currently unbounded and can grow with writes
under .claude. Update the Volume creation in the pod spec builder to set a
SizeLimit on the corev1.EmptyDirVolumeSource for the "home" volume, using a
reasonable cap for this workload. Keep the change localized to the volume setup
in the podspec builder so the home mount remains ephemeral but constrained.

54-72: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Set ReadOnlyRootFilesystem: true if the pod is meant to be read-only. controller/proposal/podspec_builder.go still leaves the container root filesystem writable; the new /home/agent emptyDir only fixes that mount point. If the hardening goal is a read-only rootfs, set it here (and in controller/sandbox/bootstrap.go) so the generated spec matches the stated rationale.

🤖 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 `@controller/proposal/podspec_builder.go` around lines 54 - 72, The hardening
in podspec_builder should also enforce a read-only root filesystem, since the
new /home/agent emptyDir only covers that mount point. Update the container
SecurityContext in podspec_builder's container setup to set
ReadOnlyRootFilesystem to true, and mirror the same change in
controller/sandbox/bootstrap.go so both generated pod specs match the intended
read-only design.
🤖 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.

Nitpick comments:
In `@controller/proposal/podspec_builder.go`:
- Around line 64-67: The new home emptyDir in podspec_builder.go is currently
unbounded and can grow with writes under .claude. Update the Volume creation in
the pod spec builder to set a SizeLimit on the corev1.EmptyDirVolumeSource for
the "home" volume, using a reasonable cap for this workload. Keep the change
localized to the volume setup in the podspec builder so the home mount remains
ephemeral but constrained.
- Around line 54-72: The hardening in podspec_builder should also enforce a
read-only root filesystem, since the new /home/agent emptyDir only covers that
mount point. Update the container SecurityContext in podspec_builder's container
setup to set ReadOnlyRootFilesystem to true, and mirror the same change in
controller/sandbox/bootstrap.go so both generated pod specs match the intended
read-only design.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4f938edc-e1fe-4f55-9e2c-d623d47206ac

📥 Commits

Reviewing files that changed from the base of the PR and between fb09ae2 and 058e0bf.

📒 Files selected for processing (3)
  • controller/proposal/podspec_builder.go
  • controller/sandbox/bootstrap.go
  • test/agent/sandboxtemplate/sandboxtemplate.yaml
🔗 Linked repositories identified

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

  • openshift/lightspeed-agentic-sandbox (manual)

@tremes tremes changed the title fix: add writable home volume for agent container OLS-3435: add writable home volume for agent container Jul 2, 2026
@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 2, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 2, 2026

Copy link
Copy Markdown

@tremes: This pull request references OLS-3435 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 bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

The Claude Code Bash tool requires a writable ~/.claude directory on startup. With readOnlyRootFilesystem: true and no writable volume at /home/agent, executions fail with EACCES when the tool tries to mkdir /home/agent/.claude.

Add an emptyDir volume "home" mounted at /home/agent in the bootstrap SandboxTemplate, bare-pod PodSpecBuilder, and e2e test sandbox template.

Assisted-by: Claude Code:claude-opus-4-6

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.

The OpenAI Agents SDK creates a .agents directory inside the
read-only skills image volume at runtime to stage loaded skills.
Add a skills-workdir emptyDir volume mounted at /app/skills/.agents
so the SDK can write there while keeping skill content read-only.

Covered by new assertions in podspec_builder and bootstrap tests.

Signed-off-by: Tomáš Remeš <tremes@redhat.com>
Assisted-by: Claude Code:claude-opus-4-6
@openshift-ci

openshift-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown

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

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