Skip to content

Commit 81df733

Browse files
fix(web): opening a project from the command palette skips settled and snoozed threads (#31894)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
1 parent 5b5f1bc commit 81df733

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎apps/web/src/components/CommandPalette.browser.test.tsx‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe("CommandPalette open intents", () => {
138138
await expect.element(input).toHaveValue("acme");
139139
});
140140

141-
it("opens a searched project's latest listed thread, not a newer subagent or delegated task", async () => {
141+
it("opens a searched project's latest listed thread, not a newer subagent, delegated task, or parked thread", async () => {
142142
const environmentId = EnvironmentId.make("local");
143143
const projectId = ProjectId.make("acme");
144144
const parentId = ThreadId.make("parent");
@@ -182,6 +182,20 @@ describe("CommandPalette open intents", () => {
182182
projectId,
183183
latestUserMessageAt: "2026-03-04T00:00:00.000Z",
184184
}),
185+
makeThreadFixture({
186+
id: ThreadId.make("settled"),
187+
environmentId,
188+
projectId,
189+
latestUserMessageAt: "2026-03-05T00:00:00.000Z",
190+
settledOverride: "settled",
191+
}),
192+
makeThreadFixture({
193+
id: ThreadId.make("snoozed"),
194+
environmentId,
195+
projectId,
196+
latestUserMessageAt: "2026-03-06T00:00:00.000Z",
197+
snoozedUntil: "2999-01-01T00:00:00.000Z",
198+
}),
185199
],
186200
});
187201
await using screen = await render(<CommandPalette>{null}</CommandPalette>);

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ import {
178178
useRightPanelStore,
179179
} from "../rightPanelStore";
180180
import { getLatestThreadForProject, sortThreads } from "@t3tools/client-runtime/state/thread-sort";
181+
import { effectiveSnoozed } from "@t3tools/client-runtime/state/thread-settled";
181182
import {
182183
cn,
183184
getLocalFileManagerName,
@@ -816,17 +817,22 @@ function OpenCommandPaletteDialog(props: {
816817
),
817818
)
818819
: null;
820+
// oxlint-disable-next-line react/purity -- runs in an event handler (oxc#27309)
821+
const now = new Date().toISOString();
822+
const openableThreads = threads.filter(
823+
(thread) => thread.settledOverride !== "settled" && !effectiveSnoozed(thread, { now }),
824+
);
819825
const latestThread = groupedProjectKeys
820826
? (sortThreads(
821-
threads.filter(
827+
openableThreads.filter(
822828
(thread) =>
823829
thread.archivedAt === null &&
824830
groupedProjectKeys.has(`${thread.environmentId}:${thread.projectId}`),
825831
),
826832
clientSettings.sidebarThreadSortOrder,
827833
)[0] ?? null)
828834
: getLatestThreadForProject(
829-
threads.filter((thread) => thread.environmentId === project.environmentId),
835+
openableThreads.filter((thread) => thread.environmentId === project.environmentId),
830836
project.id,
831837
clientSettings.sidebarThreadSortOrder,
832838
);

0 commit comments

Comments
 (0)