Skip to content

Commit 4d2e387

Browse files
nullStack65claude
andcommitted
fix(web): inbox action threads stay in the active list while they work
A thread waiting on the viewing founder was moved into the collapsed Working shelf while its run was live, so it vanished from that founder's inbox view. staysActiveWhileWorking (next to founderInboxLane) keeps founder-lane "action" threads in the active list; other threads keep today's Working shelf behavior. Model: claude-sonnet-5-5 Task: fix Agent: claude-code Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 3032b60 commit 4d2e387

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { effectiveInboxView, matchesInboxView } from "@t3tools/contracts";
1+
import {
2+
effectiveInboxView,
3+
matchesInboxView,
4+
staysActiveWhileWorking,
5+
type InboxView,
6+
} from "@t3tools/contracts";
27
import { SidebarInboxBar } from "./sidebar/SidebarInboxBar";
38
import { threadRoutingUpdateFromMenuAction } from "./threadActionMenu.logic";
49
import { attachSidebarTree } from "../lib/sidebarTree";
@@ -362,6 +367,7 @@ interface SidebarThreadPartitionInput {
362367
readonly connectedEnvironmentIds: readonly EnvironmentId[];
363368
readonly optimisticDrop: SidebarOptimisticDrop | null;
364369
readonly workingShelfEnabled: boolean;
370+
readonly inboxView: InboxView;
365371
/** Boring mode: folders list active threads by the user's latest message. */
366372
readonly sortActiveBySend: boolean;
367373
// Snooze wakes, the queued-turn grace and the Working shelf's exit grace depend
@@ -453,6 +459,7 @@ function useSidebarThreads(input: {
453459
inboxReturns.subscribe,
454460
inboxReturns.getSnapshot,
455461
);
462+
const inboxView = useClientSettings(effectiveInboxView);
456463
const nowMinute = useNowMinute();
457464
// Minute-quantized clocks would delay second-precise snooze wakes by up to a minute.
458465
const snoozeWakeClock = useSnoozeWakeClock(threads);
@@ -492,6 +499,7 @@ function useSidebarThreads(input: {
492499
connectedEnvironmentIds,
493500
optimisticDrop,
494501
workingShelfEnabled,
502+
inboxView,
495503
sortActiveBySend: folderGroups !== null,
496504
clockKey: `${nowMinute}:${snoozeWakeClock}:${inboxReturnsVersion}`,
497505
});
@@ -627,6 +635,7 @@ function partitionSidebarThreads(input: SidebarThreadPartitionInput) {
627635
serverConfigs,
628636
optimisticDrop,
629637
workingShelfEnabled,
638+
inboxView,
630639
sortActiveBySend,
631640
} = input;
632641
const preciseNow = new Date().toISOString();
@@ -637,6 +646,7 @@ function partitionSidebarThreads(input: SidebarThreadPartitionInput) {
637646
const working: EnvironmentThreadShell[] = [];
638647
const inbox = (thread: EnvironmentThreadShell, manuallyMoved = false) =>
639648
workingShelfEnabled &&
649+
!staysActiveWhileWorking(thread.source.inbox, inboxView) &&
640650
(manuallyMoved ? isThreadWorking(thread) : inboxObservation.isWorking(thread))
641651
? working
642652
: active;

‎packages/contracts/src/threadInbox.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
effectiveInboxView,
1010
inboxOriginFor,
1111
founderInboxLane,
12+
staysActiveWhileWorking,
1213
compositeThreadKey,
1314
agentLaunchInboxRouting,
1415
agentLaunchInboxError,
@@ -299,3 +300,28 @@ it("keeps founder-owned agent-only children out of founder inboxes", () => {
299300
expect(matchesInboxView(assigned, "jeff")).toBe(true);
300301
expect(matchesInboxView(assigned, "kameron")).toBe(false);
301302
});
303+
304+
describe("staysActiveWhileWorking", () => {
305+
const actionForKameron = makeThreadInbox({
306+
actor: bot,
307+
routing: { assignee: kameron, reason: "review" },
308+
});
309+
310+
it("keeps a thread waiting on the viewing founder in the active list", () => {
311+
expect(founderInboxLane(actionForKameron, "kameron")).toBe("action");
312+
expect(staysActiveWhileWorking(actionForKameron, "kameron")).toBe(true);
313+
});
314+
315+
it("leaves other founders, other views and unclassified threads on the Working shelf", () => {
316+
expect(staysActiveWhileWorking(actionForKameron, "jeff")).toBe(false);
317+
expect(staysActiveWhileWorking(actionForKameron, "all")).toBe(false);
318+
expect(staysActiveWhileWorking(actionForKameron, "agents")).toBe(false);
319+
expect(staysActiveWhileWorking(undefined, "kameron")).toBe(false);
320+
});
321+
322+
it("does not hold FYI threads or agent-originated work with no reason active", () => {
323+
const fyi = routeThreadInbox(actionForKameron, { attentionKind: "FYI", reason: "review" });
324+
expect(staysActiveWhileWorking(fyi, "kameron")).toBe(false);
325+
expect(staysActiveWhileWorking(makeThreadInbox({ actor: bot }), "kameron")).toBe(false);
326+
});
327+
});

‎packages/contracts/src/threadInbox.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ export function founderInboxLane(inbox: ThreadInbox | null | undefined, founder:
224224
return inbox.reason === "fyi" && inbox.attentionKind === "action" ? "FYI" : inbox.attentionKind;
225225
}
226226

227+
/**
228+
* A thread waiting on the viewing founder stays in the active list while it works, so the
229+
* collapsed Working shelf cannot hide it from their inbox. Other views and lanes are unaffected.
230+
*/
231+
export function staysActiveWhileWorking(inbox: ThreadInbox | null | undefined, view: InboxView) {
232+
return (view === "kameron" || view === "jeff") && founderInboxLane(inbox, view) === "action";
233+
}
234+
227235
/** The chosen view, else the chosen founder's, else All so unclassified history stays visible. */
228236
export const effectiveInboxView = (settings: {
229237
readonly founderInboxView?: InboxView | undefined;

0 commit comments

Comments
 (0)