@devries-cameron20 / t3code Mirror · read-only / commits / 96a330c957
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, 13:15 UTC

fix(web): remote delegates show their harness icon, a parent row, and new links in settings (#26434)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 28, 2026 at 04:52 UTC 96a330c9572a329ef9a27e2b56c0306885ca0a85
8 files changed +140 -30
apps/mobile/src/features/threads/LinkRequestCard.tsx
+4 -5
@@ -30,9 +30,8 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
30 import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
31 import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
32 import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
33 -import { useLinkableMachines } from "../../state/peerLinks";
33 +import { peerLinkEnvironment, useLinkableMachines } from "../../state/peerLinks";
34 import { mintPairingCodeOn } from "../../state/peerPairingCode";
35 -import { serverEnvironment } from "../../state/server";
35 import { useEnvironmentScope, usePreparedConnection } from "../../state/session";
36 import { useAtomCommand } from "../../state/use-atom-command";
37 import { ListChoiceRow as SettingsChoiceRow } from "../../components/ui/ListChoiceRow";
@@ -107,13 +106,13 @@ function PendingLinkRequest(props: {
106 const [open, setOpen] = useState(false);
107 const [declining, setDeclining] = useState(false);
108 const [error, setError] = useState<string | null>(null);
110 - const answer = useAtomCommand(serverEnvironment.answerLinkRequest, {
109 + const answer = useAtomCommand(peerLinkEnvironment.answerRequest, {
110 label: "decline link request",
111 reportFailure: false,
112 reportDefect: false,
113 });
114 const canAnswer = useAtomValue(
116 - serverEnvironment.answerLinkRequest.permissionAtom(props.environmentId),
115 + peerLinkEnvironment.answerRequest.permissionAtom(props.environmentId),
116 );
117 const target = linkRequestTargetName(item);
118
@@ -244,7 +243,7 @@ function LinkRequestSheet(props: {
243 const [mintFailed, setMintFailed] = useState<ReadonlySet<EnvironmentId>>(new Set());
244 // Submit then a tap can both run before a re-render; this guard is synchronous.
245 const inFlight = useRef(false);
247 - const answer = useAtomCommand(serverEnvironment.answerLinkRequest, {
246 + const answer = useAtomCommand(peerLinkEnvironment.answerRequest, {
247 label: "answer link request",
248 // The failure cause holds the request, and with it the code; keep it out of the console.
249 reportFailure: false,
apps/mobile/src/features/threads/thread-subagent-group.tsx
+14 -5
@@ -7,6 +7,7 @@ import type {
7 EnvironmentId,
8 OrchestrationV2Subagent,
9 OrchestrationV2TurnItem,
10 + ServerProvider,
11 } from "@t3tools/contracts";
12 import { Pressable, View, type ColorValue } from "react-native";
13
@@ -41,14 +42,22 @@ function SubagentElapsed({ agents }: { readonly agents: ReadonlyArray<AgentTimin
42
43 function SubagentAvatar(props: {
44 readonly item: SubagentItem;
44 - readonly iconUrl?: string | null | undefined;
45 + readonly provider: ServerProvider | undefined;
46 }) {
47 + // A remote task's own driver is only a "remote" label.
48 + const driver =
49 + props.provider?.driver ??
50 + (props.item.remoteChild === undefined ? props.item.driver : undefined);
51 return (
52 <View
53 accessible={false}
54 className="h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border bg-card"
55 >
51 - <ProviderIcon provider={props.item.driver} iconUrl={props.iconUrl} size={15} />
56 + {driver === undefined ? (
57 + <SymbolView name="sparkles" size={13} tintColorClassName="accent-icon-muted" />
58 + ) : (
59 + <ProviderIcon provider={driver} iconUrl={props.provider?.iconUrl} size={15} />
60 + )}
61 </View>
62 );
63 }
@@ -91,11 +100,11 @@ export function ThreadSubagentGroup(props: {
100 const expanded = props.expandedRows[props.anchorKey] ?? false;
101 const serverConfigs = useServerConfigs();
102 // A task in a linked environment runs a provider instance of that environment.
94 - const iconUrl = (item: SubagentItem) =>
103 + const providerOf = (item: SubagentItem) =>
104 (item.remoteChild === undefined
105 ? config
106 : serverConfigs.get(item.remoteChild.environmentId)
98 - )?.providers.find((provider) => provider.instanceId === item.providerInstanceId)?.iconUrl;
107 + )?.providers.find((provider) => provider.instanceId === item.providerInstanceId);
108 return (
109 <WorkLogBlock>
110 {grouped ? (
@@ -109,7 +118,7 @@ export function ThreadSubagentGroup(props: {
118 <View className="flex-row items-center">
119 {agents.slice(0, 3).map((agent, index) => (
120 <View key={agent.item.id} style={{ marginLeft: index === 0 ? 0 : -7 }}>
112 - <SubagentAvatar item={agent.item} iconUrl={iconUrl(agent.item)} />
121 + <SubagentAvatar item={agent.item} provider={providerOf(agent.item)} />
122 </View>
123 ))}
124 {agents.length > 3 ? (
apps/web/src/components/chat/LinkRequestCard.tsx
+4 -5
@@ -28,8 +28,7 @@ import { useId, useRef, useState } from "react";
28
29 import { useEnvironmentScope, usePreparedConnection } from "../../state/session";
30 import { mintPairingCodeOn } from "../../state/peerPairingCode";
31 -import { useLinkableMachines } from "../../state/peerLinks";
32 -import { serverEnvironment } from "../../state/server";
31 +import { peerLinkEnvironment, useLinkableMachines } from "../../state/peerLinks";
32 import { useAtomCommand } from "../../state/use-atom-command";
33 import { accessConfig } from "../auth/ConnectAgentSurface";
34 import { EnvironmentMachineIcon } from "../EnvironmentMachineIcon";
@@ -88,13 +87,13 @@ function PendingLinkRequest(props: {
87 const [open, setOpen] = useState(false);
88 const [declining, setDeclining] = useState(false);
89 const [error, setError] = useState<string | null>(null);
91 - const answer = useAtomCommand(serverEnvironment.answerLinkRequest, {
90 + const answer = useAtomCommand(peerLinkEnvironment.answerRequest, {
91 label: "decline link request",
92 reportFailure: false,
93 reportDefect: false,
94 });
95 const canAnswer = useAtomValue(
97 - serverEnvironment.answerLinkRequest.permissionAtom(props.environmentId),
96 + peerLinkEnvironment.answerRequest.permissionAtom(props.environmentId),
97 );
98 const target = linkRequestTargetName(item);
99
@@ -223,7 +222,7 @@ function LinkRequestDialog(props: {
222 const [mintFailed, setMintFailed] = useState<ReadonlySet<EnvironmentId>>(new Set());
223 // Enter then a click can both run before a re-render; this guard is synchronous.
224 const inFlight = useRef(false);
226 - const answer = useAtomCommand(serverEnvironment.answerLinkRequest, {
225 + const answer = useAtomCommand(peerLinkEnvironment.answerRequest, {
226 label: "answer link request",
227 // The failure cause holds the request, and with it the code; keep it out of the console.
228 reportFailure: false,
apps/web/src/components/chat/ThreadRelationshipsControl.tsx
+84 -3
@@ -32,6 +32,7 @@ import {
32 isProviderNativeSubagentThread,
33 NodeId,
34 type EnvironmentId,
35 + type OrchestrationV2DelegatedFrom,
36 type OrchestrationV2RemoteTaskChild,
37 type OrchestrationV2Subagent,
38 type OrchestrationV2ThreadShell,
@@ -60,6 +61,7 @@ import { useArchivedThreadSnapshots } from "../../lib/archivedThreadsState";
61 import { buildThreadRouteParams } from "../../threadRoutes";
62 import {
63 useProjects,
64 + useQuietThreadShell,
65 useThreadProjection,
66 useThreadRelationshipShells,
67 } from "../../state/entities";
@@ -261,7 +263,8 @@ function RemoteSubagentRow(props: {
263 }
264 >
265 <ThreadRelationshipIcon
264 - driver={props.agent.driver}
266 + // The task's own driver here is only a "remote" label.
267 + driver={props.provider?.driver}
268 provider={props.provider}
269 fallbackIcon={BotIcon}
270 status={status}
@@ -287,6 +290,62 @@ function RemoteSubagentRow(props: {
290 );
291 }
292
293 +/**
294 + * The thread on a linked environment whose agent delegated this one. It opens
295 + * there when this client is connected to that environment.
296 + */
297 +function DelegatedFromRow(props: {
298 + readonly delegatedFrom: OrchestrationV2DelegatedFrom;
299 + readonly fallbackLabel: string | undefined;
300 +}) {
301 + const navigate = useNavigate();
302 + const { delegatedFrom } = props;
303 + const environment = useEnvironment(delegatedFrom.environmentId);
304 + const parentRef = scopeThreadRef(delegatedFrom.environmentId, delegatedFrom.threadId);
305 + // The title it had at delegation, until this client sees the parent itself.
306 + const parent = useQuietThreadShell(parentRef);
307 + const label = environment?.label ?? props.fallbackLabel;
308 + const title = parent?.title ?? delegatedFrom.title;
309 + return (
310 + <li className="group relative flex h-8 items-center rounded-lg">
311 + <Tooltip>
312 + <TooltipTrigger
313 + delay={200}
314 + render={
315 + <ThreadDetailsControl
316 + size="sm"
317 + variant="ghost"
318 + part="row"
319 + disabled={environment === null}
320 + onClick={() =>
321 + void navigate({
322 + to: "/$environmentId/$threadId",
323 + params: buildThreadRouteParams(parentRef),
324 + })
325 + }
326 + />
327 + }
328 + >
329 + <ThreadRelationshipIcon fallbackIcon={CornerLeftUpIcon} status={null} />
330 + <span className="min-w-0 flex-1">
331 + <span className="block truncate text-left text-sm font-medium leading-4 text-foreground/85">
332 + {title}
333 + </span>
334 + </span>
335 + {label ? (
336 + <span className="shrink-0 text-2xs text-muted-foreground">on {label}</span>
337 + ) : null}
338 + </TooltipTrigger>
339 + <TooltipPopup side="left">
340 + {environment === null
341 + ? `Delegated from ${label ?? "a linked environment"}. Connect to it to open the parent thread.`
342 + : "Open parent agent"}
343 + </TooltipPopup>
344 + </Tooltip>
345 + </li>
346 + );
347 +}
348 +
349 export function ThreadRelationshipsPanel(props: {
350 readonly environmentId: EnvironmentId;
351 readonly threadId: ThreadId;
@@ -412,7 +471,15 @@ export function ThreadRelationshipsPanel(props: {
471 (agent) => agent.childThreadId === null && agent.status === "running",
472 ).length ?? 0) + active.filter(({ edge }) => edge.status === "running").length;
473
415 - if (relationshipRows.length === 0 && runningCount === 0 && remoteSubagents.length === 0) {
474 + // A linked environment's agent may have delegated this thread from there.
475 + const delegatedFrom = currentThread?.delegatedFrom;
476 +
477 + if (
478 + relationshipRows.length === 0 &&
479 + runningCount === 0 &&
480 + remoteSubagents.length === 0 &&
481 + delegatedFrom === undefined
482 + ) {
483 return null;
484 }
485
@@ -487,7 +554,13 @@ export function ThreadRelationshipsPanel(props: {
554 headingId="thread-details-lineage-heading"
555 title={runningCount > 0 ? `Lineage · ${runningCount} running` : "Lineage"}
556 // A lone "Previous agents" row names itself; the heading returns for status or actions.
490 - showHeading={runningCount > 0 || canDetach || related.length > 0 || active.length > 0}
557 + showHeading={
558 + runningCount > 0 ||
559 + canDetach ||
560 + related.length > 0 ||
561 + active.length > 0 ||
562 + delegatedFrom !== undefined
563 + }
564 data-thread-relationships-panel
565 actions={
566 canDetach ? (
@@ -515,6 +588,14 @@ export function ThreadRelationshipsPanel(props: {
588 ) : null
589 }
590 >
591 + {delegatedFrom === undefined ? null : (
592 + <ThreadLineageRowList hiddenCount={0} onShowMore={() => {}}>
593 + <DelegatedFromRow
594 + delegatedFrom={delegatedFrom}
595 + fallbackLabel={currentThread?.linkOrigin?.label}
596 + />
597 + </ThreadLineageRowList>
598 + )}
599 {groups.map((group) => (
600 <ThreadLineageGroup key={`${scopedThreadKey(ref)}:${group.id}`} {...group}>
601 {(visibleRows) =>
apps/web/src/components/chat/TimelineV2EventRow.tsx
+1
@@ -109,6 +109,7 @@ const V2SubagentGroup = memo(function V2SubagentGroup({
109 environmentId={ctx.activeThreadEnvironmentId}
110 providerInstanceId={item.providerInstanceId}
111 driver={item.driver}
112 + remote={item.remoteChild}
113 status={agents.length === 1 ? status : undefined}
114 />
115 ))}
apps/web/src/components/chat/V2LifecycleRow.tsx
+21 -2
@@ -250,14 +250,25 @@ function SubagentAvatar({
250 export function EnvironmentSubagentAvatar({
251 environmentId,
252 providerInstanceId,
253 + driver,
254 + remote,
255 ...props
256 }: {
257 environmentId: EnvironmentId;
258 providerInstanceId: ProviderInstanceId;
259 driver?: ProviderDriverKind | undefined;
260 + /** A task in a linked environment runs a provider instance there; its driver here is only a label. */
261 + remote?: OrchestrationV2RemoteTaskChild | undefined;
262 status?: OrchestrationV2TurnItem["status"] | undefined;
263 }) {
260 - const providersAtom = serverEnvironment.providersValueAtom(environmentId);
264 + const providersAtom = serverEnvironment.providersValueAtom(
265 + remote?.environmentId ?? environmentId,
266 + );
267 + const providerDriver = useAtomValue(
268 + providersAtom,
269 + (providers) =>
270 + providers?.find((provider) => provider.instanceId === providerInstanceId)?.driver,
271 + );
272 const displayName = useAtomValue(
273 providersAtom,
274 (providers) =>
@@ -268,7 +279,14 @@ export function EnvironmentSubagentAvatar({
279 (providers) =>
280 providers?.find((provider) => provider.instanceId === providerInstanceId)?.iconUrl,
281 );
271 - return <SubagentAvatar {...props} displayName={displayName} iconUrl={iconUrl} />;
282 + return (
283 + <SubagentAvatar
284 + {...props}
285 + driver={providerDriver ?? (remote === undefined ? driver : undefined)}
286 + displayName={displayName}
287 + iconUrl={iconUrl}
288 + />
289 + );
290 }
291
292 const NOTIFICATION_OUTCOME_STATUS: Record<
@@ -399,6 +417,7 @@ function SubagentTimelineLink(props: {
417 environmentId={props.parentRef.environmentId}
418 providerInstanceId={props.providerInstanceId}
419 driver={props.driver}
420 + remote={remote}
421 status={status ?? undefined}
422 />
423 <span className="min-w-0 flex-1">
packages/client-runtime/src/state/peerLinks.ts
+12
@@ -30,6 +30,18 @@ export function createPeerLinkEnvironmentAtoms<R, E>(
30 onSuccess: ({ environmentId }, registry) =>
31 Effect.sync(() => registry.refresh(list({ environmentId, input: {} }))),
32 }),
33 + // An agent's link card. One answer per card at a time.
34 + answerRequest: createEnvironmentRpcCommand(runtime, {
35 + label: "environment-data:peer-links:answer-request",
36 + tag: WS_METHODS.peerLinksAnswerRequest,
37 + concurrency: {
38 + mode: "singleFlight",
39 + key: ({ environmentId, input }) =>
40 + JSON.stringify([environmentId, input.threadId, input.turnItemId]),
41 + },
42 + onSuccess: ({ environmentId }, registry) =>
43 + Effect.sync(() => registry.refresh(list({ environmentId, input: {} }))),
44 + }),
45 };
46 }
47
packages/client-runtime/src/state/server.ts
-10
@@ -1527,16 +1527,6 @@ export function createServerEnvironmentAtoms<R, E>(
1527 JSON.stringify([environmentId, input.threadId, input.turnItemId]),
1528 },
1529 }),
1530 - // Like a secret card's answer: off the config lane, one per card at a time.
1531 - answerLinkRequest: createEnvironmentRpcCommand(runtime, {
1532 - label: "environment-data:server:peer-links:answer-request",
1533 - tag: WS_METHODS.peerLinksAnswerRequest,
1534 - concurrency: {
1535 - mode: "singleFlight",
1536 - key: ({ environmentId, input }) =>
1537 - JSON.stringify([environmentId, input.threadId, input.turnItemId]),
1538 - },
1539 - }),
1530 refreshUsageRates: createEnvironmentRpcCommand(runtime, {
1531 label: "environment-data:server:refresh-usage-rates",
1532 tag: WS_METHODS.serverRefreshUsageRates,