@devries-cameron20 / t3code Mirror · read-only / commits / 95d4da5a93
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 07:00 UTC

fix(clients): open a delegated child's approval on the environment it runs in (#28592)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

Rob Homewood committed Nov 1, 2026 at 21:56 UTC 95d4da5a932a6eb22b4d903fe88531461aa2029e
3 files changed +17 -8
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+1 -1
@@ -772,7 +772,7 @@ function ThreadDetailBody(
772 accessibilityLabel: `Open ${childInput.hasPendingApprovals ? "approval" : "question"} from ${childInput.title}`,
773 onPress: () => {
774 Keyboard.dismiss();
775 - openLinkedThread({ environmentId: props.environmentId, threadId: childInput.id });
775 + openLinkedThread({ environmentId: childInput.environmentId, threadId: childInput.id });
776 },
777 };
778 }
apps/web/src/components/chat/ThreadActivityBanners.tsx
+5 -3
@@ -1,4 +1,5 @@
1 import type {
2 + EnvironmentId,
3 OrchestrationV2PendingBackgroundTask,
4 OrchestrationV2ProviderGoal,
5 ThreadId,
@@ -34,7 +35,8 @@ import type { ThreadNowItem } from "./ThreadNow";
35 export function childInputNowItem(input: {
36 readonly childThreadInputs: ReadonlyArray<EnvironmentThreadShell>;
37 readonly parentAwaitingUser: boolean;
37 - readonly onOpenThread: (threadId: ThreadId) => void;
38 + // A task delegated to a linked environment lives there, not where the parent runs.
39 + readonly onOpenThread: (threadId: ThreadId, environmentId: EnvironmentId) => void;
40 }): (ThreadNowItem & { readonly waitingLabel: string }) | null {
41 const { childThreadInputs, onOpenThread } = input;
42 const first = childThreadInputs[0];
@@ -55,7 +57,7 @@ export function childInputNowItem(input: {
57 <Fragment key={child.id}>
58 {index > 0 ? " " : null}
59 <span className="whitespace-nowrap">
58 - <InlineButton tone="muted" onClick={() => onOpenThread(child.id)}>
60 + <InlineButton tone="muted" onClick={() => onOpenThread(child.id, child.environmentId)}>
61 {child.title}
62 </InlineButton>
63 {index < childThreadInputs.length - 1 ? "," : null}
@@ -63,7 +65,7 @@ export function childInputNowItem(input: {
65 </Fragment>
66 )),
67 actions: (
66 - <InlineButton onClick={() => onOpenThread(first.id)}>
68 + <InlineButton onClick={() => onOpenThread(first.id, first.environmentId)}>
69 {first.hasPendingApprovals ? "Open approval" : "Open question"}
70 </InlineButton>
71 ),
apps/web/src/components/chat/useThreadLifecycle.tsx
+11 -4
@@ -56,6 +56,7 @@ import { useEnvironmentScope } from "~/state/session";
56 import { threadEnvironment } from "../../state/threads";
57 import { vcsEnvironment } from "../../state/vcs";
58 import { useChildThreadInputs, readThreadShell, waitForThreadShell } from "../../state/entities";
59 +import { serverEnvironment } from "../../state/server";
60 import { environmentShell } from "../../state/shell";
61 import { ThreadStatusLine } from "./ThreadStatusLine";
62 import { formatRelativeTimeLabel } from "../../timestampFormat";
@@ -455,14 +456,20 @@ export function useThreadLifecycle(input: ThreadLifecycleInput) {
456 };
457 const handleStopBackgroundWorkStable = useStableCallback(handleStopBackgroundWork);
458 const openRelatedThreadGenerationRef = useRef(0);
458 - const onOpenRelatedThread = async (threadId: ThreadId) => {
459 + // A task delegated to a linked environment opens there; the default is this thread's own.
460 + const onOpenRelatedThread = async (
461 + threadId: ThreadId,
462 + threadEnvironmentId: EnvironmentId = environmentId,
463 + ) => {
464 const generation = ++openRelatedThreadGenerationRef.current;
460 - const threadRef = scopeThreadRef(environmentId, threadId);
465 + const threadRef = scopeThreadRef(threadEnvironmentId, threadId);
466 const isEnvironmentLive = () =>
462 - appAtomRegistry.get(environmentShell.stateValueAtom(environmentId)).status === "live";
467 + appAtomRegistry.get(environmentShell.stateValueAtom(threadEnvironmentId)).status === "live";
468 // The shell can leave idle subagent children out, so absence is not deletion there: the
469 // route decides from the thread's own detail.
465 - const shellOmitsChildren = serverConfig?.shellThreadFamilies === true;
470 + const shellOmitsChildren =
471 + appAtomRegistry.get(serverEnvironment.configValueAtom(threadEnvironmentId))
472 + ?.shellThreadFamilies === true;
473 // A just-launched child can reach this timeline before its shell syncs.
474 if (!shellOmitsChildren && isEnvironmentLive() && readThreadShell(threadRef) === null) {
475 const location = router.latestLocation;