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 23, 01:45 UTC
fix(web): started threads no longer offer a machine picker that does nothing (#19900)
Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Tristan Knight committed
Oct 19, 2026 at 19:08 UTC
19aebe994abc85ebdd22c7e24bf2db474d6b6172
4 files changed
+34
-10
apps/web/src/components/BranchToolbar.panel.browser.test.tsx
+16
@@ -106,6 +106,22 @@ it("keeps machine choices usable when the combined row's workspace is locked", a
106
expect(onEnvironmentChange).toHaveBeenCalledWith("remote");
107
});
108
109
+it("shows a started thread's primary machine as a static label in the composer", async () => {
110
+ await render({
111
+ layout: "composer",
112
+ showGitControls: false,
113
+ availableEnvironments: ["local", "remote"].map((id) => ({
114
+ environmentId: EnvironmentId.make(id),
115
+ projectId: ProjectId.make("project"),
116
+ label: id,
117
+ isPrimary: id === "local",
118
+ machine: "server",
119
+ })),
120
+ });
121
+ expect(container.textContent).toBe("local");
122
+ expect(container.querySelector("button")).toBeNull();
123
+});
124
+
125
it.each([
126
["local", null, "/tmp/project"],
127
["worktree", null, null],
apps/web/src/components/BranchToolbar.tsx
+6
-5
@@ -645,14 +645,15 @@ export const BranchToolbar = memo(function BranchToolbar({
645
],
646
);
647
648
- const showEnvironmentPicker = Boolean(
649
- availableEnvironments && availableEnvironments.length > 1 && onEnvironmentChange,
650
- );
648
+ const hasMultipleEnvironments = (availableEnvironments?.length ?? 0) > 1;
649
+ const showEnvironmentPicker = hasMultipleEnvironments && onEnvironmentChange !== undefined;
650
const activeEnvironmentOption =
651
availableEnvironments?.find((env) => env.environmentId === environmentId) ?? null;
652
+ // Started threads get no handler but still show which machine they run on,
653
+ // matching the strip visibility ChatView computes from the same inputs.
654
const showEnvironmentIndicator = shouldShowEnvironmentIndicator({
655
activeEnvironment: activeEnvironmentOption,
655
- canPickEnvironment: showEnvironmentPicker,
656
+ canPickEnvironment: hasMultipleEnvironments,
657
});
658
const [stripElement, setStripElement] = useState<HTMLDivElement | null>(null);
659
const labelsOverflow = useLabelsOverflow(stripElement);
@@ -755,7 +756,7 @@ export const BranchToolbar = memo(function BranchToolbar({
756
envLocked={envLocked}
757
environmentId={environmentId}
758
availableEnvironments={availableEnvironments}
758
- {...(showEnvironmentPicker && onEnvironmentChange ? { onEnvironmentChange } : {})}
759
+ {...(showEnvironmentPicker ? { onEnvironmentChange } : {})}
760
/>
761
{showGitControls ? (
762
<Separator
apps/web/src/components/ChatView.tsx
+8
-3
@@ -2178,6 +2178,11 @@ export default function ChatView(props: ChatViewProps) {
2178
? null
2179
: clampFileAttachmentUploadBytes(advertisedFileAttachmentBytes);
2180
const envLocked = Boolean(activeThread && (activeMessageCount > 0 || activeRuntime !== null));
2181
+ // onEnvironmentChange only retargets an unsent draft. envLocked alone does not
2182
+ // rule out a started thread: one whose machine is offline never loads its
2183
+ // messages, so it would otherwise be offered a machine picker that does nothing.
2184
+ const canChangeEnvironment =
2185
+ hasMultipleEnvironments && !envLocked && draftId !== null && !draftThread?.promotedTo;
2186
2187
const loadBalancingSettings = useClientSettings((settings) => ({
2188
loadBalancingEnabled: settings.loadBalancingEnabled,
@@ -5627,7 +5632,7 @@ export default function ChatView(props: ChatViewProps) {
5632
"composer.mode": openComposerControl("composer.mode"),
5633
"composer.workspace": openComposerControl("composer.workspace"),
5634
"composer.cycleHost": ({ event }) => {
5630
- if (envLocked || !draftId || !hasMultipleEnvironments) return false;
5635
+ if (!canChangeEnvironment) return false;
5636
if (event.repeat) return;
5637
const currentId = readPendingEnvironmentChange()?.environmentId ?? environmentId;
5638
const index = logicalProjectEnvironments.findIndex(
@@ -8393,7 +8398,7 @@ export default function ChatView(props: ChatViewProps) {
8398
{...(canCheckoutPullRequestIntoThread
8399
? { onCheckoutPullRequestRequest: openPullRequestDialogStable }
8400
: {})}
8396
- {...(hasMultipleEnvironments
8401
+ {...(canChangeEnvironment
8402
? { onEnvironmentChange: onEnvironmentChangeStable }
8403
: {})}
8404
autoEnvironmentLabel={autoEnvironmentLabel}
@@ -8480,7 +8485,7 @@ export default function ChatView(props: ChatViewProps) {
8485
? onAutoEnvironmentStable
8486
: undefined
8487
}
8483
- onEnvironmentChange={onEnvironmentChangeStable}
8488
+ {...(canChangeEnvironment ? { onEnvironmentChange: onEnvironmentChangeStable } : {})}
8489
onEnvModeChange={onEnvModeChangeStable}
8490
envMode={envMode}
8491
{...(canOverrideServerThreadEnvMode
apps/web/src/components/chat/ThreadDetailsPanel.tsx
+4
-2
@@ -45,7 +45,7 @@ export interface ThreadDetailsPanelProps extends Pick<
45
availableEnvironments: readonly EnvironmentOption[];
46
autoEnvironmentLabel?: string | undefined;
47
onAutoEnvironment?: (() => void) | undefined;
48
- onEnvironmentChange: (environmentId: EnvironmentId) => void;
48
+ onEnvironmentChange?: (environmentId: EnvironmentId) => void;
49
onEnvModeChange: (mode: EnvMode) => void;
50
envMode: EnvMode;
51
activeThreadBranchOverride?: string | null;
@@ -114,7 +114,9 @@ export function ThreadDetailsPanel(props: ThreadDetailsPanelProps) {
114
layout="panel"
115
panelSection="workspace"
116
availableEnvironments={props.availableEnvironments}
117
- onEnvironmentChange={props.onEnvironmentChange}
117
+ {...(props.onEnvironmentChange
118
+ ? { onEnvironmentChange: props.onEnvironmentChange }
119
+ : {})}
120
autoEnvironmentLabel={props.autoEnvironmentLabel}
121
onAutoEnvironment={props.onAutoEnvironment}
122
{...branchToolbarProps}