Skip to content

UpdateActor fails with Aborted while another operation on the actor is in progress - #3131

Open
Zoe Zhao (zoez7) wants to merge 1 commit into
agent-substrate:mainfrom
zoez7:updateactor-lease
Open

Zoe Zhao (zoez7) wants to merge 1 commit into
agent-substrate:mainfrom
zoez7:updateactor-lease

Conversation

@zoez7

@zoez7 Zoe Zhao (zoez7) commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3129

UpdateActor now takes the actor lease, like suspend, resume, revert, delete and tag. A caller that races one of them gets Aborted and can retry.

This is to prevent an actor's workerSelector or actorTemplate from getting updated during other operations such as suspend/resume.

AI use: AI-assisted with Claude Code, which drafted the code, test, and this description. I reviewed them.

  • Tests pass
  • Docs updated

UpdateActor relied only on the uid/version precondition, so it could
interleave with a workflow that holds the actor lease. It now takes the
lease like suspend, resume, revert, delete and tag do.
setSpanActorRefAttributes(ctx, actorRef)

storedActor, err := s.impl.UpdateActor(ctx, actorRef, store.PreconditionFrom(inActor), func(toUpdate *ateapi.Actor) error {
leaseCtx, lease, err := acquireLease(ctx, s.impl, actorLeaseKey(actorRef), "actor")

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.

🤖 should-fix 🟡 – ABORTED from UpdateActor now has a second cause, but the API guide still lists only the guard mismatch. Please add the in-progress case to the error line at docs/api-guide.md:663 (worker_selector "in any state" is still true, but not mid-operation). The ReportActorSnapshotState comment in ateapi.proto has the house wording: "Returns ABORTED while another operation is changing the Actor; retry."

return nil, err
}

setSpanActorAttributes(ctx, storedActor)

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.

Should this use leaseCtx instead of ctx? It might be worth just reassigning ctx = leaseCtx right after acquiring it to prevent mismatches like this."

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.

UpdateActor should take the actor lease like the other actor operations

2 participants