Skip to content

Commit 74d120a

Browse files
committed
fix(client): clear title regeneration on archive
1 parent a4d16a9 commit 74d120a

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎packages/client-runtime/src/state/threadReducer.test.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vite-plus/test";
22

33
import {
44
CheckpointRef,
5+
CommandId,
56
EventId,
67
MessageId,
78
ProjectId,
@@ -123,8 +124,15 @@ describe("applyThreadDetailEvent", () => {
123124
});
124125

125126
describe("thread.archived / thread.unarchived", () => {
126-
it("sets archivedAt", () => {
127-
const result = applyThreadDetailEvent(baseThread, {
127+
it("sets archivedAt and clears title regeneration", () => {
128+
const regeneratingThread: OrchestrationThread = {
129+
...baseThread,
130+
titleRegeneration: {
131+
requestId: CommandId.make("regenerate-title"),
132+
startedAt: "2026-04-01T02:00:00.000Z",
133+
},
134+
};
135+
const result = applyThreadDetailEvent(regeneratingThread, {
128136
...baseEventFields,
129137
sequence: 3,
130138
occurredAt: "2026-04-01T03:00:00.000Z",
@@ -141,6 +149,7 @@ describe("applyThreadDetailEvent", () => {
141149
expect(result.kind).toBe("updated");
142150
if (result.kind === "updated") {
143151
expect(result.thread.archivedAt).toBe("2026-04-01T03:00:00.000Z");
152+
expect(result.thread.titleRegeneration).toBeNull();
144153
}
145154
});
146155

‎packages/client-runtime/src/state/threadReducer.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export function applyThreadDetailEvent(
9494
thread: {
9595
...thread,
9696
archivedAt: event.payload.archivedAt,
97+
titleRegeneration: null,
9798
updatedAt: event.payload.updatedAt,
9899
},
99100
};

0 commit comments

Comments
 (0)