feat: add parent-child task relationship API and env var injection#1285
Open
knechtionscoding wants to merge 1 commit into
Open
feat: add parent-child task relationship API and env var injection#1285knechtionscoding wants to merge 1 commit into
knechtionscoding wants to merge 1 commit into
Conversation
knechtionscoding
had a problem deploying
to
ok-to-test
June 3, 2026 15:10 — with
GitHub Actions
Error
knechtionscoding
force-pushed
the
feat/parent-child-relationship
branch
from
June 3, 2026 15:47
d01368b to
5a58d36
Compare
knechtionscoding
had a problem deploying
to
ok-to-test
June 3, 2026 15:47 — with
GitHub Actions
Error
knechtionscoding
marked this pull request as ready for review
June 3, 2026 15:53
Contributor
Author
|
@gjkim42 figured I'd give you a second core API change to review over the weekend. We are interested in being able to spawn sub agents, so wanted to put this up and get feedback before I go to deep |
There was a problem hiding this comment.
1 issue found across 9 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
knechtionscoding
commented
Jun 9, 2026
knechtionscoding
left a comment
Contributor
Author
There was a problem hiding this comment.
API Design Review
Verdict: APPROVE
Scope: New spec.parentRef (TaskReference) and status.childTasks ([]ChildTaskStatus) fields for parent-child task relationships; KELOS_TASK_NAME/KELOS_TASK_NAMESPACE env var injection
Findings
API Conventions ✅
TaskReferencefollows the established pattern ofSecretReference,WorkspaceReference, andAgentConfigReference— singleNamefield for same-namespace references.ParentRefis correctly a pointer type with+optionalandomitempty.ChildTasksuses+listType=map/+listMapKey=name(lines 341-342), consistent with other list fields in this file (lines 168-169, 191-192). This ensures correct SSA merge semantics.- Field names are camelCase in both Go and JSON tags. ✅
- No boolean fields with
isX/enableXprefixes. ✅
Compatibility ✅
- All new fields are additive and optional — existing manifests apply without modification.
ParentRefimmutability is correctly covered by the existingself == oldSelfCEL rule onTask.Spec(line 361).- No scalar↔array kind changes, no tightened validation on existing fields.
- No stale manifests in
examples/orself-development/to sweep (new fields are optional; existing YAMLs remain valid). - Generated deepcopy and CRD YAML artifacts are included. ✅
Naming and Documentation ✅
parentRef/TaskReferencefollows thexxxRef/XxxReferencenaming convention established byworkspaceRef,secretRef,agentConfigRef.childTasks(plural list in status) withChildTaskStatusitem type is clear and descriptive.- Godoc comments present on all exported types and fields.
- The
TaskReferencetype name is correct given it references a Task. If other CRDs later need to reference Tasks, this type is reusable.
Validation ✅
TaskReference.Namehas+kubebuilder:validation:MinLength=1— actually better than the existingSecretReferenceandWorkspaceReferencewhich lack this marker.ChildTaskStatus.Nameis in therequiredlist in the generated CRD (appropriate since it's the listMapKey).
Extensibility ✅
TaskReferenceis a struct (not a bare string), allowing future extension with fields likenamespaceif cross-namespace parent references are ever needed.ChildTaskStatusis a struct that can grow additional fields (e.g.,message,startTime, aggregated results per issue #829 Phase 4).- The API surface is minimal — only the fields immediately needed for Phase 1. No speculative additions.
Suggestions (non-blocking)
ChildTaskStatus.NameMinLength: Consider adding+kubebuilder:validation:MinLength=1toChildTaskStatus.Name(api/v1alpha1/task_types.go:296) for consistency withTaskReference.Name. Since this field is controller-managed it won't reject user input, but it documents the invariant and prevents accidental empty keys in the list map.- Stale child entries: The controller currently only adds/updates entries in
status.childTasksbut never removes them when a child Task is deleted. This means a deleted child will persist in the parent's status with its last known phase. For Phase 1 this is acceptable (the data is observational, not prescriptive), but worth noting for a follow-up to garbage-collect entries referencing deleted Tasks.
/kelos needs-input
knechtionscoding
force-pushed
the
feat/parent-child-relationship
branch
from
June 9, 2026 10:17
5a58d36 to
7fc1286
Compare
knechtionscoding
had a problem deploying
to
ok-to-test
June 9, 2026 10:17 — with
GitHub Actions
Error
Adds a priority=1 kubectl print column showing spec.parentRef.name, so `kubectl get tasks -o wide` reveals parent-child relationships. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
knechtionscoding
force-pushed
the
feat/parent-child-relationship
branch
from
June 26, 2026 15:59
7fc1286 to
339a3bd
Compare
knechtionscoding
requested a deployment
to
ok-to-test
June 26, 2026 15:59 — with
GitHub Actions
Waiting
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.
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds the foundational API types and controller logic for parent-child task relationships, enabling agents to dynamically spawn child tasks at runtime (Phase 1 of #829).
Changes:
API additions (
api/v1alpha1/task_types.go):TaskSpec.ParentRef— optional reference to the parent Task that spawned this child (immutable via existing spec-level CEL rule)TaskStatus.ChildTasks— list of child task names and their current phasesTaskReferenceandChildTaskStatussupporting typesEnv var injection (
internal/controller/job_builder.go):KELOS_TASK_NAMEandKELOS_TASK_NAMESPACEare now injected into all agent containers, providing identity context for the upcomingkelos-mcp-serverbinaryController child tracking (
internal/controller/task_controller.go):updateParentChildStatus()— updates parent'sstatus.childTaskswhen a child task's phase changes (with conflict retry for concurrent children)enqueueParentTask()watch — ensures child task phase changes trigger reconciliationTests:
KELOS_TASK_NAME/KELOS_TASK_NAMESPACEupdateParentChildStatushappy path and parent-not-found casesWhich issue(s) this PR is related to:
Partial implementation of #829
Special notes for your reviewer:
ParentRefimmutability is enforced by the existingself == oldSelfCEL validation on the entireTask.Spec— no additional rule needed.enqueueParentTaskwatch enqueues the child itself (not the parent directly) so that the child's reconcile loop handles the parent status update. This avoids needing a field index onspec.parentRef.namefor now.kelos-mcp-serverbinary (PR 2), RBAC auto-creation (PR 3), agent image integration (PR 4).Does this PR introduce a user-facing change?
Summary by cubic
Add parent–child task support so agents can spawn child tasks at runtime and parents track their phases, plus inject task identity env vars into agent containers. Adds a Parent print column to the Task CRD for quick kubectl visibility; Phase 1 of #829.
spec.parentRefto reference a parent task;status.childTasksto list children and their phases; both optional and backward compatible.status.childTaskson child phase changes, removes entries when children are deleted, retries on conflicts, and ignores missing parents.KELOS_TASK_NAMEandKELOS_TASK_NAMESPACEinto all agent containers..spec.parentRef.namein both chart and install manifests.Written for commit 339a3bd. Summary will update on new commits.