Repository navigation
feat: report sandbox enforcement status - #201
Merged
Merged
Conversation
shreyanshjain7174
force-pushed
the
feat/sandbox-enforcement-status
branch
from
September 3, 2026 05:14
e2a96f8 to
b9ae25e
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new Pod-cache label filtering is not reflected in a new sandbox observer test and the controller Pod listing should be tightened to match the cache selector.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds end to end sandbox enforcement reporting for AgentWorkload. It standardizes workload Pod labels so the controller can correlate child Pods and derive SandboxEnforced status from observed RuntimeClassName.
Changes:
- Centralize sandbox and workload correlation labels in
pkg/governance, and propagate them into Argo and non-Argo runtimes. - Add
SandboxEnforcedcondition andSandboxExecutionUID, then update reconciliation to set the condition based on admission denials or observed child PodRuntimeClassName. - Add controller pod-cache filtering and RBAC needed to watch/list Pods efficiently.
File summaries
| File | Description |
|---|---|
| pkg/runtime/labels.go | Switch runtime adapters to shared governance label helper. |
| pkg/runtime/argo_adapter.go | Propagate Argo workflow status message into normalized execution status. |
| pkg/runtime/adapter.go | Extend ExecutionStatus with a runtime status message field. |
| pkg/governance/labels.go | New shared label constants and PodLabels() helper for workload Pods. |
| pkg/governance/labels_test.go | Unit test for shared PodLabels() output. |
| pkg/argo/workflow.go | Stamp shared governance labels onto Argo workflow pod metadata. |
| pkg/argo/workflow_test.go | Assert shared labels are present in Argo workflow pod metadata. |
| internal/controller/sandbox_status.go | New sandbox observer that sets SandboxEnforced condition from admission or Pod observations. |
| internal/controller/sandbox_status_test.go | Unit tests for sandboxCondition() state transitions. |
| internal/controller/sandbox_observer_test.go | Observer integration tests using fake client and Pods. |
| internal/controller/agentworkload_controller.go | Wire sandbox observation into reconcile loop and add reconciler fields. |
| internal/admission/runtimeclass_injector.go | Use shared label constants and add denial prefix detection helper. |
| internal/admission/runtimeclass_injector_test.go | Add tests for IsSandboxDenial(). |
| config/rbac/role.yaml | Grant manager Pod get/list/watch for sandbox observation and caching. |
| config/crd/bases/agentic.clawdlinux.org_agentworkloads.yaml | CRD regen for new status field. |
| cmd/main.go | Configure Pod cache selector, wire sandbox class and event recorder into reconciler. |
| api/v1alpha1/agentworkload_types.go | Add sandbox condition constants and SandboxExecutionUID status field. |
Review details
- Files reviewed: 18/18 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+77
to
+84
| if observation.hasExecution && !admission.IsSandboxDenial(denialMessage) { | ||
| pods := &corev1.PodList{} | ||
| if err := r.List(ctx, pods, client.MatchingLabels{governance.WorkloadUIDLabelKey: string(workload.UID)}); err != nil { | ||
| observation.listErr = err | ||
| } else { | ||
| observation.pods = pods.Items | ||
| } | ||
| } |
Comment on lines
+25
to
+26
| matchingPod := &corev1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "run-1", Namespace: "argo-workflows", Labels: map[string]string{governance.WorkloadUIDLabelKey: "workload-uid"}}, Spec: corev1.PodSpec{RuntimeClassName: &gvisor}} | ||
| otherPod := &corev1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "other", Namespace: "argo-workflows", Labels: map[string]string{governance.WorkloadUIDLabelKey: "other-uid"}}} |
shreyanshjain7174
force-pushed
the
feat/sandbox-enforcement-status
branch
from
September 3, 2026 05:16
b9ae25e to
51a4575
Compare
Signed-off-by: Shreyansh Sancheti <43677304+shreyanshjain7174@users.noreply.github.com>
shreyanshjain7174
force-pushed
the
feat/sandbox-enforcement-status
branch
from
September 3, 2026 08:43
51a4575 to
4f4f266
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
go build ./...make test-gomake linthelm unittest chartshelm lint chartsThe local controller envtest suite remains blocked because the envtest
etcdbinary is absent.