perf(ui): label delayed chat sends in telemetry (#89777)

This commit is contained in:
Vincent Koc
2026-06-03 02:41:58 -07:00
committed by GitHub
parent 26301f318f
commit 7074cf8e23
2 changed files with 23 additions and 0 deletions

View File

@@ -1814,6 +1814,8 @@ describe("handleSendChat", () => {
client: { request } as unknown as ChatHost["client"],
chatMessage: "wait for selected model",
chatModelSwitchPromises: { "agent:main": switchUpdate.promise },
eventLogBuffer: [],
tab: "debug",
});
const send = handleSendChat(host);
@@ -1822,6 +1824,14 @@ describe("handleSendChat", () => {
sendState: "waiting-model",
text: "wait for selected model",
});
expect(eventPayloads(host, "control-ui.chat.send")).toEqual(
expect.arrayContaining([
expect.objectContaining({
phase: "waiting-model",
sendState: "waiting-model",
}),
]),
);
await retryReconnectableQueuedChatSends(host);
expect(request).not.toHaveBeenCalled();
@@ -2213,6 +2223,8 @@ describe("handleSendChat", () => {
client: null,
connected: false,
chatMessage: "send after reconnect",
eventLogBuffer: [],
tab: "debug",
});
await handleSendChat(host);
@@ -2226,6 +2238,14 @@ describe("handleSendChat", () => {
sessionKey: "agent:main",
});
expect(host.chatQueue[0]?.sendRunId).toEqual(expect.any(String));
expect(eventPayloads(host, "control-ui.chat.send")).toEqual(
expect.arrayContaining([
expect.objectContaining({
phase: "waiting-reconnect",
sendState: "waiting-reconnect",
}),
]),
);
});
it("replays queued global sends under the originally selected agent", async () => {

View File

@@ -442,6 +442,9 @@ function enqueuePendingSendMessage(
};
host.chatQueue = [...host.chatQueue, pending];
recordChatSendTiming(host, pending, "pending-visible", submittedAtMs);
if (sendState === "waiting-model" || sendState === "waiting-reconnect") {
recordChatSendTiming(host, pending, sendState, submittedAtMs);
}
schedulePendingSendPaintTiming(host, pending, submittedAtMs);
scheduleChatScroll(host as unknown as Parameters<typeof scheduleChatScroll>[0], true, false, {
source: "manual",