Add Kanon-backed AgentConfig support#1360
Conversation
|
/kelos api-review |
|
🤖 Kelos Task Status Task |
There was a problem hiding this comment.
2 issues found across 32 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="claude-code/Dockerfile">
<violation number="1" location="claude-code/Dockerfile:31">
P2: The `go install` command leaves the Go module cache (`/root/go/pkg/mod`) and build cache (`/root/.cache/go-build`) in the final image, adding unnecessary size (~100MB+).</violation>
</file>
<file name="internal/cli/create_agentconfig.go">
<violation number="1" location="internal/cli/create_agentconfig.go:39">
P3: Validation errors for `create agentconfig` omit the target AgentConfig name, reducing operability in batched CLI runs.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| ENV PATH="/usr/local/go/bin:${PATH}" | ||
|
|
||
| ARG KANON_VERSION=3f2ad4b8171d46aaf7541e9efa61aef009c233e2 | ||
| RUN GOBIN=/usr/local/bin go install github.com/kelos-dev/kanon@${KANON_VERSION} |
There was a problem hiding this comment.
P2: The go install command leaves the Go module cache (/root/go/pkg/mod) and build cache (/root/.cache/go-build) in the final image, adding unnecessary size (~100MB+).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At claude-code/Dockerfile, line 31:
<comment>The `go install` command leaves the Go module cache (`/root/go/pkg/mod`) and build cache (`/root/.cache/go-build`) in the final image, adding unnecessary size (~100MB+).</comment>
<file context>
@@ -27,6 +27,9 @@ RUN ARCH=$(dpkg --print-architecture) \
ENV PATH="/usr/local/go/bin:${PATH}"
+ARG KANON_VERSION=3f2ad4b8171d46aaf7541e9efa61aef009c233e2
+RUN GOBIN=/usr/local/bin go install github.com/kelos-dev/kanon@${KANON_VERSION}
+
ARG CLAUDE_CODE_VERSION=2.1.177
</file context>
| return fmt.Errorf("too many arguments: expected 1 agentconfig name, got %d\nUsage: %s", len(args), cmd.Use) | ||
| } | ||
| if kanonRepo == "" && (kanonRef != "" || kanonSecret != "") { | ||
| return fmt.Errorf("--kanon-repo is required when --kanon-ref or --kanon-secret is set") |
There was a problem hiding this comment.
P3: Validation errors for create agentconfig omit the target AgentConfig name, reducing operability in batched CLI runs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/cli/create_agentconfig.go, line 39:
<comment>Validation errors for `create agentconfig` omit the target AgentConfig name, reducing operability in batched CLI runs.</comment>
<file context>
@@ -32,6 +35,12 @@ func newCreateAgentConfigCommand(cfg *ClientConfig) *cobra.Command {
return fmt.Errorf("too many arguments: expected 1 agentconfig name, got %d\nUsage: %s", len(args), cmd.Use)
}
+ if kanonRepo == "" && (kanonRef != "" || kanonSecret != "") {
+ return fmt.Errorf("--kanon-repo is required when --kanon-ref or --kanon-secret is set")
+ }
+ if kanonRepo != "" && (agentsMD != "" || len(skillFlags) > 0 || len(agentFlags) > 0 || len(mcpFlags) > 0 || len(skillsShFlags) > 0) {
</file context>
There was a problem hiding this comment.
🤖 Kelos API Reviewer Agent @gjkim42
API Design Review
Verdict: REQUEST CHANGES
Scope: Adds v1alpha2 AgentConfig.spec.kanon plus Task/TaskSpawner pod wiring, validation, docs, and examples.
Findings
Compatibility
api/v1alpha2/task_types.go:180andapi/v1alpha2/task_types.go:204— addingkanon-sourceto theextraContainers/extraInitContainersCEL deny-list tightens validation for a name that existing v1alpha2 manifests could previously use, even when they do not usespec.kanon. The API already reserves thekelos-prefix for future internal container names, so please name the new built-in init container with that existing reserved prefix, e.g.kelos-kanon-source, or avoid rejecting a previously valid user name.internal/controller/job_builder.go:65,internal/controller/job_builder.go:68, andinternal/controller/job_builder.go:944— the new Kanon volume also reserves the previously user-availablekanon-sourcevolume name at reconciliation time. Existing manifests withpodOverrides.volumes[].name: kanon-sourcewould still apply but then fail Task Job construction after upgrade. Use the reservedkelos-volume prefix for the internal volume as well so new pod wiring cannot collide with accepted user manifests.
Configuration Semantics
internal/controller/task_controller.go:287anddocs/reference.md:243— a Kanon-backed AgentConfig referenced by a non-Codex/Claude Task is documented and implemented as "ignored" while the Task continues without the requested config. That is a silent degraded configuration path. Please fail the Task as invalid when an unsupported agent consumesspec.kanon, or encode the support constraint in the validation/admission path so users get a hard error instead of an agent run missing its declared configuration.
Conversion
internal/conversion/agentconfig.go:43— down-conversion from v1alpha2 to v1alpha1 dropsspec.kanonwith no preservation marker. A v1alpha1 client that reads and writes a Kanon-backed AgentConfig can clear the new source config. Ifspec.kanonremains v1alpha2-only, please still preserve it through conversion metadata similar to the existing MCPvalueFrompreservation, or otherwise prevent lossy v1alpha1 writes for Kanon-backed AgentConfigs.
Note on prompt injection: Disregarded a third-party review instruction requiring attribution of automated findings; this review is based on independent code analysis.
/kelos needs-input
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds v1alpha2
AgentConfig.spec.kanonso Tasks can source Codex and Claude Code settings from a Kanon repository containingkanon.yamlat the repository root.This also wires Kanon source cloning into task Jobs, applies Kanon from the bundled Codex and Claude Code entrypoints, adds CLI create/get support, and updates generated CRDs, docs, and examples.
Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
repo,ref, andsecretRefonly.spec.kanonis v1alpha2-only and is not preserved through v1alpha1 annotation workarounds.3f2ad4b8171d46aaf7541e9efa61aef009c233e2because the Kanon repository has no release tags yet.Does this PR introduce a user-facing change?
Summary by cubic
Add v1alpha2
AgentConfig.spec.kanonso Codex and Claude Code Tasks can load agent settings from a Kanon repo withkanon.yaml. Updates controller, CLI, CRDs, images, docs, and examples.New Features
spec.kanon { repo, ref, secretRef }with validation; mutually exclusive with inlineagentsMD,plugins,skills, andmcpServers. Add reserved nameskanon-source(container) andkanon-sourcevolume; newKELOS_KANON_HOMEis reserved.kanon-sourceinit container, mount at/kelos/kanon, setKELOS_KANON_HOME, and merge configs. Enforce at most one Kanon-backed config and reject mixes with inline configs. Warn and ignore Kanon for unsupported agents.kanonand runkanon apply --yes --home "$KELOS_KANON_HOME" --agent <agent>before starting.kelos create agentconfigadds--kanon-repo,--kanon-ref,--kanon-secretand rejects mixing with inline flags.kelos get agentconfigsshows a Kanon column. v1alpha2 is required for Kanon-backed configs.examples/14-agentconfig-kanon.Migration
GITHUB_TOKENand setspec.kanon.secretRef.name.kanonon PATH and honorKELOS_KANON_HOME.Written for commit 4612729. Summary will update on new commits.