fix: preserve session thread ids in chat session snapshots

This commit is contained in:
Tak Hoffman
2026-03-27 20:12:57 -05:00
parent 53861607f6
commit 627d6c80f2
4 changed files with 5 additions and 0 deletions

View File

@@ -764,6 +764,7 @@ describe("agent event handler", () => {
totalTokensFresh: true,
contextTokens: 21,
estimatedCostUsd: 0.12,
lastThreadId: 42,
status: "running",
startedAt: 900,
runtimeMs: 750,
@@ -805,6 +806,7 @@ describe("agent event handler", () => {
totalTokensFresh: true,
contextTokens: 21,
estimatedCostUsd: 0.12,
lastThreadId: 42,
}),
new Set(["conn-session"]),
{ dropIfSlow: true },

View File

@@ -511,6 +511,7 @@ export function createAgentEventHandler({
lastChannel: row?.lastChannel,
lastTo: row?.lastTo,
lastAccountId: row?.lastAccountId,
lastThreadId: row?.lastThreadId,
totalTokens: row?.totalTokens,
totalTokensFresh: row?.totalTokensFresh,
contextTokens: row?.contextTokens,

View File

@@ -1234,6 +1234,7 @@ export function buildGatewaySessionRow(params: {
lastChannel: deliveryFields.lastChannel ?? entry?.lastChannel,
lastTo: deliveryFields.lastTo ?? entry?.lastTo,
lastAccountId: deliveryFields.lastAccountId ?? entry?.lastAccountId,
lastThreadId: deliveryFields.lastThreadId ?? entry?.lastThreadId,
};
}

View File

@@ -58,6 +58,7 @@ export type GatewaySessionRow = {
lastChannel?: SessionEntry["lastChannel"];
lastTo?: string;
lastAccountId?: string;
lastThreadId?: SessionEntry["lastThreadId"];
};
export type GatewayAgentRow = SharedGatewayAgentRow;