@litmers/cursorflow-orchestrator 0.1.40 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -2
- package/README.md +8 -3
- package/commands/cursorflow-init.md +0 -4
- package/dist/cli/index.js +0 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/logs.js +108 -9
- package/dist/cli/logs.js.map +1 -1
- package/dist/cli/models.js +20 -3
- package/dist/cli/models.js.map +1 -1
- package/dist/cli/monitor.d.ts +7 -10
- package/dist/cli/monitor.js +1103 -1239
- package/dist/cli/monitor.js.map +1 -1
- package/dist/cli/resume.js +21 -1
- package/dist/cli/resume.js.map +1 -1
- package/dist/cli/run.js +28 -9
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/signal.d.ts +6 -1
- package/dist/cli/signal.js +99 -13
- package/dist/cli/signal.js.map +1 -1
- package/dist/cli/tasks.js +3 -46
- package/dist/cli/tasks.js.map +1 -1
- package/dist/core/agent-supervisor.d.ts +23 -0
- package/dist/core/agent-supervisor.js +42 -0
- package/dist/core/agent-supervisor.js.map +1 -0
- package/dist/core/auto-recovery.d.ts +3 -117
- package/dist/core/auto-recovery.js +4 -482
- package/dist/core/auto-recovery.js.map +1 -1
- package/dist/core/failure-policy.d.ts +0 -53
- package/dist/core/failure-policy.js +7 -175
- package/dist/core/failure-policy.js.map +1 -1
- package/dist/core/git-lifecycle-manager.d.ts +284 -0
- package/dist/core/git-lifecycle-manager.js +778 -0
- package/dist/core/git-lifecycle-manager.js.map +1 -0
- package/dist/core/git-pipeline-coordinator.d.ts +21 -0
- package/dist/core/git-pipeline-coordinator.js +205 -0
- package/dist/core/git-pipeline-coordinator.js.map +1 -0
- package/dist/core/intervention.d.ts +170 -0
- package/dist/core/intervention.js +408 -0
- package/dist/core/intervention.js.map +1 -0
- package/dist/core/lane-state-machine.d.ts +423 -0
- package/dist/core/lane-state-machine.js +890 -0
- package/dist/core/lane-state-machine.js.map +1 -0
- package/dist/core/orchestrator.d.ts +4 -1
- package/dist/core/orchestrator.js +39 -65
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/runner/agent.d.ts +7 -1
- package/dist/core/runner/agent.js +54 -36
- package/dist/core/runner/agent.js.map +1 -1
- package/dist/core/runner/pipeline.js +283 -123
- package/dist/core/runner/pipeline.js.map +1 -1
- package/dist/core/runner/task.d.ts +4 -5
- package/dist/core/runner/task.js +6 -80
- package/dist/core/runner/task.js.map +1 -1
- package/dist/core/runner.js +8 -2
- package/dist/core/runner.js.map +1 -1
- package/dist/core/stall-detection.d.ts +11 -4
- package/dist/core/stall-detection.js +64 -27
- package/dist/core/stall-detection.js.map +1 -1
- package/dist/hooks/contexts/index.d.ts +104 -0
- package/dist/hooks/contexts/index.js +134 -0
- package/dist/hooks/contexts/index.js.map +1 -0
- package/dist/hooks/data-accessor.d.ts +86 -0
- package/dist/hooks/data-accessor.js +410 -0
- package/dist/hooks/data-accessor.js.map +1 -0
- package/dist/hooks/flow-controller.d.ts +136 -0
- package/dist/hooks/flow-controller.js +351 -0
- package/dist/hooks/flow-controller.js.map +1 -0
- package/dist/hooks/index.d.ts +68 -0
- package/dist/hooks/index.js +105 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/manager.d.ts +129 -0
- package/dist/hooks/manager.js +389 -0
- package/dist/hooks/manager.js.map +1 -0
- package/dist/hooks/types.d.ts +463 -0
- package/dist/hooks/types.js +45 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/services/logging/buffer.d.ts +2 -2
- package/dist/services/logging/buffer.js +95 -42
- package/dist/services/logging/buffer.js.map +1 -1
- package/dist/services/logging/console.js +6 -1
- package/dist/services/logging/console.js.map +1 -1
- package/dist/services/logging/formatter.d.ts +9 -4
- package/dist/services/logging/formatter.js +64 -18
- package/dist/services/logging/formatter.js.map +1 -1
- package/dist/services/logging/index.d.ts +0 -1
- package/dist/services/logging/index.js +0 -1
- package/dist/services/logging/index.js.map +1 -1
- package/dist/services/logging/paths.d.ts +8 -0
- package/dist/services/logging/paths.js +48 -0
- package/dist/services/logging/paths.js.map +1 -0
- package/dist/services/logging/raw-log.d.ts +6 -0
- package/dist/services/logging/raw-log.js +37 -0
- package/dist/services/logging/raw-log.js.map +1 -0
- package/dist/services/process/index.js +1 -1
- package/dist/services/process/index.js.map +1 -1
- package/dist/types/agent.d.ts +15 -0
- package/dist/types/config.d.ts +22 -1
- package/dist/types/event-categories.d.ts +601 -0
- package/dist/types/event-categories.js +233 -0
- package/dist/types/event-categories.js.map +1 -0
- package/dist/types/events.d.ts +0 -20
- package/dist/types/flow.d.ts +10 -6
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +17 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/lane.d.ts +1 -1
- package/dist/types/logging.d.ts +1 -1
- package/dist/types/task.d.ts +12 -1
- package/dist/ui/log-viewer.d.ts +3 -0
- package/dist/ui/log-viewer.js +3 -0
- package/dist/ui/log-viewer.js.map +1 -1
- package/dist/utils/config.js +10 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/cursor-agent.d.ts +11 -1
- package/dist/utils/cursor-agent.js +63 -16
- package/dist/utils/cursor-agent.js.map +1 -1
- package/dist/utils/enhanced-logger.d.ts +5 -1
- package/dist/utils/enhanced-logger.js +98 -19
- package/dist/utils/enhanced-logger.js.map +1 -1
- package/dist/utils/event-registry.d.ts +222 -0
- package/dist/utils/event-registry.js +463 -0
- package/dist/utils/event-registry.js.map +1 -0
- package/dist/utils/events.d.ts +1 -13
- package/dist/utils/events.js.map +1 -1
- package/dist/utils/flow.d.ts +10 -0
- package/dist/utils/flow.js +75 -0
- package/dist/utils/flow.js.map +1 -1
- package/dist/utils/log-constants.d.ts +1 -0
- package/dist/utils/log-constants.js +2 -1
- package/dist/utils/log-constants.js.map +1 -1
- package/dist/utils/log-formatter.d.ts +2 -1
- package/dist/utils/log-formatter.js +10 -10
- package/dist/utils/log-formatter.js.map +1 -1
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.js +82 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/repro-thinking-logs.js +0 -13
- package/dist/utils/repro-thinking-logs.js.map +1 -1
- package/dist/utils/run-service.js +1 -1
- package/dist/utils/run-service.js.map +1 -1
- package/examples/README.md +0 -2
- package/examples/demo-project/README.md +1 -2
- package/package.json +13 -34
- package/scripts/setup-security.sh +0 -1
- package/scripts/test-log-parser.ts +171 -0
- package/scripts/verify-change.sh +272 -0
- package/src/cli/index.ts +0 -6
- package/src/cli/logs.ts +121 -10
- package/src/cli/models.ts +20 -3
- package/src/cli/monitor.ts +1273 -1342
- package/src/cli/resume.ts +27 -1
- package/src/cli/run.ts +29 -11
- package/src/cli/signal.ts +120 -18
- package/src/cli/tasks.ts +2 -59
- package/src/core/agent-supervisor.ts +64 -0
- package/src/core/auto-recovery.ts +14 -590
- package/src/core/failure-policy.ts +7 -229
- package/src/core/git-lifecycle-manager.ts +1011 -0
- package/src/core/git-pipeline-coordinator.ts +221 -0
- package/src/core/intervention.ts +463 -0
- package/src/core/lane-state-machine.ts +1097 -0
- package/src/core/orchestrator.ts +48 -64
- package/src/core/runner/agent.ts +77 -39
- package/src/core/runner/pipeline.ts +318 -138
- package/src/core/runner/task.ts +12 -97
- package/src/core/runner.ts +8 -2
- package/src/core/stall-detection.ts +74 -27
- package/src/hooks/contexts/index.ts +256 -0
- package/src/hooks/data-accessor.ts +488 -0
- package/src/hooks/flow-controller.ts +425 -0
- package/src/hooks/index.ts +154 -0
- package/src/hooks/manager.ts +434 -0
- package/src/hooks/types.ts +544 -0
- package/src/services/logging/buffer.ts +104 -43
- package/src/services/logging/console.ts +7 -1
- package/src/services/logging/formatter.ts +74 -18
- package/src/services/logging/index.ts +0 -2
- package/src/services/logging/paths.ts +14 -0
- package/src/services/logging/raw-log.ts +43 -0
- package/src/services/process/index.ts +1 -1
- package/src/types/agent.ts +15 -0
- package/src/types/config.ts +23 -1
- package/src/types/event-categories.ts +663 -0
- package/src/types/events.ts +0 -25
- package/src/types/flow.ts +10 -6
- package/src/types/index.ts +50 -4
- package/src/types/lane.ts +1 -2
- package/src/types/logging.ts +2 -1
- package/src/types/task.ts +12 -1
- package/src/ui/log-viewer.ts +3 -0
- package/src/utils/config.ts +11 -1
- package/src/utils/cursor-agent.ts +68 -16
- package/src/utils/enhanced-logger.ts +105 -19
- package/src/utils/event-registry.ts +595 -0
- package/src/utils/events.ts +0 -16
- package/src/utils/flow.ts +83 -0
- package/src/utils/log-constants.ts +2 -1
- package/src/utils/log-formatter.ts +10 -11
- package/src/utils/logger.ts +49 -3
- package/src/utils/repro-thinking-logs.ts +0 -15
- package/src/utils/run-service.ts +1 -1
- package/dist/cli/prepare.d.ts +0 -7
- package/dist/cli/prepare.js +0 -690
- package/dist/cli/prepare.js.map +0 -1
- package/dist/services/logging/file-writer.d.ts +0 -71
- package/dist/services/logging/file-writer.js +0 -516
- package/dist/services/logging/file-writer.js.map +0 -1
- package/dist/types/review.d.ts +0 -17
- package/dist/types/review.js +0 -6
- package/dist/types/review.js.map +0 -1
- package/scripts/ai-security-check.js +0 -233
- package/src/cli/prepare.ts +0 -777
- package/src/services/logging/file-writer.ts +0 -526
- package/src/types/review.ts +0 -20
|
@@ -23,7 +23,6 @@ export enum FailureType {
|
|
|
23
23
|
DEPENDENCY_BLOCK = 'DEPENDENCY_BLOCK',
|
|
24
24
|
DEPENDENCY_FAILED = 'DEPENDENCY_FAILED',
|
|
25
25
|
DEPENDENCY_TIMEOUT = 'DEPENDENCY_TIMEOUT',
|
|
26
|
-
REVIEW_FAIL = 'REVIEW_FAIL',
|
|
27
26
|
GIT_ERROR = 'GIT_ERROR',
|
|
28
27
|
GIT_PUSH_REJECTED = 'GIT_PUSH_REJECTED',
|
|
29
28
|
MERGE_CONFLICT = 'MERGE_CONFLICT',
|
|
@@ -60,60 +59,6 @@ export interface FailureAnalysis {
|
|
|
60
59
|
/**
|
|
61
60
|
* Multi-layer stall detection configuration
|
|
62
61
|
*/
|
|
63
|
-
export interface StallDetectionConfig {
|
|
64
|
-
/** Time without stdout activity before sending continue signal */
|
|
65
|
-
idleTimeoutMs: number;
|
|
66
|
-
/** Time without state file update before considering stalled */
|
|
67
|
-
progressTimeoutMs: number;
|
|
68
|
-
/** Maximum time for a single task */
|
|
69
|
-
taskTimeoutMs: number;
|
|
70
|
-
/** Grace period for known long operations (e.g., npm install) */
|
|
71
|
-
longOperationGraceMs: number;
|
|
72
|
-
/** Patterns that indicate long operations */
|
|
73
|
-
longOperationPatterns: RegExp[];
|
|
74
|
-
/** Maximum restarts before aborting */
|
|
75
|
-
maxRestarts: number;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export const DEFAULT_STALL_CONFIG: StallDetectionConfig = {
|
|
79
|
-
idleTimeoutMs: 2 * 60 * 1000, // 2 minutes without output (idle detection)
|
|
80
|
-
progressTimeoutMs: 10 * 60 * 1000, // 10 minutes without progress
|
|
81
|
-
taskTimeoutMs: 30 * 60 * 1000, // 30 minutes max per task
|
|
82
|
-
longOperationGraceMs: 10 * 60 * 1000, // 10 minute grace for long ops
|
|
83
|
-
longOperationPatterns: [
|
|
84
|
-
/Installing dependencies/i,
|
|
85
|
-
/npm install/i,
|
|
86
|
-
/pnpm install/i,
|
|
87
|
-
/yarn install/i,
|
|
88
|
-
/Building/i,
|
|
89
|
-
/Compiling/i,
|
|
90
|
-
/Downloading/i,
|
|
91
|
-
/Fetching/i,
|
|
92
|
-
/Cloning/i,
|
|
93
|
-
/Bundling/i,
|
|
94
|
-
],
|
|
95
|
-
maxRestarts: 2,
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export interface StallContext {
|
|
99
|
-
/** Current stall phase (0: normal, 1: continued, 2: stronger_prompt, 3: restarted) */
|
|
100
|
-
stallPhase: number;
|
|
101
|
-
/** Time since last activity */
|
|
102
|
-
idleTimeMs: number;
|
|
103
|
-
/** Time since last state update */
|
|
104
|
-
progressTimeMs?: number;
|
|
105
|
-
/** Last output line (for long operation detection) */
|
|
106
|
-
lastOutput?: string;
|
|
107
|
-
/** Number of restarts */
|
|
108
|
-
restartCount?: number;
|
|
109
|
-
/** Task start time */
|
|
110
|
-
taskStartTimeMs?: number;
|
|
111
|
-
/** Bytes received since last check (0 = no response at all) */
|
|
112
|
-
bytesReceived?: number;
|
|
113
|
-
/** Number of continue signals already sent */
|
|
114
|
-
continueSignalsSent?: number;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
62
|
export interface FailureContext {
|
|
118
63
|
exitCode?: number;
|
|
119
64
|
stallPhase?: number;
|
|
@@ -126,167 +71,6 @@ export interface FailureContext {
|
|
|
126
71
|
circuitBreakerName?: string;
|
|
127
72
|
}
|
|
128
73
|
|
|
129
|
-
/**
|
|
130
|
-
* Analyze stall condition with multi-layer detection and escalating recovery
|
|
131
|
-
*
|
|
132
|
-
* @deprecated Use StallDetectionService from './stall-detection' instead.
|
|
133
|
-
* This function is kept for backward compatibility but will be removed in a future version.
|
|
134
|
-
*
|
|
135
|
-
* The new unified StallDetectionService provides:
|
|
136
|
-
* - Single source of truth for stall state
|
|
137
|
-
* - Automatic recovery action execution
|
|
138
|
-
* - Better heartbeat filtering
|
|
139
|
-
* - Consistent state management
|
|
140
|
-
*
|
|
141
|
-
* Recovery escalation stages:
|
|
142
|
-
* 1. Phase 0 → Phase 1: Send continue signal (after 2 min idle)
|
|
143
|
-
* 2. Phase 1 → Phase 2: Send stronger prompt (after 2 min grace)
|
|
144
|
-
* 3. Phase 2 → Phase 3: Kill and restart process (after 2 min grace)
|
|
145
|
-
* 4. Phase 3+: Abort after max restarts exceeded
|
|
146
|
-
*/
|
|
147
|
-
export function analyzeStall(context: StallContext, config: StallDetectionConfig = DEFAULT_STALL_CONFIG): FailureAnalysis {
|
|
148
|
-
const {
|
|
149
|
-
stallPhase,
|
|
150
|
-
idleTimeMs,
|
|
151
|
-
progressTimeMs,
|
|
152
|
-
lastOutput,
|
|
153
|
-
restartCount = 0,
|
|
154
|
-
taskStartTimeMs,
|
|
155
|
-
bytesReceived = -1, // -1 means not tracked
|
|
156
|
-
continueSignalsSent = 0,
|
|
157
|
-
} = context;
|
|
158
|
-
|
|
159
|
-
// Check if this might be a long operation
|
|
160
|
-
const isLongOperation = lastOutput && config.longOperationPatterns.some(p => p.test(lastOutput));
|
|
161
|
-
|
|
162
|
-
// If it's a long operation but we've received 0 real bytes for a while,
|
|
163
|
-
// reduce the grace period to avoid waiting forever for a hung process.
|
|
164
|
-
// We use 2x the normal idle timeout as a "sanity check" for silent long operations.
|
|
165
|
-
const silentLongOpCappedTimeout = config.idleTimeoutMs * 2;
|
|
166
|
-
const effectiveIdleTimeout = isLongOperation
|
|
167
|
-
? (bytesReceived === 0 ? Math.min(config.longOperationGraceMs, silentLongOpCappedTimeout) : config.longOperationGraceMs)
|
|
168
|
-
: config.idleTimeoutMs;
|
|
169
|
-
|
|
170
|
-
// Check for task timeout
|
|
171
|
-
if (taskStartTimeMs && (Date.now() - taskStartTimeMs) > config.taskTimeoutMs) {
|
|
172
|
-
return {
|
|
173
|
-
type: FailureType.AGENT_TIMEOUT,
|
|
174
|
-
action: restartCount < config.maxRestarts ? RecoveryAction.KILL_AND_RESTART : RecoveryAction.RUN_DOCTOR,
|
|
175
|
-
message: `Task exceeded maximum timeout of ${Math.round(config.taskTimeoutMs / 60000)} minutes`,
|
|
176
|
-
isTransient: restartCount < config.maxRestarts,
|
|
177
|
-
details: { taskDurationMs: Date.now() - taskStartTimeMs, restartCount },
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Check for zero bytes received (agent completely unresponsive)
|
|
182
|
-
if (bytesReceived === 0 && idleTimeMs > effectiveIdleTimeout) {
|
|
183
|
-
return {
|
|
184
|
-
type: FailureType.AGENT_NO_RESPONSE,
|
|
185
|
-
action: stallPhase < 2 ? RecoveryAction.CONTINUE_SIGNAL : RecoveryAction.KILL_AND_RESTART,
|
|
186
|
-
message: `Agent produced 0 bytes for ${Math.round(idleTimeMs / 1000)}s - possible API issue`,
|
|
187
|
-
isTransient: true,
|
|
188
|
-
details: { idleTimeMs, bytesReceived, stallPhase },
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Check for no progress (state file not updating)
|
|
193
|
-
if (progressTimeMs && progressTimeMs > config.progressTimeoutMs) {
|
|
194
|
-
return {
|
|
195
|
-
type: FailureType.STALL_NO_PROGRESS,
|
|
196
|
-
action: stallPhase === 0 ? RecoveryAction.CONTINUE_SIGNAL :
|
|
197
|
-
stallPhase === 1 ? RecoveryAction.STRONGER_PROMPT :
|
|
198
|
-
RecoveryAction.KILL_AND_RESTART,
|
|
199
|
-
message: `No progress for ${Math.round(progressTimeMs / 60000)} minutes`,
|
|
200
|
-
isTransient: true,
|
|
201
|
-
details: { progressTimeMs, stallPhase },
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Phase 0: Normal operation, check for initial idle
|
|
206
|
-
if (stallPhase === 0 && idleTimeMs > effectiveIdleTimeout) {
|
|
207
|
-
return {
|
|
208
|
-
type: FailureType.STALL_IDLE,
|
|
209
|
-
action: RecoveryAction.CONTINUE_SIGNAL,
|
|
210
|
-
message: `Lane idle for ${Math.round(idleTimeMs / 1000)}s. Sending continue signal...`,
|
|
211
|
-
isTransient: true,
|
|
212
|
-
details: { idleTimeMs, isLongOperation, phase: 0 },
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Phase 1: Continue signal sent, wait for response
|
|
217
|
-
if (stallPhase === 1) {
|
|
218
|
-
const graceTimeout = 2 * 60 * 1000; // 2 minutes grace after continue
|
|
219
|
-
|
|
220
|
-
if (idleTimeMs > graceTimeout) {
|
|
221
|
-
return {
|
|
222
|
-
type: FailureType.STALL_IDLE,
|
|
223
|
-
action: RecoveryAction.STRONGER_PROMPT,
|
|
224
|
-
message: `Still idle after continue signal. Sending stronger prompt...`,
|
|
225
|
-
isTransient: true,
|
|
226
|
-
details: { idleTimeMs, continueSignalsSent, phase: 1 },
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Phase 2: Stronger prompt sent, wait or escalate
|
|
232
|
-
if (stallPhase === 2) {
|
|
233
|
-
const strongerGraceTimeout = 2 * 60 * 1000; // 2 minutes grace after stronger prompt
|
|
234
|
-
|
|
235
|
-
if (idleTimeMs > strongerGraceTimeout) {
|
|
236
|
-
if (restartCount < config.maxRestarts) {
|
|
237
|
-
return {
|
|
238
|
-
type: FailureType.STALL_IDLE,
|
|
239
|
-
action: RecoveryAction.KILL_AND_RESTART,
|
|
240
|
-
message: `No response after stronger prompt. Killing and restarting process...`,
|
|
241
|
-
isTransient: true,
|
|
242
|
-
details: { idleTimeMs, restartCount, maxRestarts: config.maxRestarts, phase: 2 },
|
|
243
|
-
};
|
|
244
|
-
} else {
|
|
245
|
-
return {
|
|
246
|
-
type: FailureType.STALL_IDLE,
|
|
247
|
-
action: RecoveryAction.RUN_DOCTOR,
|
|
248
|
-
message: `Lane failed after ${restartCount} restarts. Running diagnostics...`,
|
|
249
|
-
isTransient: false,
|
|
250
|
-
details: { restartCount, phase: 2 },
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Phase 3+: After restart, monitor with shorter timeout
|
|
257
|
-
if (stallPhase >= 3) {
|
|
258
|
-
const postRestartTimeout = config.idleTimeoutMs * 0.75; // Shorter timeout after restart
|
|
259
|
-
|
|
260
|
-
if (idleTimeMs > postRestartTimeout) {
|
|
261
|
-
if (restartCount < config.maxRestarts) {
|
|
262
|
-
return {
|
|
263
|
-
type: FailureType.STALL_IDLE,
|
|
264
|
-
action: RecoveryAction.CONTINUE_SIGNAL,
|
|
265
|
-
message: `Lane idle after restart. Retrying continue signal...`,
|
|
266
|
-
isTransient: true,
|
|
267
|
-
details: { idleTimeMs, restartCount, phase: stallPhase },
|
|
268
|
-
};
|
|
269
|
-
} else {
|
|
270
|
-
return {
|
|
271
|
-
type: FailureType.STALL_IDLE,
|
|
272
|
-
action: RecoveryAction.RUN_DOCTOR,
|
|
273
|
-
message: `Lane repeatedly stalled. Running diagnostics for root cause...`,
|
|
274
|
-
isTransient: false,
|
|
275
|
-
details: { stallPhase, restartCount },
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// No action needed yet
|
|
282
|
-
return {
|
|
283
|
-
type: FailureType.STALL_IDLE,
|
|
284
|
-
action: RecoveryAction.NONE,
|
|
285
|
-
message: 'Monitoring for stall',
|
|
286
|
-
isTransient: true,
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
|
|
290
74
|
/**
|
|
291
75
|
* Analyze an error message or state to determine the failure type and recovery action
|
|
292
76
|
*/
|
|
@@ -311,11 +95,12 @@ export function analyzeFailure(error: string | null | undefined, context?: Failu
|
|
|
311
95
|
// 1. Network errors
|
|
312
96
|
if (msg.includes('econnreset') || msg.includes('econnrefused') ||
|
|
313
97
|
msg.includes('etimedout') || msg.includes('enotfound') ||
|
|
314
|
-
msg.includes('socket hang up') || msg.includes('network')
|
|
98
|
+
msg.includes('socket hang up') || msg.includes('network') ||
|
|
99
|
+
msg.includes('canceled') || msg.includes('http/2') || msg.includes('stream closed')) {
|
|
315
100
|
return {
|
|
316
101
|
type: FailureType.NETWORK_ERROR,
|
|
317
102
|
action: (context?.retryCount || 0) < 3 ? RecoveryAction.RETRY_TASK : RecoveryAction.RESTART_LANE,
|
|
318
|
-
message: 'Network error. Retrying...',
|
|
103
|
+
message: 'Network error or connection lost. Retrying...',
|
|
319
104
|
isTransient: true,
|
|
320
105
|
suggestedDelayMs: 5000 * Math.pow(2, context?.retryCount || 0),
|
|
321
106
|
};
|
|
@@ -426,17 +211,10 @@ export function analyzeFailure(error: string | null | undefined, context?: Failu
|
|
|
426
211
|
};
|
|
427
212
|
}
|
|
428
213
|
|
|
429
|
-
// 10. Stalls
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
idleTimeMs: context.idleTimeMs || 0,
|
|
434
|
-
progressTimeMs: context.progressTimeMs,
|
|
435
|
-
restartCount: context.restartCount,
|
|
436
|
-
taskStartTimeMs: context.taskStartTimeMs,
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
|
|
214
|
+
// 10. Stalls
|
|
215
|
+
// Deprecated: analyzeStall call removed. Orchestrator now uses StallDetectionService
|
|
216
|
+
// for all stall-related monitoring and recovery.
|
|
217
|
+
|
|
440
218
|
// 11. Default fallback
|
|
441
219
|
return {
|
|
442
220
|
type: FailureType.UNKNOWN_CRASH,
|