fix: Improve error handling and state management in auto-mode and utilities

This commit is contained in:
gsxdsm
2026-02-18 23:12:11 -08:00
parent a144a63c51
commit be4153c374
4 changed files with 32 additions and 22 deletions

View File

@@ -519,15 +519,22 @@ export class AutoModeServiceFacade {
useWorktrees = false,
_calledInternally = false
): Promise<void> {
// Do not call handleFacadeError here: ExecutionService.executeFeature already
// classifies and emits auto_mode_error, so calling handleFacadeError would
// produce duplicate error events. Simply let the error propagate to the caller.
return await this.recoveryService.resumeFeature(
this.projectPath,
featureId,
useWorktrees,
_calledInternally
);
// Note: ExecutionService.executeFeature catches its own errors internally and
// does NOT re-throw them (it emits auto_mode_error and returns normally).
// Therefore, errors that reach this catch block are pre-execution failures
// (e.g., feature not found, context read error) that ExecutionService never
// handled — so calling handleFacadeError here does NOT produce duplicate events.
try {
return await this.recoveryService.resumeFeature(
this.projectPath,
featureId,
useWorktrees,
_calledInternally
);
} catch (error) {
this.handleFacadeError(error, 'resumeFeature', featureId);
throw error;
}
}
/**