Repository navigation
Conversation
Add an api.kagent.dev/v1alpha3 ScheduledRun resource so schedules can be configured in YAML like Agents and Harnesses. A controller-runtime reconciler persists each resource into the existing scheduled_run table under a synthetic creator (scheduledrun.api.kagent.dev/<ns>/<name>) keyed by object UID; the existing Scheduler and execution Controller run it. - Admission validates five-field cron, prompt, timeout bounds; agentRef is immutable so reserved executions cannot be redirected. - Status reports Accepted, ResolvedRefs, and Ready conditions. - A finalizer retires the row on deletion, including deletions that happen while the controller is down. - Store gains ApplyScheduledRun and RetireScheduledRuns; recreated objects tombstone the previous row and keep its execution history. - Helm RBAC, admission, store, reconciler, and e2e tests, and docs. Signed-off-by: acherifi <ali.cherifi@homagames.com>
Signed-off-by: acherifi <ali.cherifi@homagames.com>
moezdil
reviewed
Oct 16, 2026
| // The last accepted schedule, if any, keeps running: deletion is final per | ||
| // request, so an invalid edit must not retire the row. | ||
| condition(v1alpha3.ScheduledRunConditionAccepted, metav1.ConditionFalse, "InvalidSchedule", err.Error()) | ||
| condition(v1alpha3.ScheduledRunConditionReady, metav1.ConditionFalse, "NotAccepted", "The schedule was not accepted") |
Contributor
There was a problem hiding this comment.
ready=false here, but the old schedule keeps firing
moezdil
reviewed
Oct 16, 2026
| // TestScheduledRunResource declares a schedule in Kubernetes and verifies the | ||
| // controller persists it under the resource's own creator, runs it, follows | ||
| // edits, and retires it on deletion. | ||
| func TestScheduledRunResource(t *testing.T) { |
Contributor
There was a problem hiding this comment.
has this e2e test run anywhere yet?
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
Scheduled runs could only be created through the gRPC
ScheduledRunService. This adds anapi.kagent.dev/v1alpha3ScheduledRunresource so they can be configured in YAML, following the same pattern asAgentandHarness.A reconciler persists each resource into the existing
scheduled_runtable. The existing Scheduler and execution Controller run it unchanged.Design
scheduledrun.api.kagent.dev/<namespace>/<name>and keyed by object UID. The creator-scoped gRPC API never shows declared schedules to human principals.Accepted(spec valid),ResolvedRefs(Agent exists; a missing Agent does not block persistence, matching gRPC updates),Ready(persisted for the current generation).agentRefis immutable: reserved executions resolve the schedule's Agent when their session is reserved, so an in-place change could send an earlier prompt to another Agent. It is enforced by CEL and by the store, the same as gRPC, where the Agent is fixed at creation.kagent.dev/scheduledrun-retirementfinalizer retires the row, including deletions while the controller is down. Recreating an object starts a new schedule identity; history is retained.Changes
go/api/scheduledrun:KubernetesCreator,Validate,RequestHash(the service now uses the shared hash).ApplyScheduledRun,RetireScheduledRuns; Create/Delete reuse the shared insert and tombstone helpers.go/core/internal/controller/scheduledrun, wired inapp.go.scheduledruns,/status,/finalizers.docs/architecture/configuration-and-compilation.md.Testing
TestInlineSQLPreparespasses.agentRefimmutability.helm unittestrbac suite,golangci-lint,kube-api-linter: clean.TestScheduledRunResourceis not yet run; it needs a cluster.TestSessionExpirationRechecksActivityfails intermittently on unmodifiedmainas well; unrelated to this change.