Skip to content

Commit 3dc5f7e

Browse files
committed
fix(workflow): remove duplicate error logging and status setting
Centralize error handling by removing redundant error logging to output window since errors are now displayed in modal. The workflow status is set once via event bus adapter.
1 parent 4f6be66 commit 3dc5f7e

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/cli/tui/routes/workflow/workflow-shell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ export function WorkflowShell(props: WorkflowShellProps) {
9595
const isErrorModalActive = () => errorMessage() !== null
9696

9797
const handleWorkflowError = (data: { reason: string }) => {
98+
// Only set error message - workflow status is already set via event bus adapter
9899
setErrorMessage(data.reason)
99-
ui.actions.setWorkflowStatus("error")
100100
}
101101

102102
const handleErrorModalClose = () => {

src/workflows/execution/errors.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ ${engine}: ${errorMessage}`;
9191
debug(`[DEBUG workflow] isFileNotFoundError=true, emitting workflow:error`);
9292
debug(`[DEBUG workflow] errorMsg=${errorMsg}`);
9393
emitter.updateAgentStatus(uniqueAgentId, 'failed');
94-
emitter.logMessage(uniqueAgentId, errorMsg);
9594

96-
// Set workflow status to error and emit error event for toast
95+
// Set workflow status to error and emit error event for modal
96+
// Don't log to output window - the modal will display the error
9797
debug(`[DEBUG workflow] Calling emitter.setWorkflowStatus('error')`);
9898
emitter.setWorkflowStatus('error');
9999
debug(`[DEBUG workflow] Emitting process event 'workflow:error'`);
@@ -109,10 +109,10 @@ ${engine}: ${errorMessage}`;
109109
${engine}: ${error instanceof Error ? error.message : String(error)}`;
110110
debug(`[DEBUG workflow] Generic error path`);
111111
debug(`[DEBUG workflow] errorMsg=${errorMsg}`);
112-
emitter.logMessage(uniqueAgentId, errorMsg);
113112
emitter.updateAgentStatus(uniqueAgentId, 'failed');
114113

115-
// Set workflow status to error and emit error event for toast
114+
// Set workflow status to error and emit error event for modal
115+
// Don't log to output window - the modal will display the error
116116
debug(`[DEBUG workflow] Calling emitter.setWorkflowStatus('error') for generic error`);
117117
emitter.setWorkflowStatus('error');
118118
debug(`[DEBUG workflow] Emitting process event 'workflow:error' for generic error`);

src/workflows/execution/run.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,8 @@ export async function runWorkflow(options: RunWorkflowOptions = {}): Promise<voi
528528

529529
const errorMsg = error instanceof Error ? error.message : String(error);
530530

531-
emitter.logMessage('workflow', `\n${'═'.repeat(80)}\nWORKFLOW FAILED\n${'═'.repeat(80)}`);
532-
emitter.logMessage('workflow', `Error: ${errorMsg}`);
533-
534-
// Set workflow status to error and emit error event for toast
531+
// Set workflow status to error and emit error event for modal
532+
// Don't log to output window - the modal will display the error
535533
emitter.setWorkflowStatus('error');
536534
(process as NodeJS.EventEmitter).emit('workflow:error', { reason: errorMsg });
537535

0 commit comments

Comments
 (0)