From 27be43e65605519f1f384970ac82c3a5375ecbac Mon Sep 17 00:00:00 2001 From: Onkarj012 Date: Sun, 15 Nov 2026 23:47:57 +0530 Subject: [PATCH 1/2] fix(clients): command palette skips tasks shown under their parent The sidebar and mobile home list hide a task a linked environment runs for a listed thread and show it under that thread. The web and mobile command palettes only checked the subagent marker, so the same task showed up there as an ordinary thread. Both palettes now use the same delegatedUnderParent check as the sidebar. A task whose parent is gone, archived, or on a disabled environment stays listed, as it does in the sidebar. Co-Authored-By: Claude Opus 5.5 --- .../src/features/keyboard/CommandPalette.tsx | 16 ++++++++++++++-- apps/mobile/src/state/entities.ts | 5 +++++ .../src/components/CommandPalette.logic.test.ts | 8 +++++++- apps/web/src/components/CommandPalette.logic.ts | 13 +++++++++++-- .../src/components/CommandPaletteThreadItems.tsx | 4 +++- apps/web/src/components/Sidebar.logic.ts | 2 +- 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/apps/mobile/src/features/keyboard/CommandPalette.tsx b/apps/mobile/src/features/keyboard/CommandPalette.tsx index 38b83e4c56bad..9b8cd114fc8ba 100644 --- a/apps/mobile/src/features/keyboard/CommandPalette.tsx +++ b/apps/mobile/src/features/keyboard/CommandPalette.tsx @@ -9,7 +9,8 @@ import { type EnvironmentThreadSearchMatch, type ShownOrder, } from "@t3tools/client-runtime/state/thread-search"; -import { isListedThreadLineage, THREAD_JUMP_KEYBINDING_COMMANDS } from "@t3tools/contracts"; +import { isShownUnderParent } from "@t3tools/client-runtime/state/threads"; +import { THREAD_JUMP_KEYBINDING_COMMANDS } from "@t3tools/contracts"; import { foldSearchQuery, PALETTE_MESSAGE_LIMIT, @@ -43,6 +44,7 @@ import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities"; import { useNativeLayoutMetrics } from "../../native/native-layout-metrics"; import { T3KeyboardCommands } from "../../native/T3KeyboardCommands"; import { + useDelegatedUnderParent, useProjects, useServerConfigs, useThreadShell, @@ -227,6 +229,7 @@ export function CommandPalette(props: { const runCommand = props.onCommand; const projects = useProjects(); const threads = useVisibleThreadShells(); + const delegatedUnderParent = useDelegatedUnderParent(); const activeThreadRef = parseActiveThreadPath(props.pathname); const activeThread = useThreadShell(activeThreadRef); const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false }); @@ -426,7 +429,15 @@ export function CommandPalette(props: { }), })); const threadItems: CommandPaletteItem[] = threads - .filter((thread) => thread.archivedAt === null && isListedThreadLineage(thread.lineage)) + .filter( + (thread) => + thread.archivedAt === null && + !isShownUnderParent( + { environmentId: thread.environmentId, threadId: thread.id }, + thread.lineage, + delegatedUnderParent, + ), + ) .map((thread) => { const project = projectByKey.get(scopedProjectKey(thread.environmentId, thread.projectId)); const environment = @@ -473,6 +484,7 @@ export function CommandPalette(props: { selectDetail, startTriage, threads, + delegatedUnderParent, triageEnvironmentId, ]); const rankedMessageKeys = useMemo(() => { diff --git a/apps/mobile/src/state/entities.ts b/apps/mobile/src/state/entities.ts index c9d1834a78bdb..16bfe0be755ab 100644 --- a/apps/mobile/src/state/entities.ts +++ b/apps/mobile/src/state/entities.ts @@ -200,6 +200,11 @@ export function useVisibleThreadShells(): ReadonlyArray return useAtomValue(environmentThreadShells.visibleThreadShellsAtom); } +/** Tasks linked environments run for a listed thread, by thread key; lists show them under it. */ +export function useDelegatedUnderParent(): ReadonlySet { + return useAtomValue(environmentThreadShells.delegatedUnderParentAtom); +} + export function useNavigationThreadShells(): ReadonlyArray { return useAtomValue(environmentThreadShells.navigationThreadShellsAtom); } diff --git a/apps/web/src/components/CommandPalette.logic.test.ts b/apps/web/src/components/CommandPalette.logic.test.ts index afb6dfbea255d..8ba78e2639fdc 100644 --- a/apps/web/src/components/CommandPalette.logic.test.ts +++ b/apps/web/src/components/CommandPalette.logic.test.ts @@ -1,3 +1,4 @@ +import { threadKey } from "@t3tools/client-runtime/state/entities"; import { describe, expect, it, vi } from "vite-plus/test"; import { EnvironmentId, ProjectId, ProviderInstanceId, ThreadId } from "@t3tools/contracts"; import type { Thread } from "../types"; @@ -666,11 +667,13 @@ describe("buildThreadActionItems", () => { ]); }); - it("hides subagent threads but keeps forks", () => { + it("hides subagent threads and tasks shown under their parent but keeps forks", () => { const parentId = ThreadId.make("parent"); + const delegatedId = ThreadId.make("delegated"); const items = buildThreadActionItems({ threads: [ makeThread({ id: parentId, title: "Parent" }), + makeThread({ id: delegatedId, title: "Delegated task" }), makeThread({ id: ThreadId.make("subagent"), title: "Subagent", @@ -690,6 +693,9 @@ describe("buildThreadActionItems", () => { }, }), ], + delegatedUnderParent: new Set([ + threadKey({ environmentId: LOCAL_ENVIRONMENT_ID, threadId: delegatedId }), + ]), projectByKey: new Map(), icon: null, runThread: async () => undefined, diff --git a/apps/web/src/components/CommandPalette.logic.ts b/apps/web/src/components/CommandPalette.logic.ts index 407e9a5e35981..299bac94ce10d 100644 --- a/apps/web/src/components/CommandPalette.logic.ts +++ b/apps/web/src/components/CommandPalette.logic.ts @@ -33,7 +33,7 @@ import { filterFilesystemBrowseEntries } from "@t3tools/client-runtime/state/fil import { type ReactNode } from "react"; import { formatRelativeTimeLabel } from "../timestampFormat"; import { type Project, type SidebarThreadSummary, type Thread } from "../types"; -import { isSidebarHiddenThread } from "./Sidebar.logic"; +import { isShownUnderParent } from "@t3tools/client-runtime/state/threads"; export const RECENT_THREAD_LIMIT = 12; export const ITEM_ICON_CLASS = "size-4 text-icon-muted"; @@ -436,10 +436,19 @@ export function buildThreadActionItems Promise; /** Makes the environment searchable; pass it only with two or more environments. */ environmentLabelOf?: (thread: TThread) => string | null; + /** Tasks linked environments run for a listed thread; they open from under that thread. */ + delegatedUnderParent?: ReadonlySet; }): CommandPaletteActionItem[] { + const delegatedUnderParent = input.delegatedUnderParent ?? new Set(); // Callers order these: recents by last use, search results by rank. const visibleThreads = input.threads.filter( - (thread) => thread.archivedAt === null && !isSidebarHiddenThread(thread), + (thread) => + thread.archivedAt === null && + !isShownUnderParent( + { environmentId: thread.environmentId, threadId: thread.id }, + thread.lineage, + delegatedUnderParent, + ), ); return visibleThreads.map((thread) => { diff --git a/apps/web/src/components/CommandPaletteThreadItems.tsx b/apps/web/src/components/CommandPaletteThreadItems.tsx index ddccc1c3a54e1..12a42e250f45d 100644 --- a/apps/web/src/components/CommandPaletteThreadItems.tsx +++ b/apps/web/src/components/CommandPaletteThreadItems.tsx @@ -23,7 +23,7 @@ import { deriveProviderInstanceEntries, type ProviderInstanceEntry, } from "../providerInstances"; -import { useVisibleThreadShells } from "../state/entities"; +import { useDelegatedUnderParent, useVisibleThreadShells } from "../state/entities"; import { useEnvironmentProviders, useEnvironments, @@ -100,6 +100,7 @@ export function useCommandPaletteThreadItems(input: { const { activeThread, threadSearchQuery } = input; const navigate = useNavigate(); const threads = useVisibleThreadShells(); + const delegatedUnderParent = useDelegatedUnderParent(); const { projectEnvironmentLocationById } = useEnvironmentLookups(); const providerEntryByEnvironmentAndInstanceId = useProviderEntryByEnvironmentAndInstanceId(); const messageSearch = useConnectedThreadSearch(threadSearchQuery); @@ -111,6 +112,7 @@ export function useCommandPaletteThreadItems(input: { const { environments } = useEnvironments(); const threadItems = buildThreadActionItems({ threads, + delegatedUnderParent, ...(environments.length > 1 ? { environmentLabelOf: (thread: (typeof threads)[number]) => diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts index 8c0e678ff6672..5060c6ae879af 100644 --- a/apps/web/src/components/Sidebar.logic.ts +++ b/apps/web/src/components/Sidebar.logic.ts @@ -582,7 +582,7 @@ export async function deleteSelectedThreadEntries< return { deletedThreadKeys, firstFailure }; } -export function isSidebarHiddenThread(thread: Pick): boolean { +function isSidebarHiddenThread(thread: Pick): boolean { return !isListedThreadLineage(thread.lineage); } From 3260f0412ca12fa7a66996ae035f911ee436192f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sun, 15 Nov 2026 18:35:47 +0000 Subject: [PATCH 2/2] refactor(web): tidy palette delegated-task filter imports Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/CommandPalette.logic.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/CommandPalette.logic.ts b/apps/web/src/components/CommandPalette.logic.ts index 299bac94ce10d..2456ca357e178 100644 --- a/apps/web/src/components/CommandPalette.logic.ts +++ b/apps/web/src/components/CommandPalette.logic.ts @@ -30,12 +30,13 @@ import { THREAD_JUMP_KEYBINDING_COMMANDS, } from "@t3tools/contracts"; import { filterFilesystemBrowseEntries } from "@t3tools/client-runtime/state/filesystem"; +import { isShownUnderParent } from "@t3tools/client-runtime/state/threads"; import { type ReactNode } from "react"; import { formatRelativeTimeLabel } from "../timestampFormat"; import { type Project, type SidebarThreadSummary, type Thread } from "../types"; -import { isShownUnderParent } from "@t3tools/client-runtime/state/threads"; export const RECENT_THREAD_LIMIT = 12; +const NO_THREAD_KEYS: ReadonlySet = new Set(); export const ITEM_ICON_CLASS = "size-4 text-icon-muted"; export const ADDON_ICON_CLASS = "size-4"; @@ -439,7 +440,7 @@ export function buildThreadActionItems; }): CommandPaletteActionItem[] { - const delegatedUnderParent = input.delegatedUnderParent ?? new Set(); + const delegatedUnderParent = input.delegatedUnderParent ?? NO_THREAD_KEYS; // Callers order these: recents by last use, search results by rank. const visibleThreads = input.threads.filter( (thread) =>