Skip to content

Commit 1eb8384

Browse files
Merge branch 'main' into fix/acp-terminal-tests-windows
2 parents 8f50aed + f79f37a commit 1eb8384

10 files changed

Lines changed: 118 additions & 31 deletions

File tree

‎apps/mobile/src/features/threads/NewTaskDraftScreen.tsx‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,20 @@ export function NewTaskDraftScreen(props: {
213213
const controlsBottomPadding = Math.max(insets.bottom, 10);
214214
const keyboardOpenedOffset = Math.max(0, controlsBottomPadding - 8);
215215
const { projectScopes, selectedProject, selectedProjectKey, setProject } = flow;
216+
// The picker and sidebar name a project by its repository scope; a workspace
217+
// inside it (e.g. apps/server) is titled by its folder, which reads as
218+
// ambiguous on its own.
219+
const selectedProjectLabel = useMemo(() => {
220+
if (!selectedProject) return null;
221+
const scope = projectScopes.find((candidate) =>
222+
candidate.projectRefs.some(
223+
(ref) =>
224+
ref.environmentId === selectedProject.environmentId &&
225+
ref.projectId === selectedProject.id,
226+
),
227+
);
228+
return scope?.title ?? selectedProject.title;
229+
}, [projectScopes, selectedProject]);
216230
const { connectedEnvironments } = useRemoteConnectionStatus();
217231
const selectedEnvironmentServerConfig = useEnvironmentServerConfig(
218232
selectedProject?.environmentId ?? null,
@@ -507,7 +521,7 @@ export function NewTaskDraftScreen(props: {
507521
});
508522
const voiceInput = useVoiceInputController({
509523
ownerKey: flow.draftKey,
510-
label: selectedProject ? `New task in ${selectedProject.title}` : "New task",
524+
label: selectedProjectLabel ? `New task in ${selectedProjectLabel}` : "New task",
511525
readDraftMessage: () => (flow.draftKey ? getComposerDraftSnapshot(flow.draftKey).text : null),
512526
subscribeToDraftChanges: (onChange) => appAtomRegistry.subscribe(composerDraftsAtom, onChange),
513527
selection: composerMenu.selection,
@@ -1562,7 +1576,7 @@ export function NewTaskDraftScreen(props: {
15621576
<Text className="text-2xl font-t3-medium tracking-tight text-foreground">in </Text>
15631577
<Pressable
15641578
accessibilityHint="Opens the project picker"
1565-
accessibilityLabel={selectedProject.title}
1579+
accessibilityLabel={selectedProjectLabel ?? selectedProject.title}
15661580
accessibilityRole="button"
15671581
disabled={isComposerInteractionLocked}
15681582
onPress={chooseProject}
@@ -1572,7 +1586,7 @@ export function NewTaskDraftScreen(props: {
15721586
className="text-2xl font-t3-medium tracking-tight text-foreground"
15731587
numberOfLines={1}
15741588
>
1575-
{selectedProject.title}
1589+
{selectedProjectLabel ?? selectedProject.title}
15761590
</Text>
15771591
</Pressable>
15781592
<Text className="text-2xl font-t3-medium tracking-tight text-foreground">?</Text>
@@ -1878,7 +1892,7 @@ export function NewTaskDraftScreen(props: {
18781892
options={{
18791893
headerBackVisible: false,
18801894
headerShadowVisible: false,
1881-
title: "",
1895+
title: "New thread",
18821896
}}
18831897
/>
18841898
<NativeHeaderToolbar placement="left">

‎apps/server/src/provider/ProviderInstanceRegistry.test.ts‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ const layerTestHttpClient = Layer.succeed(
7474
),
7575
);
7676

77+
// The mock CLIs from makeTildeProviderFixtures are scripts Windows cannot execute.
78+
const windowsHost = HostProcess.Platform.defaultValue() === "win32";
79+
7780
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
7881

7982
const layerBackgroundPolicyAlwaysRun = Layer.mock(BackgroundPolicy.BackgroundPolicy)({
@@ -503,7 +506,7 @@ describe("ProviderInstanceRegistry — multi-instance codex slice", () => {
503506
Effect.provide(layerTest),
504507
);
505508

506-
it.live("refreshes Claude usage after redeeming a reset", () =>
509+
it.live.skipIf(windowsHost)("refreshes Claude usage after redeeming a reset", () =>
507510
Effect.gen(function* () {
508511
const { outcome, after } = yield* redeemClaudeReset({
509512
result: "reset",
@@ -514,14 +517,16 @@ describe("ProviderInstanceRegistry — multi-instance codex slice", () => {
514517
}),
515518
);
516519

517-
it.live("reports Claude's answer when a claim changed nothing and the re-probe fails", () =>
518-
Effect.gen(function* () {
519-
const { outcome } = yield* redeemClaudeReset({
520-
result: "already_used",
521-
usageFailsAfterClaim: true,
522-
});
523-
expect(outcome).toMatchObject({ _tag: "Success", success: "alreadyRedeemed" });
524-
}),
520+
it.live.skipIf(windowsHost)(
521+
"reports Claude's answer when a claim changed nothing and the re-probe fails",
522+
() =>
523+
Effect.gen(function* () {
524+
const { outcome } = yield* redeemClaudeReset({
525+
result: "already_used",
526+
usageFailsAfterClaim: true,
527+
});
528+
expect(outcome).toMatchObject({ _tag: "Success", success: "alreadyRedeemed" });
529+
}),
525530
);
526531

527532
it.live(

‎apps/web/src/components/AppSidebarLayout.tsx‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function readInitialThreadSidebarWidth(): number {
8383
function SidebarControl() {
8484
const usagePageOpen = useLocation({ select: (location) => location.pathname === "/usage" });
8585
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
86-
const { toggleSidebar } = useSidebar();
86+
const { toggleSidebar, isMobile, mobileSheetMounted } = useSidebar();
8787
const isSidebarVisible = useSidebarVisibility();
8888
const environmentIdentificationMode = useEnvironmentIdentificationMode();
8989
const stageBackdropVariant = useSidebarStageBackdropVariant(
@@ -138,8 +138,12 @@ function SidebarControl() {
138138
// The right-side layout controls carry mr-px (border compensation inside
139139
// the panel), so the trigger mirrors it: both clusters sit one extra pixel
140140
// off their edge and the titlebar reads symmetric.
141+
// The sheet owns its trigger until its closing transition unmounts it.
141142
<div
142-
className="pointer-events-none fixed left-[var(--workspace-controls-left)] top-[var(--workspace-controls-top)] z-50 ml-px flex h-[var(--workspace-topbar-height)] items-center"
143+
className={cn(
144+
"pointer-events-none fixed left-[var(--workspace-controls-left)] top-[var(--workspace-controls-top)] z-50 ml-px flex h-[var(--workspace-topbar-height)] items-center",
145+
isMobile && mobileSheetMounted && "hidden",
146+
)}
143147
data-sidebar-control=""
144148
>
145149
<Tooltip>
@@ -259,12 +263,15 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
259263
? getWindowFullscreenState()
260264
: false;
261265
});
266+
const windowControlsInsetStyle = (
267+
isMacosDesktop && !isWindowFullscreen
268+
? { "--workspace-controls-left": MACOS_TRAFFIC_LIGHTS_LEFT_INSET }
269+
: {}
270+
) as CSSProperties;
262271
const sidebarProviderStyle = {
263272
"--sidebar-width": `${clampThreadSidebarWidth(sidebarWidth, sidebarMinimumWidth, sidebarMaximumWidth)}px`,
264273
"--panel-animation-duration": `${panelAnimationDurationMs}ms`,
265-
...(isMacosDesktop && !isWindowFullscreen
266-
? { "--workspace-controls-left": MACOS_TRAFFIC_LIGHTS_LEFT_INSET }
267-
: {}),
274+
...windowControlsInsetStyle,
268275
} as CSSProperties;
269276

270277
useEffect(() => {
@@ -329,6 +336,8 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
329336
storageKey: THREAD_SIDEBAR_WIDTH_STORAGE_KEY,
330337
onResize: setSidebarWidth,
331338
}}
339+
// The narrow-window sidebar is a sheet, portaled outside the provider's styles.
340+
style={windowControlsInsetStyle}
332341
>
333342
{isOnSettings ? (
334343
<>

‎apps/web/src/components/ChatMarkdown.tsx‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ import {
173173
type MarkdownFileLinkMeta,
174174
} from "../markdown-links";
175175
import { isMarkdownFileLinkLabel } from "@t3tools/shared/markdownLinks";
176+
import { isElectron } from "../env";
176177
import { readLocalApi } from "../localApi";
177178
import { useAssetUrlRefresh, useAssetUrlState } from "../assets/assetUrls";
178179
import { cn } from "../lib/utils";
@@ -3035,15 +3036,30 @@ const CHAT_MARKDOWN_COMPONENTS = {
30353036
// keeps the `_blank` the shell already handles; the in-app browser needs
30363037
// the click intercepted here. A modifier click is the way out of the
30373038
// in-app default, so it is left to the shell too.
3039+
if (event.defaultPrevented) return;
30383040
if (
3039-
event.defaultPrevented ||
30403041
resolveLinkTarget({
30413042
url: href,
30423043
event,
30433044
preference: linkTargetPreference,
30443045
canOpenInApp: canOpenInPreview,
30453046
}) !== "app"
30463047
) {
3048+
// Chromium turns an Option/Alt-click into a download that never reaches the
3049+
// shell. On desktop, open the link here while the key is still down, so link
3050+
// routers such as Finicky can still read it.
3051+
if (isElectron && event.altKey) {
3052+
event.preventDefault();
3053+
event.stopPropagation();
3054+
void readLocalApi()
3055+
?.shell.openExternal(href)
3056+
.catch((cause) =>
3057+
reportMarkdownActionFailure(
3058+
{ operation: "open-link-external", target: href },
3059+
cause,
3060+
),
3061+
);
3062+
}
30473063
return;
30483064
}
30493065
event.preventDefault();

‎apps/web/src/components/chat/ChatComposer.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,11 @@ function ComposerCommandMenuLayer(props: { anchor: HTMLElement | null; children:
10171017
window.getComputedStyle(form ?? anchor).getPropertyValue("--chat-composer-drawer-inset"),
10181018
);
10191019
const drawerInset = drawerInsetRem * rootFontSizePx;
1020+
const width = rect.width - drawerInset * 2;
1021+
if (width <= 0) {
1022+
setPosition(null);
1023+
return;
1024+
}
10201025
// One extra pixel prevents fractional layout coordinates from exposing
10211026
// the canvas between the drawer mask and the composer's foreground edge.
10221027
// Mirrors --chat-composer-attachment-overlap: calc(1rem + 1px).
@@ -1025,7 +1030,7 @@ function ComposerCommandMenuLayer(props: { anchor: HTMLElement | null; children:
10251030
bottom: window.innerHeight - rect.top - composerOverlap,
10261031
left: rect.left + drawerInset,
10271032
maxHeight: Math.max(96, rect.top - 24 + composerOverlap),
1028-
width: Math.max(0, rect.width - drawerInset * 2),
1033+
width,
10291034
};
10301035
setPosition((current) =>
10311036
current && composerCommandMenuPositionsEqual(current, next) ? current : next,

‎apps/web/src/components/sidebar/SidebarChrome.tsx‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,20 @@ export const SidebarChromeHeader = memo(function SidebarChromeHeader({
5151
// The titlebar row, not a padded SidebarHeader: it aligns to the window controls.
5252
<div
5353
className={cn(
54-
"relative flex h-[var(--workspace-topbar-height)] shrink-0 flex-row items-center gap-2 px-3 md:pl-0",
54+
"relative flex h-[var(--workspace-topbar-height)] shrink-0 flex-row items-center gap-2 pr-3",
5555
isElectron && "drag-region",
5656
)}
5757
>
5858
{backdropVariant ? <SidebarStageBackdrop variant={backdropVariant} /> : null}
59-
<SidebarTrigger
60-
// Over the stage artwork: the media viewer's control-on-imagery treatment.
61-
variant={backdropVariant ? "media-navigation" : "ghost"}
62-
className="relative top-auto z-10 translate-y-0 md:hidden"
63-
/>
59+
{/* Match the fixed control's inset and border compensation inside the sheet's safe area. */}
60+
<div className="relative top-[calc(var(--workspace-controls-top)-env(safe-area-inset-top))] z-10 ml-[calc(var(--workspace-controls-left)+1px-env(safe-area-inset-left))] flex shrink-0 items-center md:hidden">
61+
<SidebarTrigger
62+
// Over the stage artwork: the media viewer's control-on-imagery treatment.
63+
variant={backdropVariant ? "media-navigation" : "ghost"}
64+
className="relative top-auto translate-y-0"
65+
aria-label="Toggle main sidebar"
66+
/>
67+
</div>
6468
{/* One visible line: the pill wraps onto the clipped second line once it no longer fits.
6569
The padding keeps the brand's focus ring inside the clip. */}
6670
<div className="relative z-10 flex h-8 min-w-0 flex-1 flex-wrap content-start items-center gap-x-2 overflow-hidden py-0.5">

‎apps/web/src/components/ui/sidebar.tsx‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ const SIDEBAR_WIDTH = "16rem";
2828
const SIDEBAR_WIDTH_MOBILE = "calc(100vw - var(--spacing(3)))";
2929
const SIDEBAR_WIDTH_ICON = "3rem";
3030
const SIDEBAR_RESIZE_DEFAULT_MIN_WIDTH = 16 * 16;
31+
const SIDEBAR_TITLEBAR_CONTROL_SIZE = "max-sm:[--workspace-titlebar-control-size:--spacing(8)]";
3132

3233
type SidebarContextProps = {
3334
state: ResponsiveSidebarState;
3435
open: boolean;
3536
setOpen: (open: boolean) => void;
3637
openMobile: boolean;
38+
mobileSheetMounted: boolean;
39+
setMobileSheetElement: (element: HTMLDivElement | null) => void;
3740
setOpenMobile: (open: boolean) => void;
3841
isMobile: boolean;
3942
toggleSidebar: () => void;
@@ -106,6 +109,10 @@ function SidebarProvider({
106109
}) {
107110
const isMobile = useIsMobile();
108111
const [openMobile, setOpenMobile] = React.useState(false);
112+
const [mobileSheetMounted, setMobileSheetMounted] = React.useState(false);
113+
const setMobileSheetElement = React.useCallback((element: HTMLDivElement | null) => {
114+
setMobileSheetMounted(element !== null);
115+
}, []);
109116

110117
// This is the internal state of the sidebar.
111118
// We use openProp and setOpenProp for control from outside the component.
@@ -145,20 +152,32 @@ function SidebarProvider({
145152
isMobile,
146153
open,
147154
openMobile,
155+
mobileSheetMounted,
156+
setMobileSheetElement,
148157
setOpen,
149158
setOpenMobile,
150159
state,
151160
toggleSidebar,
152161
}),
153-
[state, open, setOpen, isMobile, openMobile, toggleSidebar],
162+
[
163+
state,
164+
open,
165+
setOpen,
166+
isMobile,
167+
openMobile,
168+
mobileSheetMounted,
169+
setMobileSheetElement,
170+
toggleSidebar,
171+
],
154172
);
155173

156174
return (
157175
<SidebarContext value={contextValue}>
158176
<div
159177
// Inset layouts opt into bg-sidebar through className.
160178
className={cn(
161-
"group/sidebar-wrapper flex min-h-svh w-full max-sm:[--workspace-titlebar-control-size:--spacing(8)]",
179+
"group/sidebar-wrapper flex min-h-svh w-full",
180+
SIDEBAR_TITLEBAR_CONTROL_SIZE,
162181
className,
163182
)}
164183
data-sidebar-state={state}
@@ -194,7 +213,7 @@ function Sidebar({
194213
collapsible?: "offcanvas" | "icon" | "none";
195214
resizable?: boolean | SidebarResizableOptions;
196215
}) {
197-
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
216+
const { isMobile, state, openMobile, setOpenMobile, setMobileSheetElement } = useSidebar();
198217
const resolvedResizable = React.useMemo<SidebarResolvedResizableOptions | null>(() => {
199218
if (isMobile || collapsible === "none" || !resizable) {
200219
return null;
@@ -236,6 +255,7 @@ function Sidebar({
236255
<SidebarInstanceContext value={instanceContextValue}>
237256
<Sheet onOpenChange={setOpenMobile} open={openMobile}>
238257
<SheetPopup
258+
ref={setMobileSheetElement}
239259
className={cn(
240260
"w-(--sidebar-width) max-w-none bg-sidebar surface-grain p-0 text-sidebar-foreground",
241261
className,
@@ -258,6 +278,7 @@ function Sidebar({
258278
<div
259279
className={cn(
260280
"flex h-full w-full flex-col pb-safe pt-safe",
281+
SIDEBAR_TITLEBAR_CONTROL_SIZE,
261282
side === "left" ? "pl-safe" : "pr-safe",
262283
)}
263284
{...props}

‎apps/web/src/state/threads.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { createRunningThreadKeepAliveAtom } from "./threads";
1919
const LOCAL = EnvironmentId.make("local");
2020
const REMOTE = EnvironmentId.make("remote");
2121

22-
type Status = "running" | "starting" | "idle";
22+
type Status = "running" | "starting" | "preparing" | "queued" | "waiting" | "idle";
2323
function shell(id: string, status: Status | null) {
2424
return { id: ThreadId.make(id), status: status ?? "idle" } satisfies Pick<
2525
OrchestrationV2ThreadShell,
@@ -159,6 +159,12 @@ describe("createRunningThreadKeepAliveAtom", () => {
159159
expect(h.openStreams()).toEqual([]);
160160
});
161161

162+
it("keeps queued threads open", () => {
163+
const h = makeHarness();
164+
h.registry.set(h.threads(LOCAL), [shell("a", "queued")]);
165+
expect(h.openStreams()).toEqual(["local:a"]);
166+
});
167+
162168
it("follows environments that connect and go away", () => {
163169
const h = makeHarness();
164170
h.registry.set(h.environmentIds, [LOCAL]);

‎apps/web/src/state/threads.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function useEnvironmentThread(
5151
}
5252

5353
const isRunning = (status: string) =>
54-
status === "preparing" || status === "starting" || status === "running";
54+
status === "preparing" || status === "queued" || status === "starting" || status === "running";
5555

5656
type KeptThreads = ReadonlyMap<EnvironmentId, ReadonlySet<ThreadId>>;
5757

‎packages/provider-acp/src/server/AcpSessionRuntime.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,13 @@ export function wrapCommandForLinuxCgroup(
285285
'[ "$actual" = "$expected" ] || exit 126',
286286
"unset ELECTRON_RUN_AS_NODE T3_ACP_CGROUP_WRAPPER",
287287
"trap 'exit 125' 0",
288+
// The trap alone does not cover a failed `exec`: bash — which is
289+
// /bin/sh on Arch derivatives — exits 127 without running the EXIT
290+
// trap, so a missing agent binary reported "killed by the wrapper"
291+
// instead of "never launched". The caller always hands us an absolute
292+
// target, so test it as an executable file rather than asking the
293+
// shell to resolve it.
294+
'[ -f "$1" ] && [ -x "$1" ] || exit 125',
288295
'exec "$@"',
289296
].join("\n"),
290297
"t3-acp-cgroup-wrapper",

0 commit comments

Comments
 (0)