Repository navigation
fix(controller): fail locally invalid job templates - #634
Open
Bluu (Bluuok) wants to merge 2 commits into
Open
Bluu (Bluuok) wants to merge 2 commits into
Bluu (Bluuok) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Real reconciliation can still contact Kubernetes or hit rate limiting before validating malformed templates.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Fails queued rollouts when local Kubernetes Job template rendering or validation fails.
Changes:
- Separates local manifest validation from Kubernetes submission errors.
- Adds regressions for malformed YAML/Jinja, invalid kinds, and transient cluster errors.
| File | Description |
|---|---|
agentlightning/controller/k8s_reconciler.py |
Marks local manifest failures as terminal. |
tests/controller/test_k8s_invalid_templates.py |
Tests invalid templates and retryable cluster failures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
258
to
260
| try: | ||
| manifest = build_job_spec(rollout, self._config) | ||
| attempt_id = manifest["metadata"]["labels"]["agentlightning/attempt-id"] |
| try: | ||
| manifest = build_job_spec(rollout, self._config) | ||
| attempt_id = manifest["metadata"]["labels"]["agentlightning/attempt-id"] | ||
| except Exception as exc: |
This branch has not been deployed
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.


Malformed YAML or Jinja in a queued rollout's Job template can remain QUEUING indefinitely when cluster initialization, Job listing, or the submission quota prevents local validation from being reached.
Validate all queued manifests before Kubernetes initialization and listing, then reuse each valid manifest during submission. Invalid templates are reported as FAILED through the store; failed status updates are retried on the next reconciliation cycle. Valid jobs retain transient-cluster retry and quota behavior, and RUNNING jobs continue to be observed without re-rendering their templates. Update the
_create_jobdocstring to describe terminal validation failures.Validation on head
2e8e88563718993b3d73dda3504881ea22c2defe, reusing the existing Python 3.12 virtual environments:python -m pytest -q tests/controller -p no:cacheprovider --basetemp .pytest-final-linux- 47 passed.python -m pytest -q tests/controller/test_k8s_invalid_templates.py tests/controller/test_k8s_reconciler.py --basetemp .pytest-final-windows- 24 passed.git diff --checkpassed.The new gate regressions on the prior head produced 14 failures with 7 passing controls. Coverage now exercises
_reconcile_onceunder unavailable API/listing, full quota, mixed invalid/valid/running batches, transient recovery, manifest reuse, and status-update retry. The exploratory Windows full-controller run had 9 failures in unchanged local-process tests becauseos.killpgis unavailable; the complete controller directory passed on Ubuntu.Tests use the real reconciliation loop, YAML/Jinja manifest builder, and status-patching method with simulated store HTTP and Kubernetes access. No real cluster, network, model inference, or GPU training was run. These are actual local checks from this repair pass; whole-repository CI has not run and remains awaiting maintainer approval (action_required, 0 jobs).
AI assistance was used; the production and regression diffs were reviewed, including an independent read-only review.