Skip to content

Commit c09f68c

Browse files
committed
🤖 fix: ensure soft interrupt state updates even if message lookup fails
1 parent bb413be commit c09f68c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/browser/utils/messages/StreamingMessageAggregator.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,18 @@ export class StreamingMessageAggregator {
387387
}
388388

389389
handleStreamDelta(data: StreamDeltaEvent): void {
390-
const message = this.messages.get(data.messageId);
391-
if (!message) return;
392-
393390
// Handle soft interrupt signal from backend
391+
// Do this BEFORE message check to ensure interrupt state is captured even if message lookup fails
394392
if (data.softInterruptPending !== undefined) {
395393
const context = this.activeStreams.get(data.messageId);
396394
if (context) {
397395
context.softInterruptPending = data.softInterruptPending;
398396
}
399397
}
400398

399+
const message = this.messages.get(data.messageId);
400+
if (!message) return;
401+
401402
// Skip appending if this is an empty delta (e.g., just signaling interrupt)
402403
if (data.delta) {
403404
message.parts.push({

0 commit comments

Comments
 (0)