feat: backend executor implement

This commit is contained in:
2026-08-16 17:12:06 +08:00
parent 390e0565d3
commit 7755da72e7
31 changed files with 2762 additions and 184 deletions
+22 -1
View File
@@ -93,7 +93,28 @@ func (c *Coordinator) ExecuteStep(ctx context.Context, transactionID string, int
return step, nil
}
if step.Status == StepFailed {
return step, fmt.Errorf("external step already failed: %s", step.Error)
inspection, inspectErr := operation.Inspect(ctx)
if inspectErr != nil {
return step, c.uncertain(ctx, transactionID, intent.Key, fmt.Errorf("inspect failed step: %w", inspectErr))
}
switch inspection.Status {
case InspectionApplied:
if _, err := c.store.ReopenFailedStep(ctx, transactionID, intent.Key, "manual resume found failed step applied"); err != nil {
return step, err
}
return c.completeApplied(ctx, transactionID, intent.Key, inspection)
case InspectionNotApplied:
reopened, err := c.store.ReopenFailedStep(ctx, transactionID, intent.Key, "manual resume found failed step not applied")
if err != nil {
return step, err
}
step = reopened
created = true
case InspectionUnknown:
return step, c.uncertain(ctx, transactionID, intent.Key, errors.New("inspect failed step returned UNKNOWN"))
default:
return step, c.uncertain(ctx, transactionID, intent.Key, fmt.Errorf("inspect failed step returned invalid status %q", inspection.Status))
}
}
if !created {