Skip to content

Commit e46c091

Browse files
committed
🤖 Complete debug logging for init events in handleMessage
Add console.debug logs for init-start, init-output, and init-end events: - init-start: Log hookPath and timestamp when init begins - init-output: Log line content, isError flag, and running line count - init-end: Log exit code, final status, and total line count - Auto-dismiss: Log when successful init is auto-dismissed after 800ms Also add warnings when init-output/init-end arrive without active init state (helps catch event ordering bugs). These logs complement the existing serialization log, providing full visibility into init event lifecycle from arrival through rendering.
1 parent 45584ad commit e46c091

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/utils/messages/StreamingMessageAggregator.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,10 @@ export class StreamingMessageAggregator {
507507
handleMessage(data: WorkspaceChatMessage): void {
508508
// Handle init hook events (ephemeral, not persisted to history)
509509
if (isInitStart(data)) {
510+
console.debug("[StreamingMessageAggregator] Init started:", {
511+
hookPath: data.hookPath,
512+
timestamp: data.timestamp,
513+
});
510514
this.initState = {
511515
status: "running",
512516
hookPath: data.hookPath,
@@ -522,7 +526,14 @@ export class StreamingMessageAggregator {
522526
if (this.initState) {
523527
const line = data.isError ? `ERROR: ${data.line}` : data.line;
524528
this.initState.lines.push(line.trimEnd());
529+
console.debug("[StreamingMessageAggregator] Init output:", {
530+
line: data.line,
531+
isError: data.isError,
532+
totalLines: this.initState.lines.length,
533+
});
525534
this.invalidateCache();
535+
} else {
536+
console.warn("[StreamingMessageAggregator] Init output received without active init state");
526537
}
527538
return;
528539
}
@@ -531,15 +542,23 @@ export class StreamingMessageAggregator {
531542
if (this.initState) {
532543
this.initState.exitCode = data.exitCode;
533544
this.initState.status = data.exitCode === 0 ? "success" : "error";
545+
console.debug("[StreamingMessageAggregator] Init ended:", {
546+
exitCode: data.exitCode,
547+
status: this.initState.status,
548+
totalLines: this.initState.lines.length,
549+
});
534550
this.invalidateCache();
535551

536552
// Auto-dismiss on success after 800ms
537553
if (data.exitCode === 0) {
538554
setTimeout(() => {
555+
console.debug("[StreamingMessageAggregator] Auto-dismissing successful init");
539556
this.initState = null;
540557
this.invalidateCache();
541558
}, 800);
542559
}
560+
} else {
561+
console.warn("[StreamingMessageAggregator] Init end received without active init state");
543562
}
544563
return;
545564
}

0 commit comments

Comments
 (0)