OLS-3435: add writable home volume for agent container#268
Conversation
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
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Warning Review limit reached
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis 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. ChangesHome volume mount addition
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
🧹 Nitpick comments (2)
controller/proposal/podspec_builder.go (2)
64-67: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winConsider a
SizeLimiton the new emptyDir.The
homeemptyDir 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 winSet
ReadOnlyRootFilesystem: trueif the pod is meant to be read-only.controller/proposal/podspec_builder.gostill leaves the container root filesystem writable; the new/home/agentemptyDironly fixes that mount point. If the hardening goal is a read-only rootfs, set it here (and incontroller/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
📒 Files selected for processing (3)
controller/proposal/podspec_builder.gocontroller/sandbox/bootstrap.gotest/agent/sandboxtemplate/sandboxtemplate.yaml
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift/lightspeed-agentic-sandbox(manual)
|
@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. DetailsIn response to this:
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
|
@tremes: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
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