Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion apps/web/src/components/CommandPalette.browser.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe("CommandPalette open intents", () => {
await expect.element(input).toHaveValue("acme");
});

it("opens a searched project's latest listed thread, not a newer subagent", async () => {
it("opens a searched project's latest listed thread, not a newer subagent or parked thread", async () => {
const environmentId = EnvironmentId.make("local");
const projectId = ProjectId.make("acme");
const parentId = ThreadId.make("parent");
Expand Down Expand Up @@ -82,6 +82,20 @@ describe("CommandPalette open intents", () => {
relationshipToParent: "subagent",
},
}),
makeThreadFixture({
id: ThreadId.make("settled"),
environmentId,
projectId,
latestUserMessageAt: "2026-03-04T00:00:00.000Z",
settledOverride: "settled",
}),
makeThreadFixture({
id: ThreadId.make("snoozed"),
environmentId,
projectId,
latestUserMessageAt: "2026-03-05T00:00:00.000Z",
snoozedUntil: "2999-01-01T00:00:00.000Z",
}),
],
});
await using screen = await render(<CommandPalette>{null}</CommandPalette>);
Expand Down
11 changes: 9 additions & 2 deletions apps/web/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ import {
} from "../commandPaletteStore";
import { PULL_REQUESTS_PANEL_REF, useRightPanelStore } from "../rightPanelStore";
import { getLatestThreadForProject, sortThreads } from "@t3tools/client-runtime/state/thread-sort";
import { effectiveSnoozed } from "@t3tools/client-runtime/state/thread-settled";
import {
cn,
getLocalFileManagerName,
Expand Down Expand Up @@ -784,17 +785,23 @@ function OpenCommandPaletteDialog(props: {
),
)
: null;
// oxlint-disable-next-line react/purity -- runs in an event handler (oxc#27309)
const now = new Date().toISOString();
// Settled and snoozed threads are parked, so opening a project never lands on one.
const openableThreads = threads.filter(
(thread) => thread.settledOverride !== "settled" && !effectiveSnoozed(thread, { now }),
);
const latestThread = groupedProjectKeys
? (sortThreads(
threads.filter(
openableThreads.filter(
(thread) =>
thread.archivedAt === null &&
groupedProjectKeys.has(`${thread.environmentId}:${thread.projectId}`),
),
clientSettings.sidebarThreadSortOrder,
)[0] ?? null)
: getLatestThreadForProject(
threads.filter((thread) => thread.environmentId === project.environmentId),
openableThreads.filter((thread) => thread.environmentId === project.environmentId),
project.id,
clientSettings.sidebarThreadSortOrder,
);
Expand Down
Loading