Skip to content

Fix orphaned golden actors by using deterministic actor IDs in ActorTemplateReconciler - #526

Merged
Zoe Zhao (zoez7) merged 1 commit into
agent-substrate:mainfrom
troychiu:fix-orphaned-golden-actors
Jul 27, 2026
Merged

Fix orphaned golden actors by using deterministic actor IDs in ActorTemplateReconciler#526
Zoe Zhao (zoez7) merged 1 commit into
agent-substrate:mainfrom
troychiu:fix-orphaned-golden-actors

Conversation

@troychiu

Copy link
Copy Markdown
Contributor

This PR fixes an issue where reconciliation retries in PhaseInitial left orphaned actors in ateapi when CreateActor succeeded but status update failed.

Fixes #525

  • Tests pass
  • Appropriate changes to documentation are included in the PR

@troychiu
Troy Chiu (troychiu) force-pushed the fix-orphaned-golden-actors branch from d81b4cb to 0944556 Compare July 24, 2026 21:37
switch at.Status.Phase {
case atev1alpha1.PhaseInitial:
actorID := uuid.NewString()
actorName := string(at.UID)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kubernetes UIDs (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids) should be compatible with resource names, which are enforced by standard RFC-1123 DNS label rules.

@EItanya Eitan Yarmush (EItanya) 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.

Great catch!

@zoez7

Copy link
Copy Markdown
Collaborator

This changes the behaviour of Reconcile - if a previous attempt created a actor with at.UID and failed to produce a golden snapshot, this will reuse the same actor and may never produce a usable golden snapshot.

Also, now updates to that same actor template doesn't create a new snapshot. I think this bug is part of the complexity mentioned in #536.

@EItanya

Copy link
Copy Markdown
Collaborator

This changes the behaviour of Reconcile - if a previous attempt created a actor with at.UID and failed to produce a golden snapshot, this will reuse the same actor and may never produce a usable golden snapshot.

Functionally I think that's correct, otherwise like mentioned above we may have a bunch of orphaned actors. Do you think a more correct way would be to leave them orphaned and have a secondary GC process pick them up?

Also, now updates to that same actor template doesn't create a new snapshot. I think this bug is part of the complexity mentioned in #536.

I thought the ActorTemplate was immutable today anyway?

@troychiu

Troy Chiu (troychiu) commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

This changes the behaviour of Reconcile - if a previous attempt created a actor with at.UID and failed to produce a golden snapshot, this will reuse the same actor and may never produce a usable golden snapshot.

Even before this PR, once at.Status.GoldenActorID was saved, all subsequent reconciliation phases already reused that single actor ID upon retries. The orphan leak happened specifically when CreateActor succeeded in ateapi but the kubernetes status update failed.

I thought the ActorTemplate was immutable today anyway?

Yes the ActorTemplate spec is immutable

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Spec is immutable"
Spec ActorTemplateSpec `json:"spec"`

@zoez7
Zoe Zhao (zoez7) merged commit 7fe087c into agent-substrate:main Jul 27, 2026
11 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.

ActorTemplateReconciler orphans golden actors in ateapi on reconciliation retries

3 participants