Skip to content

Commit 8e488fd

Browse files
committed
feat(workflow): register monitoringId for step logs in run.ts
- Added logic to register `monitoringId` for step 0 to enable log viewing. - Extended `ControllerResult` with an optional `monitoringId` field. - Updated `run.ts` to handle `monitoringId` and include relevant debug logs.
1 parent c38a5e2 commit 8e488fd

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎src/workflows/controller.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export interface ControllerPhaseResult {
3434
ran: boolean;
3535
/** Controller agent ID if ran */
3636
agentId?: string;
37+
/** Monitoring ID for log viewing */
38+
monitoringId?: number;
3739
}
3840

3941
/**
@@ -174,7 +176,7 @@ export async function runControllerPhase(
174176

175177
emitter.setWorkflowPhase('executing');
176178

177-
return { ran: true, agentId: controller.id };
179+
return { ran: true, agentId: controller.id, monitoringId: controllerMonitoringId };
178180
} catch (error) {
179181
debug('[ControllerPhase] Controller phase failed: %s', (error as Error).message);
180182
emitter.setInputState(null);

‎src/workflows/run.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,13 @@ export async function runWorkflow(options: RunWorkflowOptions = {}): Promise<voi
262262
// Mark step 0 as completed in the index manager
263263
indexManager.setCurrentStepIndex(1);
264264
await indexManager.stepCompleted(0);
265-
// Also update UI timeline to show step 0 as completed
265+
// Also update UI timeline to show step 0 as completed and register monitoring ID for log viewing
266266
const uniqueAgentId = getUniqueAgentId(firstStep, 0);
267267
emitter.updateAgentStatus(uniqueAgentId, 'completed');
268+
if (controllerResult.monitoringId !== undefined) {
269+
emitter.registerMonitoringId(uniqueAgentId, controllerResult.monitoringId);
270+
debug('[Workflow] Registered monitoringId=%d for step 0 (%s)', controllerResult.monitoringId, uniqueAgentId);
271+
}
268272
}
269273
}
270274

0 commit comments

Comments
 (0)