Skip to content

Handle partial volume creation failures - #527

Open
Michelle Au (msau42) wants to merge 3 commits into
agent-substrate:mainfrom
msau42:handle-create-volume-failure
Open

Handle partial volume creation failures#527
Michelle Au (msau42) wants to merge 3 commits into
agent-substrate:mainfrom
msau42:handle-create-volume-failure

Conversation

@msau42

@msau42 Michelle Au (msau42) commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Part of #232

  1. During CreateActor, the volumes to be created get instantiated in the Actor API in PENDING status. The Actor is still instantiated as SUSPENDED.

However, the CreateVolume operation is moved to the beginning of ResumeActor. This is because CreateActor is intentionally designed to not be idempotent. The downside is that the user won't know dependent resource creation failed until the first resume.

  1. Changes volume id to use actor uid instead of atespace+actorname and adds "substrate" prefix

  2. Adds a new DELETING status that gets persisted before we start to delete volumes.

This shifts the existing DB DELETE precondition checks to the new DELETING status. And now you can only delete the actor in DB from DELETING status.

  1. Refactor DeleteActor to use a workflow

In the future, we will also add a workflow that will do mandatory node cleanup of volumes before starting to delete the volumes.

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

@msau42
Michelle Au (msau42) force-pushed the handle-create-volume-failure branch 5 times, most recently from 3df47e1 to 958b436 Compare July 28, 2026 03:29
Comment thread cmd/ateapi/internal/controlapi/volumes.go Outdated
Comment thread cmd/ateapi/internal/controlapi/delete_actor.go Outdated
@msau42 Michelle Au (msau42) changed the title Handle partial volume creation failures during CreateActor. Handle partial volume creation failuress Jul 28, 2026
@msau42

Copy link
Copy Markdown
Collaborator Author

I created new commits to address the review comments. I can squash before merge

@msau42 Michelle Au (msau42) changed the title Handle partial volume creation failuress Handle partial volume creation failures Jul 28, 2026
@msau42
Michelle Au (msau42) force-pushed the handle-create-volume-failure branch 2 times, most recently from ee1904e to 42bc74f Compare July 29, 2026 00:26
1. During CreateActor, the volumes to be created
get instantiated in the Actor API in CREATING status.
The Actor is still instantiated as SUSPENDED.

However, the CreateVolume operation is moved
to the beginning of ResumeActor.
This is because CreateActor is intentionally designed
to not be idempotent. The downside is that the user
won't know dependent resource creation failed until
the first resume.

2. Changes volume id to use actor uid instead of
atespace+actorname, and add "substrate" prefix

3. Adds a new DELETING status that gets persisted before
we start to delete volumes.

This shifts the existing DB DELETE precondition checks
to the new DELETING status. And now you can only delete
the actor in DB from DELETING status.

In the future, we will also add a workflow that will
do mandatory node cleanup of volumes before starting
to delete the volumes.
The steps are:
- LoadActorForDeleteStep: Loads the actor state from store.
- MarkDeletingStep: Validates state prerequisites (STATUS_SUSPENDED, STATUS_CRASHED, STATUS_DELETING) and updates actor and external volume statuses to STATUS_DELETING / ExternalVolume_DELETING.
- DeleteVolumesStep: Deletes associated external volumes via deleteActorVolumes.
- FinalizeDeletedStep: Deletes the actor from store and returns the deleted object.
@msau42
Michelle Au (msau42) force-pushed the handle-create-volume-failure branch from 42bc74f to be6d8f9 Compare July 29, 2026 00:33
message ExternalVolume {
// actor_id + the volume name specified in the actor template.
string actor_volume_id = 1;
// Name of the volume specified in the actor template.

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.

We should add validation for these fields. If you do it in a follow up maybe add a TODO comment in create_actor.go?

PROVISIONING = 0;
CREATED = 1;
DELETING = 2;
STATUS_UNKNOWN = 0;

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: This should be STATUS_UNSPECIFIED.

DELETING = 2;
STATUS_UNKNOWN = 0;
// Volume creation pending in the storage system.
PENDING = 1;

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.

Let's add STATUS_ prefix here and on the other values below for consistency with other enums.

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.

2 participants