Skip to content

fix(controller): fail task when ActorTemplate creation fails - #472

Merged
itssimrank merged 1 commit into
mainfrom
fix/issue-366-template-creation-failed
Oct 20, 2026
Merged

itssimrank merged 1 commit into
mainfrom
fix/issue-366-template-creation-failed

Conversation

@itssimrank

Copy link
Copy Markdown
Collaborator

When Substrate rejects the per-task ActorTemplate (most commonly because spec.image is referenced by tag instead of digest), the reconciler only logged a warning and fell back to the default template. In a stock deployment that template does not exist, so the task failed later with a misleading "ActorCreationFailed: actor template not found" and the real cause was only visible in the controller log.

Treat the template error as terminal for the reconcile: set Ready=False with reason TemplateCreationFailed and the Substrate error as the message, set phase Failed, and return. Falling back to a template that carries a different image is never what the user asked for.

Also document the digest requirement under Task in docs/manifests.md and add a regression test that reproduces the tag-referenced image case.

Ref: https://github.com/ericcurtin/ax/tree/fix/terminal-template-creation-failure

@google-cla

google-cla Bot commented Oct 14, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the task reconciler to stop and report an error directly when the creation of a custom ActorTemplate fails (for example, due to a tag-only image reference), rather than silently falling back to the default template. It also adds documentation regarding image digest requirements and a unit test to verify this failure behavior. The feedback suggests improving the user-facing error message by using status.Convert(err).Message() instead of err.Error() to strip out gRPC-specific boilerplate.

Comment thread internal/controller/reconciler.go Resolved
@itssimrank
itssimrank force-pushed the fix/issue-366-template-creation-failed branch from 069bfa6 to 0ed1dd7 Compare October 14, 2026 19:01
@itssimrank

Copy link
Copy Markdown
Collaborator Author

/ok-to-test

@itssimrank
itssimrank requested a review from mayawang October 14, 2026 19:35
@mayawang

Copy link
Copy Markdown
Collaborator

Thanks @itssimrank, this is exactly what #468 asks for, and the digest note in the docs is really helpful. Two things: it needs a rebase (a test conflict with main after #457 and #464), and once #463 lands, could the template error check substrate.IsTransientError first? A template call that runs out of Unavailable retries should leave the task Pending, not Failed.

Comment thread internal/controller/reconciler_test.go Outdated
resumeActorErr error
crashedActor string
revertedActors []string
// createTemplateErr, when set, is returned by CreateActorTemplate to simulate

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: redundant comment, this is idiomatic mock structure in golang

Comment thread internal/controller/reconciler_test.go Outdated
// by tag rather than digest), the task must report that error directly instead of
// silently falling back to the default template.
func TestTaskReconciler_TemplateCreationFailed(t *testing.T) {
ctx := context.Background()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t.Context()

@mayawang mayawang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @itssimrank. Approving.

@itssimrank
itssimrank force-pushed the fix/issue-366-template-creation-failed branch from c8e73b6 to 341cc53 Compare October 20, 2026 17:04
Template creation errors were logged and the reconciler fell back to the
default template, which hid the real cause behind a misleading
"ActorCreationFailed: actor template not found".

Make the error terminal: Ready=False with reason TemplateCreationFailed
and the bare Substrate message, phase Failed, return. Transient errors
(substrate.IsTransientError) leave the task Pending instead, matching the
other Substrate call sites. Document the image digest requirement and add
regression tests for both paths.

Fixes #366
@itssimrank
itssimrank force-pushed the fix/issue-366-template-creation-failed branch from 341cc53 to 987a8fa Compare October 20, 2026 17:35
@itssimrank
itssimrank merged commit 7b3347f into main Oct 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants