feat(conductor): task state machine — TIMED_OUT state and retriable steps
- Add 'timed_out' to flow_runs/flow_steps CHECK constraints - Add retry_count and max_retries columns to flow_steps - Add timeout detection in advanceInner loop (configurable FLOW_STEP_TIMEOUT_MS) - Add retriable logic: re-dispatch on timeout if maxRetries > 0 and retryCount < maxRetries - Add isRetriable() + shouldRetry() pure decision functions - Add timed_out handling to reconcileResumeStep and reconcileRun - Add 'timed_out' to ws-frames enum, publishStep status type
This commit is contained in:
@@ -42,6 +42,14 @@ export type StepKind = 'agent' | 'code' | 'approval';
|
||||
|
||||
export type TriggerRule = 'all_success' | 'one_success' | 'all_done';
|
||||
|
||||
/** Possible statuses for a flow step (persisted in flow_steps.status). */
|
||||
export type StepStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped' | 'cancelled' | 'timed_out';
|
||||
|
||||
/** Retry policy for a step that times out. */
|
||||
export interface RetryConfig {
|
||||
maxRetries: number;
|
||||
}
|
||||
|
||||
export interface Step {
|
||||
/** unique id within the flow; other steps depend on it by this id */
|
||||
id: string;
|
||||
@@ -59,6 +67,8 @@ export interface Step {
|
||||
run: (ctx: StepContext) => string | Promise<string>;
|
||||
/** optional guard — when it returns false the step is skipped (e.g. no repo) */
|
||||
when?: (ctx: StepContext) => boolean;
|
||||
/** max retries on timeout (0 or unset = no retry) */
|
||||
maxRetries?: number;
|
||||
}
|
||||
|
||||
export interface Flow {
|
||||
|
||||
Reference in New Issue
Block a user