feat(api): add spec.setup to Workspace for pre-agent init containers#87
feat(api): add spec.setup to Workspace for pre-agent init containers#87knechtionscoding merged 3 commits intoprodfrom
Conversation
8759e94 to
53fcd3a
Compare
Greptile SummaryThis PR adds
Confidence Score: 4/5Safe to merge after adding CEL validation rules to guard setup container name uniqueness and reserved names One P1 finding: missing CEL uniqueness and reserved-name validation on the Setup field that is present on the analogous Volumes field — allows inputs that will fail at pod creation with opaque errors. All other findings are P2 style/hardening items. api/v1alpha1/workspace_types.go — needs CEL XValidation markers on the Setup field before merge Important Files Changed
Sequence DiagramsequenceDiagram
participant K as Kubernetes
participant JB as JobBuilder
participant Pod as Job Pod
K->>JB: Build(task, workspace, agentConfig, prompt)
JB->>Pod: initContainer: git-clone
JB->>Pod: initContainer: remote-setup (if remotes)
JB->>Pod: initContainer: branch-setup (if branch)
JB->>Pod: initContainer: workspace-files (if files)
loop workspace.Setup[]
JB->>Pod: initContainer: user setup container
end
JB->>Pod: initContainer: plugin-setup (if plugins)
JB->>Pod: initContainer: skills-install (if skills)
JB->>Pod: container: agent (claude-code / codex / gemini / ...)
Reviews (1): Last reviewed commit: "feat(api): add spec.setup to Workspace f..." | Re-trigger Greptile |
…87) * feat(api): add spec.setup to Workspace for pre-agent init containers * fix: review comments
…87) * feat(api): add spec.setup to Workspace for pre-agent init containers * fix: review comments
…87) * feat(api): add spec.setup to Workspace for pre-agent init containers * fix: review comments
…87) * feat(api): add spec.setup to Workspace for pre-agent init containers * fix: review comments
…87) * feat(api): add spec.setup to Workspace for pre-agent init containers * fix: review comments
…87) * feat(api): add spec.setup to Workspace for pre-agent init containers * fix: review comments
…87) * feat(api): add spec.setup to Workspace for pre-agent init containers * fix: review comments
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds a new optional
spec.setupfield to the Workspace CRD, allowing users torun custom init containers after git clone but before the agent starts.
This enables use cases like:
npm ciorpip installso the agent doesn't burn API credits ondependency installation
Setup containers receive the workspace volume (at
/workspace, workingdirectory set to
/workspace/repo) and any user-definedspec.volumesmounts.They run as the agent UID (61100) for filesystem permission compatibility.
Changes:
api/v1alpha1/workspace_types.go: NewSetupContainerandEnvVartypes,Setupfield onWorkspaceSpecinternal/controller/job_builder.go: Appends setup containers as initcontainers after file injection, before plugin setup
internal/controller/job_builder_test.go: 6 new tests (single, multiple,with volumes, with env vars, ordering with files+plugins, empty backward
compat)
make updateWhich issue(s) this PR is related to:
Part of kelos-dev#774 (second of two PRs — first was kelos-dev#921 adding
spec.volumes)Special notes for your reviewer:
workspace-files → setup containers → plugin-setup → skills-install
SetupContainer.Envuses a simpleEnvVar{Name, Value}type rather thancorev1.EnvVarto keep the CRD surface small and avoid exposingvalueFrom(secret refs, field refs) which would need additional RBACconsideration
Volumesand aPattern="^/"onMountPathfrom review feedback on feat(api): add spec.volumes to Workspace for mounting additional volumes kelos-dev/kelos#921Does this PR introduce a user-facing change?