Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/types/ws-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ interface UserMessageMsg {
v: 2;
messageId: string;
text: string;
sessionId?: string;
}

interface SessionRenamedMsg {
Expand Down
24 changes: 21 additions & 3 deletions server/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,13 @@ async function _startChatInner(
});
eventStore.updateLastSpeaker(options.resume, 'user');
_onSessionChange?.(clientId, 'user_message');
const echo = { type: 'user_message', messageId, text: fullPrompt };
const echo = {
type: 'user_message',
v: 2,
messageId,
text: fullPrompt,
sessionId: options.resume,
};
send(transport, echo);
broadcastToObservers(session.observers, echo);
}
Expand Down Expand Up @@ -1081,7 +1087,13 @@ export function sendToChat(
/* errors logged internally */
});
}
const echo = { type: 'user_message', messageId, text: fullPrompt };
const echo = {
type: 'user_message',
v: 2,
messageId,
text: fullPrompt,
...(session.sessionId ? { sessionId: session.sessionId } : {}),
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 style: The conditional spread ...(session.sessionId ? { sessionId: session.sessionId } : {}) appears identically in both sendToChat and interruptChat. This is fine for two occurrences, but if you wanted consistency with the resume path (line 962: sessionId: options.resume), you could use the simpler ...(session.sessionId && { sessionId: session.sessionId }). Minor style nit — current form is perfectly correct. [fixable]

};
send(session.transport, echo);
broadcastToObservers(session.observers, echo);
session.inputQueue.push(makeUserMessage(fullPrompt, 'next'));
Expand Down Expand Up @@ -1115,7 +1127,13 @@ export async function interruptChat(
eventStore.updateLastSpeaker(session.sessionId, 'user');
_onSessionChange?.(clientId, 'user_message');
}
const echo = { type: 'user_message', messageId, text: fullPrompt };
const echo = {
type: 'user_message',
v: 2,
messageId,
text: fullPrompt,
...(session.sessionId ? { sessionId: session.sessionId } : {}),
};
send(session.transport, echo);
broadcastToObservers(session.observers, echo);
// Stop all active subagent tasks before interrupting the parent query.
Expand Down
Loading