Skip to content

Commit 07b6589

Browse files
nullStack65grok-4.7
andauthored
fix(web): show working, done, and needs-me on filter rows (#128)
* fix(web): show working, done, and needs-me on filter rows The sidebar filter menu showed one total on each inbox, sender, and environment row. Each row now shows three counts from one classifier: a run that is active or queued, finished work that is not settled, and a thread waiting on a person. Settled threads count in none. The menu reads threads already loaded. Model: grok-4.7 Task: implementation Agent: Codex Lane: magpie Harness: t3/codex Model-family: Grok Model-generation: 4.7 Skills-SHA: installed sha256 linear-company-ops 5dde849d07b26ca18d165a72ade4c6423687110f43d2f1ecf15865ace9fbc7b0, github-repository-ops a1bc3a59cb56aa7db009c844fdda23bd96296e1da3be530b0e4a54fa7f29e958; source commit unknown Co-Authored-By: grok-4.7 <noreply@x.ai> * fix(web): use the text-3xs token for filter counts Model: grok-4.7 Task: implementation Agent: Codex Lane: magpie Harness: t3/codex Model-family: Grok Model-generation: 4.7 Skills-SHA: installed sha256 linear-company-ops 5dde849d07b26ca18d165a72ade4c6423687110f43d2f1ecf15865ace9fbc7b0, github-repository-ops a1bc3a59cb56aa7db009c844fdda23bd96296e1da3be530b0e4a54fa7f29e958; source commit unknown Co-Authored-By: grok-4.7 <noreply@x.ai> * fix(web): count parked background work as working A thread held by awaited background work has an idle runtime and a finished run. The sidebar Working shelf already treats that as working, so the filter counts do too, even when the inbox also asks for action. Model: grok-4.7 Task: implementation Agent: Codex Lane: magpie Harness: t3/codex Model-family: Grok Model-generation: 4.7 Skills-SHA: installed sha256 linear-company-ops 5dde849d07b26ca18d165a72ade4c6423687110f43d2f1ecf15865ace9fbc7b0, github-repository-ops a1bc3a59cb56aa7db009c844fdda23bd96296e1da3be530b0e4a54fa7f29e958; source commit unknown Co-Authored-By: grok-4.7 <noreply@x.ai> --------- Co-authored-by: grok-4.7 <noreply@x.ai>
1 parent 12cf9bc commit 07b6589

3 files changed

Lines changed: 303 additions & 25 deletions

File tree

‎apps/web/src/components/sidebar/SidebarThreadFilterMenu.tsx‎

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ import {
2828
import { SidebarHeaderIconButton } from "./SidebarThreadHeader";
2929
import {
3030
changedThreadListFilters,
31+
EMPTY_THREAD_LIST_FILTER_BUCKETS,
3132
inboxMenuOrder,
3233
threadListFilterCounts,
3334
threadListFilterOf,
3435
toggleFilterOption,
3536
toggleHiddenEnvironment,
3637
type ThreadListFilter,
38+
type ThreadListFilterBucketCounts,
3739
} from "./threadListFilter.logic";
3840

3941
const INBOX_LABELS: Record<InboxChoice, string> = {
@@ -114,7 +116,7 @@ function SidebarThreadFilterOptions<T extends CountedThread>({
114116
isChanged: boolean;
115117
}) {
116118
const connectedEnvironmentIds = useConnectedEnvironmentIds();
117-
const counts = threadListFilterCounts(countedThreads(), filter, attributionOf);
119+
const counts = threadListFilterCounts(countedThreads(), filter, attributionOf, owner);
118120
const shownAttributions = THREAD_ATTRIBUTIONS.filter(
119121
(from) => !filter.hiddenAttributions.includes(from),
120122
);
@@ -130,13 +132,13 @@ function SidebarThreadFilterOptions<T extends CountedThread>({
130132
{inboxOrder.map((inbox) => {
131133
const checked = filter.inboxes.includes(inbox);
132134
const isLast = checked && filter.inboxes.length === 1;
133-
const count = counts.inboxes.get(inbox) ?? 0;
135+
const count = counts.inboxes.get(inbox) ?? EMPTY_THREAD_LIST_FILTER_BUCKETS;
134136
return (
135137
<MenuCheckboxItem
136138
key={inbox}
137139
checked={checked}
138140
disabled={isLast}
139-
aria-label={`${INBOX_LABELS[inbox]}, ${count} active${isLast ? LAST_OPTION_NOTE : ""}`}
141+
aria-label={`${INBOX_LABELS[inbox]}, ${stateCountPhrase(count)}${isLast ? LAST_OPTION_NOTE : ""}`}
140142
onCheckedChange={() =>
141143
void updateClientSettings({
142144
founderInboxFilter: toggleFilterOption(filter.inboxes, inbox, inboxOrder),
@@ -154,13 +156,13 @@ function SidebarThreadFilterOptions<T extends CountedThread>({
154156
{THREAD_ATTRIBUTIONS.map((from) => {
155157
const checked = shownAttributions.includes(from);
156158
const isLast = checked && shownAttributions.length === 1;
157-
const count = counts.from.get(from) ?? 0;
159+
const count = counts.from.get(from) ?? EMPTY_THREAD_LIST_FILTER_BUCKETS;
158160
return (
159161
<MenuCheckboxItem
160162
key={from}
161163
checked={checked}
162164
disabled={isLast}
163-
aria-label={`From ${THREAD_ATTRIBUTION_LABELS[from]}, ${count} active${isLast ? LAST_OPTION_NOTE : ""}`}
165+
aria-label={`From ${THREAD_ATTRIBUTION_LABELS[from]}, ${stateCountPhrase(count)}${isLast ? LAST_OPTION_NOTE : ""}`}
164166
onCheckedChange={() => {
165167
const shown = toggleFilterOption(shownAttributions, from, THREAD_ATTRIBUTIONS);
166168
void updateClientSettings({
@@ -184,13 +186,15 @@ function SidebarThreadFilterOptions<T extends CountedThread>({
184186
const checked = shownEnvironmentIds.includes(environment.environmentId);
185187
const isLast = checked && shownEnvironmentIds.length === 1;
186188
const connected = connectedEnvironmentIds.includes(environment.environmentId);
187-
const count = counts.environments.get(environment.environmentId) ?? 0;
189+
const count =
190+
counts.environments.get(environment.environmentId) ??
191+
EMPTY_THREAD_LIST_FILTER_BUCKETS;
188192
return (
189193
<MenuCheckboxItem
190194
key={environment.environmentId}
191195
checked={checked}
192196
disabled={isLast}
193-
aria-label={`${environment.label}, ${connected ? "connected" : "not connected"}, ${count} active${isLast ? LAST_OPTION_NOTE : ""}`}
197+
aria-label={`${environment.label}, ${connected ? "connected" : "not connected"}, ${stateCountPhrase(count)}${isLast ? LAST_OPTION_NOTE : ""}`}
194198
onCheckedChange={() =>
195199
void updateClientSettings({
196200
sidebarHiddenEnvironmentIds: toggleHiddenEnvironment(
@@ -240,20 +244,52 @@ function SidebarThreadFilterOptions<T extends CountedThread>({
240244
);
241245
}
242246

247+
const STATE_COUNT_COLUMNS = [
248+
["working", "working"],
249+
["done", "done"],
250+
["needsMe", "needs me"],
251+
] as const satisfies ReadonlyArray<readonly [keyof ThreadListFilterBucketCounts, string]>;
252+
253+
function stateCountPhrase(counts: ThreadListFilterBucketCounts) {
254+
return STATE_COUNT_COLUMNS.map(([key, label]) => `${counts[key]} ${label}`).join(", ");
255+
}
256+
243257
function FilterOptionRow({
244258
label,
245259
count,
246260
indicator,
247261
}: {
248262
label: string;
249-
count: number;
263+
count: ThreadListFilterBucketCounts;
250264
indicator?: ReactNode;
251265
}) {
252266
return (
253267
<span className="flex min-w-0 items-center gap-2">
254268
{indicator}
255269
<span className="min-w-0 flex-1 truncate">{label}</span>
256-
<span className="shrink-0 text-muted-foreground text-xs tabular-nums">{count}</span>
270+
<span className="grid shrink-0 grid-cols-3 gap-x-1.5 text-center">
271+
{STATE_COUNT_COLUMNS.map(([key, name]) => {
272+
const value = count[key];
273+
return (
274+
<span
275+
key={key}
276+
className={cn(
277+
"text-3xs leading-tight tabular-nums",
278+
value === 0
279+
? "text-muted-foreground/40"
280+
: key === "working"
281+
? "text-info-foreground"
282+
: key === "done"
283+
? "text-success-foreground"
284+
: "text-warning-foreground",
285+
)}
286+
>
287+
<span className="block">{value}</span>
288+
<span className="block">{name}</span>
289+
</span>
290+
);
291+
})}
292+
</span>
257293
</span>
258294
);
259295
}

‎apps/web/src/components/sidebar/threadListFilter.logic.test.ts‎

Lines changed: 159 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
changedThreadListFilters,
66
inboxMenuOrder,
77
matchesThreadListFilter,
8+
threadListFilterBucket,
89
threadListFilterCounts,
910
threadListFilterOf,
1011
toggleFilterOption,
@@ -42,21 +43,31 @@ describe("thread list filter", () => {
4243
});
4344

4445
it("counts each section within the other sections' selection", () => {
46+
const finished = { runtime: { status: "completed" }, latestRun: { status: "completed" } };
4547
const threads = [
46-
{ ...thread(laptop, kameron), from: "kameron" as const },
47-
{ ...thread(laptop, bot), from: "kameron-agents" as const },
48-
{ ...thread(crown, jeff), from: "jeff" as const },
49-
{ ...thread(crown, kameron), from: "kameron" as const },
50-
{ ...thread(laptop, kameron), from: "unknown" as const },
48+
{ ...thread(laptop, kameron), ...finished, from: "kameron" as const },
49+
{ ...thread(laptop, bot), ...finished, from: "kameron-agents" as const },
50+
{ ...thread(crown, jeff), ...finished, from: "jeff" as const },
51+
{ ...thread(crown, kameron), ...finished, from: "kameron" as const },
52+
{ ...thread(laptop, kameron), ...finished, from: "unknown" as const },
5153
];
5254
const counts = threadListFilterCounts(
5355
threads,
5456
{ inboxes: ["kameron"], hiddenEnvironmentIds: [crown], hiddenAttributions: ["unknown"] },
5557
(candidate) => candidate.from,
5658
);
57-
expect(Object.fromEntries(counts.inboxes)).toEqual({ kameron: 1, agents: 1 });
58-
expect(Object.fromEntries(counts.environments)).toEqual({ laptop: 1, crown: 1 });
59-
expect(Object.fromEntries(counts.from)).toEqual({ kameron: 1, unknown: 1 });
59+
expect(Object.fromEntries(counts.inboxes)).toEqual({
60+
kameron: { working: 0, done: 1, needsMe: 0 },
61+
agents: { working: 0, done: 1, needsMe: 0 },
62+
});
63+
expect(Object.fromEntries(counts.environments)).toEqual({
64+
laptop: { working: 0, done: 1, needsMe: 0 },
65+
crown: { working: 0, done: 1, needsMe: 0 },
66+
});
67+
expect(Object.fromEntries(counts.from)).toEqual({
68+
kameron: { working: 0, done: 1, needsMe: 0 },
69+
unknown: { working: 0, done: 1, needsMe: 0 },
70+
});
6071
expect(
6172
matchesThreadListFilter(
6273
threads[4]!,
@@ -107,4 +118,144 @@ describe("thread list filter", () => {
107118
expect(toggleHiddenEnvironment([offline, crown], crown, [laptop, crown])).toEqual([offline]);
108119
expect(toggleHiddenEnvironment([crown], laptop, [laptop, crown])).toEqual([crown]);
109120
});
121+
122+
it("buckets working, done and needs-me the same way on every row", () => {
123+
const finished = { runtime: { status: "completed" }, latestRun: { status: "completed" } };
124+
const quiet = {
125+
...thread(laptop, kameron),
126+
source: {
127+
inbox: makeThreadInbox({
128+
actor: kameron,
129+
routing: { attentionKind: "FYI", reason: "fyi" },
130+
}),
131+
},
132+
};
133+
const asked = {
134+
...quiet,
135+
source: {
136+
inbox: {
137+
...quiet.source.inbox,
138+
decisionRequest: {
139+
founder: "kameron" as const,
140+
kind: "decision" as const,
141+
question: "Ship it?",
142+
requestedAt: "2026-11-20T00:00:00.000Z",
143+
},
144+
},
145+
},
146+
};
147+
const attention = {
148+
...thread(laptop, bot),
149+
...finished,
150+
source: {
151+
inbox: makeThreadInbox({
152+
actor: bot,
153+
routing: {
154+
owner: "kameron",
155+
assignee: { kind: "human", id: "kameron" },
156+
audience: "kameron",
157+
attentionKind: "action",
158+
reason: "review",
159+
},
160+
}),
161+
},
162+
};
163+
const otherAsk = {
164+
...thread(laptop, jeff),
165+
...finished,
166+
source: {
167+
inbox: {
168+
...makeThreadInbox({
169+
actor: jeff,
170+
routing: { attentionKind: "FYI", reason: "fyi" },
171+
}),
172+
decisionRequest: {
173+
founder: "jeff" as const,
174+
kind: "decision" as const,
175+
question: "Your call?",
176+
requestedAt: "2026-11-20T00:00:00.000Z",
177+
},
178+
},
179+
},
180+
};
181+
const fixtures = {
182+
queued: {
183+
...quiet,
184+
runtime: { status: "queued" },
185+
latestRun: { status: "queued" },
186+
},
187+
running: {
188+
...quiet,
189+
runtime: { status: "running" },
190+
latestRun: { status: "running" },
191+
},
192+
done: { ...quiet, ...finished },
193+
failed: {
194+
...quiet,
195+
runtime: { status: "failed" },
196+
latestRun: { status: "failed" },
197+
},
198+
approval: {
199+
...quiet,
200+
runtime: { status: "running" },
201+
latestRun: { status: "running" },
202+
hasPendingApprovals: true,
203+
},
204+
question: {
205+
...quiet,
206+
runtime: { status: "waiting" },
207+
latestRun: { status: "waiting" },
208+
hasPendingUserInput: true,
209+
},
210+
decision: { ...asked, ...finished },
211+
attention,
212+
parked: {
213+
...quiet,
214+
runtime: { status: "idle" },
215+
latestRun: { status: "completed" },
216+
},
217+
parkedAttention: {
218+
...attention,
219+
runtime: { status: "idle" },
220+
latestRun: { status: "completed" },
221+
},
222+
settled: { ...quiet, ...finished, settledOverride: "settled" as const },
223+
otherFounder: otherAsk,
224+
unstarted: quiet,
225+
};
226+
expect(threadListFilterBucket(fixtures.queued, "kameron")).toBe("working");
227+
expect(threadListFilterBucket(fixtures.running, "kameron")).toBe("working");
228+
expect(threadListFilterBucket(fixtures.done, "kameron")).toBe("done");
229+
expect(threadListFilterBucket(fixtures.failed, "kameron")).toBe("done");
230+
expect(threadListFilterBucket(fixtures.approval, "kameron")).toBe("needsMe");
231+
expect(threadListFilterBucket(fixtures.question, "kameron")).toBe("needsMe");
232+
expect(threadListFilterBucket(fixtures.decision, "kameron")).toBe("needsMe");
233+
expect(threadListFilterBucket(fixtures.attention, "kameron")).toBe("needsMe");
234+
expect(threadListFilterBucket(fixtures.parked, "kameron")).toBe("working");
235+
expect(threadListFilterBucket(fixtures.parkedAttention, "kameron")).toBe("working");
236+
expect(threadListFilterBucket(fixtures.settled, "kameron")).toBeNull();
237+
expect(threadListFilterBucket(fixtures.otherFounder, "kameron")).toBe("done");
238+
expect(threadListFilterBucket(fixtures.unstarted, "kameron")).toBeNull();
239+
240+
const threads = Object.values(fixtures).map((candidate) => ({
241+
...candidate,
242+
from: "kameron" as const,
243+
}));
244+
const counts = threadListFilterCounts(
245+
threads,
246+
{
247+
inboxes: ["kameron", "jeff", "agents", "shared"],
248+
hiddenEnvironmentIds: [],
249+
hiddenAttributions: [],
250+
},
251+
(candidate) => candidate.from,
252+
"kameron",
253+
);
254+
const kameronRow = { working: 4, done: 2, needsMe: 4 };
255+
const everyRow = { working: 4, done: 3, needsMe: 4 };
256+
expect(counts.inboxes.get("kameron")).toEqual(kameronRow);
257+
expect(counts.inboxes.get("jeff")).toEqual({ working: 0, done: 1, needsMe: 0 });
258+
expect(counts.environments.get(laptop)).toEqual(everyRow);
259+
expect(counts.from.get("kameron")).toEqual(everyRow);
260+
});
110261
});

0 commit comments

Comments
 (0)