Skip to content
TypeScript

fix(web): thread panel shows the remote machine a thread runs on (#14972)

Theo Brownebb7997709dd5
diff --git a/apps/web/src/components/chat/ThreadDetailsPanel.tsx b/apps/web/src/components/chat/ThreadDetailsPanel.tsx
index 38df4472130..1d02a0ada88 100644
--- a/apps/web/src/components/chat/ThreadDetailsPanel.tsx
+++ b/apps/web/src/components/chat/ThreadDetailsPanel.tsx
@@ -9,7 +9,11 @@ import { AlertTriangleIcon, XIcon } from "lucide-react";
import type { DraftId } from "../../composerDraftStore";
import { useT3ProjectFileScripts } from "../../hooks/useT3ProjectFileScripts";
-import type { EnvMode, EnvironmentOption } from "../BranchToolbar.logic";
+import {
+ shouldShowEnvironmentIndicator,
+ type EnvMode,
+ type EnvironmentOption,
+} from "../BranchToolbar.logic";
import { BranchToolbar } from "../BranchToolbar";
import { BranchToolbarEnvironmentSelector } from "../BranchToolbarEnvironmentSelector";
import GitActionsControl from "../GitActionsControl";
@@ -78,6 +82,14 @@ export function ThreadDetailsPanel(props: ThreadDetailsPanelProps) {
props.environmentId,
props.activeProjectScripts ? props.gitCwd : null,
);
+ // Same rule as the composer strip: a lone remote machine still gets a row,
+ // shown as a static label because there is nothing to pick.
+ const canPickEnvironment = props.availableEnvironments.length > 1;
+ const showEnvironment = shouldShowEnvironmentIndicator({
+ activeEnvironment:
+ props.availableEnvironments.find((env) => env.environmentId === props.environmentId) ?? null,
+ canPickEnvironment,
+ });
const branchToolbarProps = {
showGitControls: props.isGitRepo,
environmentId: props.environmentId,
@@ -138,7 +150,7 @@ export function ThreadDetailsPanel(props: ThreadDetailsPanelProps) {
) : null}
<div className="flex flex-col">
- {density === "full" && props.availableEnvironments.length > 1 ? (
+ {density === "full" && showEnvironment ? (
<BranchToolbarEnvironmentSelector
displayMode="panel"
autoEnvironmentLabel={props.autoEnvironmentLabel}
@@ -146,7 +158,9 @@ export function ThreadDetailsPanel(props: ThreadDetailsPanelProps) {
envLocked={props.envLocked}
environmentId={props.environmentId}
availableEnvironments={props.availableEnvironments}
- onEnvironmentChange={props.onEnvironmentChange}
+ {...(canPickEnvironment
+ ? { onEnvironmentChange: props.onEnvironmentChange }
+ : {})}
/>
) : null}