Skip to content

Add CheckPrerequisite to WorkflowStep to validate state machine edges#374

Merged
Dmitry Berkovich (dberkov) merged 7 commits into
agent-substrate:mainfrom
zoez7:check-prerequisite
Jul 21, 2026
Merged

Add CheckPrerequisite to WorkflowStep to validate state machine edges#374
Dmitry Berkovich (dberkov) merged 7 commits into
agent-substrate:mainfrom
zoez7:check-prerequisite

Conversation

@zoez7

@zoez7 Zoe Zhao (zoez7) commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #369

Add a CheckPrerequisite method to the WorkflowStep interface, called by RunWorkflow after IsComplete returns false and before Execute, so that each workflow validates its actor state-machine edge up front while retried (reentrant) workflows still fast-forward past completed steps.

@zoez7
Zoe Zhao (zoez7) force-pushed the check-prerequisite branch 4 times, most recently from 9e8acdf to 3921ac8 Compare July 8, 2026 23:55
Comment thread cmd/ateapi/internal/controlapi/workflow_resume.go Outdated
Comment thread cmd/ateapi/internal/controlapi/workflow_suspend.go
@zoez7
Zoe Zhao (zoez7) marked this pull request as ready for review July 8, 2026 23:58
return nil
}
func (s *CallAteletPauseStep) Execute(ctx context.Context, input *PauseInput, state *PauseState) error {
if state.Actor.GetAteomPodNamespace() == "" || state.Actor.GetAteomPodName() == "" {

@dberkov Dmitry Berkovich (dberkov) Jul 10, 2026

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.

this is a pre-requisite too, however function in current implementation does not support transition to crashActor.

Might be rename the "CheckPrerequisite" to different name? might be allow transition to crash? or might be from the beginning we were not supposed to be in this state, that actor does not have pod or namespace?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We should crash the actor here. We can only get here if MarkPausing has succeeded, not having the ateom pod or namespace should crash the actor. I changed the implementation.

Comment thread cmd/ateapi/internal/controlapi/workflow_pause_test.go Outdated
return nil
}
func (s *CallAteletPauseStep) Execute(ctx context.Context, input *PauseInput, state *PauseState) error {
if state.Actor.GetAteomPodNamespace() == "" || state.Actor.GetAteomPodName() == "" {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We should crash the actor here. We can only get here if MarkPausing has succeeded, not having the ateom pod or namespace should crash the actor. I changed the implementation.

Comment thread cmd/ateapi/internal/controlapi/workflow_pause_test.go Outdated
Comment thread cmd/ateapi/internal/controlapi/workflow_resume.go Outdated
Comment thread cmd/ateapi/internal/controlapi/workflow_resume.go
Comment thread cmd/ateapi/internal/controlapi/workflow_resume.go
…o check the worker eligibility again if previous attempt failed after setting actor to RESUMING state.

If the worker becomes ineligible, set the actor to crashed state.
@dberkov
Dmitry Berkovich (dberkov) merged commit 4ecf3fb into agent-substrate:main Jul 21, 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.

[Actor state machine] Add CheckPrerequisite steps to WorkflowStep definition

3 participants