Skip to content

Commit 8df4a0d

Browse files
refactor(client-runtime): search activity reuses the thread sort timestamp
AI-assisted; verified with the tests and tools listed above.
1 parent 85b0276 commit 8df4a0d

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,7 @@ function buildThreadSearchSubject(
246246
projectTitle: string | null | undefined,
247247
environmentLabel: string | null | undefined,
248248
): ThreadSearchSubject {
249-
// What the user wrote, not agent wakes or task notices in the user role. A
250-
// thread the user never wrote in counts from its creation; an older server
251-
// omits the field, so the latest user-role message stands in.
252-
const authored = thread.latestUserAuthoredMessageAt;
253-
const activityAt =
254-
authored === undefined
255-
? getThreadSortTimestamp(thread, "updated_at")
256-
: Date.parse(authored ?? thread.createdAt);
249+
const activityAt = getThreadSortTimestamp(thread, "updated_at");
257250
const localOpenedAt = localThreadOpens.get(`${thread.environmentId}:${thread.id}`) ?? 0;
258251
return {
259252
id: thread.id,

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import {
1313
type ThreadSortInput,
1414
} from "./threadSort.ts";
1515

16-
type TestThread = { readonly id: string } & ThreadSortInput & {
17-
readonly latestUserAuthoredMessageAt?: string | null;
18-
};
16+
type TestThread = { readonly id: string } & ThreadSortInput;
1917

2018
function makeThread(overrides: Partial<TestThread> = {}): TestThread {
2119
return {

0 commit comments

Comments
 (0)