Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
5028eb1
perf(shared): Windows command lookups reuse PATH listings across requ…
juliusmarminge Nov 22, 2026
83edd5e
fix(mcp): t3_thread_wait no longer has parents poll a task's first ru…
navidnadali Nov 22, 2026
15d945f
fix(server): reveal no longer opens Explorer's default folder for a m…
juliusmarminge Nov 22, 2026
90f0bac
fix(server): a steer that missed its turn keeps its place in the queu…
navidnadali Nov 22, 2026
3f08098
fix(web): wrapped prompt suggestion no longer overlaps the composer t…
juliusmarminge Nov 22, 2026
571b869
fix(server): refuse ref switches while a thread works in the shared c…
gbrasil720 Nov 22, 2026
c7a9fba
fix(server): label speaker notes in OpenDocument attachments (#38542)
geezoria Nov 22, 2026
f9b19a7
fix(server): folder discovery skips the walk when t3.json ignores the…
juliusmarminge Nov 22, 2026
28a4200
fix(server): checkpoint repository scopes walk the project folder onc…
Sidreyas Nov 22, 2026
c5fa33b
fix(server,cursor): preserve inline handoff when a failed Cursor turn…
MIT-Consulting Nov 22, 2026
0fb6ac6
perf(web): Markdown renders with Words as static islands under one sh…
juliusmarminge Nov 22, 2026
c1fbdf6
fix(web): pasting text copied from Word inserts the text instead of a…
juliusmarminge Nov 22, 2026
3b3f880
fix(web): wait for image uploads before sending (#40672)
Yash-Singh1 Nov 22, 2026
122d3bf
fix(server): provider refresh finds CLIs installed after launch on ma…
juliusmarminge Nov 22, 2026
b9d0f70
fix(mobile): replace undefined text-foreground-subtle token with text…
MIT-Consulting Nov 22, 2026
df67c4f
fix(antigravity): a long shell command keeps its start, not its last …
juliusmarminge Nov 22, 2026
4e28da0
fix(server): setup script output no longer ends in half an emoji (#40…
tiliakoos Nov 22, 2026
5045891
fix(server): text generation no longer falls back to a model that can…
tiliakoos Nov 22, 2026
4ac5e6e
fix(client-runtime): typing a bare Windows drive lists its folders (#…
brunobola Nov 22, 2026
c9e9e7d
fix(web): a click outside the scheduled task editor no longer discard…
Jardo-51 Nov 22, 2026
7966f20
fix(antigravity): pre-approve T3 MCP tools in Auto and Auto-accept ed…
charlesbine Nov 22, 2026
ad1b1f9
fix(server): Antigravity keeps Auto in the mode picker after a restar…
juliusmarminge Nov 22, 2026
11224f6
fix(client-runtime): a new thread's first message and a queued send-n…
Tgoh Nov 22, 2026
02ea261
fix(server): long webhook prompts in the delivery log no longer end i…
tiliakoos Nov 22, 2026
426b5a6
fix(server): a released ACP session no longer leaves its run stuck ru…
juliusmarminge Nov 22, 2026
cd3a57a
feat(web): sidebar thread rows show the environment instead of the br…
juliusmarminge Nov 22, 2026
6f49071
fix: a failed checkpoint capture keeps Edit from here for conversatio…
juliusmarminge Nov 22, 2026
15a3daa
docs(claude): mobile shows the compact chip too (#40755)
juliusmarminge Nov 22, 2026
e3f9db2
fix(server): TanStack Source pull requests open from every client, an…
juliusmarminge Nov 22, 2026
976aca3
fix: include delegated threads in CLI listing (#40738)
dajiaohuang Nov 22, 2026
bcace07
fix(pi): turn token usage counts cached tokens as input and stays per…
juliusmarminge Nov 22, 2026
4c3d83f
fix(mobile): usage account detail keeps even pace current while open …
juliusmarminge Nov 22, 2026
7f125d8
fix(server): Resume sends pending context to providers without native…
juliusmarminge Nov 22, 2026
90a8ac0
fix(server): a failed or cancelled clone no longer blocks re-cloning …
amanthanvi Nov 22, 2026
70b5e48
fix: retain pull request metadata in thread show (#40744)
dajiaohuang Nov 22, 2026
c3a330d
fix(web): show Queue for running sessions that cannot steer (#40767)
iiijiashu Nov 22, 2026
c198f73
fix(web): a click outside the project action editor no longer discard…
AymanKhan9 Nov 22, 2026
379a98a
fix(server): t3 pair skips Windows VirtualBox and VMware host-only ad…
juliusmarminge Nov 22, 2026
418e1ac
fix(server): Word text boxes keep their paragraph breaks for agents (…
KyrosHendrix Nov 22, 2026
356dff3
fix(web): RTF previews respect hidden character formatting (#40783)
geezoria Nov 22, 2026
5fc2eb2
fix(mobile): the iOS composer keeps its keyboard and caret after dict…
arun279 Nov 22, 2026
997103b
fix(shared): find file links whose labels contain brackets (#40781)
Abhiram-745 Nov 22, 2026
1acfd37
fix(web): restore effort picker keyboard typeahead (#40798)
juliusmarminge Nov 22, 2026
0ae3154
fix(server): migration 75 no longer fails on an unreadable subagent p…
juliusmarminge Nov 22, 2026
671e05b
fix(issues): an Activity cross-reference opens the issue or pull requ…
juliusmarminge Nov 22, 2026
8435a8c
fix(server): tell a stopped parent which delegated tasks its Stop int…
juliusmarminge Nov 22, 2026
f931f03
fix(server): worktree thread lookups match any spelling of the path (…
juliusmarminge Nov 22, 2026
c585a58
fix(mobile): prevent clipped percentages in usage limit cards (#40778)
peterxiemin Nov 22, 2026
9892474
test(web): browser tests no longer fail when a stale optimizer cache …
Brechard Nov 22, 2026
62a7108
fix(github): superseded runs' cancelled checks no longer block PR wat…
juliusmarminge Nov 22, 2026
a8363da
fix(web): keybindings using '+' show a plus keycap instead of empty p…
AymanKhan9 Nov 22, 2026
d27d29f
fix(web): lineage show-more no longer clips the last row or drops foc…
justsrc Nov 22, 2026
4868aeb
fix(mobile): pulling to Load earlier activity no longer snaps the fee…
juliusmarminge Nov 22, 2026
aa0a851
perf(dev): incremental, cached server typecheck like web and desktop …
Pyseph Nov 22, 2026
a35b3ca
fix(contracts): delegate_task options example says ids differ by prov…
juliusmarminge Nov 22, 2026
d834a4e
fix(web): preserve reply-only edits when a queued message leaves the …
iiijiashu Nov 22, 2026
3c68308
fix(server): t3 start ignores a stale runtime record whose PID was re…
juliusmarminge Nov 22, 2026
9f19a6d
fix(server): runtime prune removes the runtime a committed update rep…
juliusmarminge Nov 22, 2026
f2d0217
fix(server): preserve cancellations during checkpoint capture (#31349)
voltcrash Nov 22, 2026
91d2d90
fix(web): a failed main chunk load reloads once instead of showing th…
juliusmarminge Nov 22, 2026
ecdd8e2
fix(server): slash commands reach the provider verbatim when context …
juliusmarminge Nov 22, 2026
c80f41f
fix(opencode): a command that never calls the model no longer leaves …
juliusmarminge Nov 22, 2026
3d7bb17
fix(mobile): model search finds legacy models (#27587)
juliusmarminge Nov 22, 2026
5799b8a
fix(acp): follow a mode the agent leaves on its own so picking it aga…
juliusmarminge Nov 22, 2026
bcb9217
fix(web): settling a thread no longer jolts the sidebar list (#26661)
flamboh Nov 22, 2026
4136ab6
fix(server): Word files whose main part is not word/document.xml reac…
Marve10s Nov 22, 2026
03920ad
fix(server): wake the agent when Claude exits while it awaits backgro…
juliusmarminge Nov 22, 2026
3571f28
fix(web): Usage Limits no longer shows a stale scrollbar (#40816)
inanimran Nov 22, 2026
77d299c
fix(web): closing the last open pull request clears it from the list …
MyDigitalLife Nov 22, 2026
31790d8
fix(mobile): account badge on the provider icon is readable without a…
juliusmarminge Nov 22, 2026
66ca7cd
fix(server): Claude turns no longer stall on empty or partial stream …
lln556 Nov 22, 2026
ac62463
fix(server): filesystem browse lists symlinks pointing to directories…
lln556 Nov 22, 2026
d5497d6
fix(client-runtime): a resumed thread renders its catch-up once inste…
ahalekelly Nov 22, 2026
501e39d
fix(web): clicking the Tab hint inserts short prompt suggestions agai…
floklein Nov 22, 2026
1e78f37
fix(web): keep script-only drafts reachable in the sidebar (#25272)
juliusmarminge Nov 22, 2026
b23f1e8
fix(server): retire unresponsive shared Codex app-servers (#25123)
juliusmarminge Nov 22, 2026
a985332
fix(shared): Windows command discovery no longer blocks the event loo…
maria-rcks Nov 22, 2026
b479ce2
fix(client-runtime): stop sessions on incompatible server configurati…
juliusmarminge Nov 22, 2026
620cf47
fix(web): browser page translation no longer crashes the app when a t…
juliusmarminge Nov 22, 2026
30372d0
perf(mobile): keep image bytes outside draft JSON (#9727)
t3dotgg Nov 22, 2026
ad2bdc7
fix(server): watch_pull_request says when checks already passed (#40866)
juliusmarminge Nov 22, 2026
a445025
fix(codex): Open diff shows every file of a multi-file patch (#40874)
Abhiram-745 Nov 22, 2026
2f19cec
fix(server): ACP startup gives up when the agent never answers the ha…
juliusmarminge Nov 22, 2026
1d02824
fix(server): a branch prefixed with another remote's name publishes u…
Abhiram-745 Nov 22, 2026
f10e1eb
fix(server): list open delegated tasks when task_status or task_cance…
Project516 Nov 22, 2026
2251de4
fix(gitlab): find merge requests opened from a fork (#40894)
Abhiram-745 Nov 22, 2026
2c4310e
fix(web): pasting a chat message with text and a picture keeps both (…
juliusmarminge Nov 22, 2026
344de5f
fix(antigravity): bound silent post-settle background command holds (…
Lokkuchakreshkumar Nov 22, 2026
5ddcc25
fix(desktop): WSL is not offered or started when only the Windows ins…
juliusmarminge Nov 22, 2026
ad44645
fix(server): idle /ws connections behind a reverse proxy no longer dr…
juliusmarminge Nov 22, 2026
cc4bb17
fix(server): thread reads no longer attribute T3 Code's compact-befor…
juliusmarminge Nov 22, 2026
9de4ec1
fix(web,mobile): @-file mentions show by name in message previews, no…
tiliakoos Nov 22, 2026
7ddc81d
fix(web): tool calls stay grouped after a usage-limit pause again (#4…
matthew-waters Nov 22, 2026
ec35ad6
fix(server): t3 doctor no longer reports a database just under 1 GiB …
tiliakoos Nov 22, 2026
6972026
fix(web): show clone failure after progress is dismissed (#40951)
StiensWout Nov 22, 2026
bc13afa
Invalidate pending theme imports when a replacement is too large (#40…
StiensWout Nov 22, 2026
4e1c1fe
fix(mobile): show linked thread history page errors (#40973)
StiensWout Nov 22, 2026
3806763
fix(client-runtime): skip waiting for lower-priority linked addresses…
StiensWout Nov 22, 2026
25440f5
fix(web): navigate Excel sheets from the focused tab (#41008)
StiensWout Nov 22, 2026
9b7f5eb
fix(mobile): bound app-owned composer attachment filenames (#40991)
StiensWout Nov 22, 2026
0179401
fix(web): prioritize visible saved notebook outputs (#40998)
StiensWout Nov 22, 2026
87554a7
fix(web): editing a queued message keeps its attachment chips resolve…
smirea Nov 22, 2026
28706ac
fix(server): unlinking an environment ends its session on the other m…
juliusmarminge Nov 22, 2026
7ed41b7
fix(mobile): scope Git result banners to their originating thread (#4…
StiensWout Nov 22, 2026
000ba18
fix(web): keep the conversation when a pairing tab closes (#41025)
StiensWout Nov 22, 2026
5bd0616
fix: restart linked thread reads when trying again (#41020)
StiensWout Nov 22, 2026
55880c4
fix(client-runtime): count ambiguous projects in chat file links (#40…
StiensWout Nov 22, 2026
2e62a71
fix(mobile): keep media actions on each sent image page (#41018)
StiensWout Nov 22, 2026
024dba2
perf(server): a run's provider turn lookup is linear, not quadratic (…
navidnadali Nov 22, 2026
c7df700
fix(web): a photo picked on a phone attaches even when the composer c…
juliusmarminge Nov 22, 2026
02a4c18
fix(mobile): cancel pending media actions when swiping gallery pages …
StiensWout Nov 22, 2026
c00f117
fix(mobile): TalkBack can reach the status pill above the composer (#…
Lenoridev Nov 22, 2026
67f1752
fix(web): snooze labels follow the app language (#39494)
SoroushRF Nov 22, 2026
dbb5bdb
feat(web): sidebar folder button picks or adds a project (#33057)
tenyoru Nov 22, 2026
fff245a
feat(mobile): favorites only is its own model filter, not a provider …
RVZO6 Nov 22, 2026
f9fbb00
feat(devices): double-tap Home opens the app switcher (#29459)
JoshuaRileyDev Nov 22, 2026
735c1e7
test(desktop): AppImage shim test's fake server ignores a second stop…
juliusmarminge Nov 22, 2026
7e3a9ba
fix(server): a task folder creation that loses a branch race no longe…
juliusmarminge Nov 22, 2026
e213da2
fix(client-runtime): refresh stale server clock offset after host sle…
Zangetsu101 Nov 22, 2026
68e81cd
fix(server): settled-subagent check reads run status from runs_run_st…
juliusmarminge Nov 22, 2026
324ac49
fix(server): fresh-session scheduled runs release every idle Codex th…
juliusmarminge Nov 22, 2026
fe9c98c
feat: agents can report T3 Code problems when you turn feedback on (#…
gabrielelpidio Nov 22, 2026
c89ca0a
fix(server): a worktree thread moved to the project checkout no longe…
tiliakoos Nov 22, 2026
a3323d4
perf(web): new thread opens its draft without waiting on t3.json (#41…
juliusmarminge Nov 22, 2026
dd19bce
fix(server): a dropped dictation client frees the speech engine withi…
juliusmarminge Nov 22, 2026
0938476
fix(web): Thinking row no longer shows below a streaming reply (#41060)
juliusmarminge Nov 22, 2026
7103527
fix(web): PR description file links resolve in the PR's repository fr…
juliusmarminge Nov 22, 2026
44979a5
fix(mcp): keep deleted schedules from returning on edit (#41084)
SSHdotCodes Nov 22, 2026
a09738f
fix(claude): start the updated Claude Code CLI when a thread changes …
SSHdotCodes Nov 22, 2026
fb4558d
fix(web,mobile,server): large files load in full without freezing the…
juliusmarminge Nov 22, 2026
ba947e3
fix(desktop): show ampersands in native context menu labels (#41097)
brunobola Nov 22, 2026
0ee3a92
fix(forgejo): follow Markdown pull request templates (#41095)
steven-salinas Nov 22, 2026
6ba17d9
fix(claude): show steer replies and progress lines written as thinkin…
SSHdotCodes Nov 22, 2026
fb23f12
feat(server): outside agents poll and stream milestones as MCP events…
juliusmarminge Nov 22, 2026
9d35540
fix(mobile): pasted iOS photos keep their encoding and repeats are dr…
juliusmarminge Nov 22, 2026
7b47a21
fix(server): a Claude resume runs one turn, not a phantom wake after …
juliusmarminge Nov 23, 2026
0591d32
feat(issues): connect more than one Linear account (#39179)
Bil0000 Nov 23, 2026
43af49b
fix(server): keep inactive threads whose branch has an open PR (#41116)
only21mil Nov 23, 2026
1b59af0
fix(mobile): enlarge PR file Viewed tap target (#39950)
Ernest0-Production Nov 23, 2026
05c100f
fix(server): skip queued checkpoint restores after thread deletion (#…
only21mil Nov 23, 2026
65b2e6d
fix(web): stop telemetry refresh spinning after data arrives (#41122)
SSHdotCodes Nov 23, 2026
d65d1d2
Merge upstream/main into fork-sync-20261123
syz51 Nov 23, 2026
bebfa17
fix(fork): inline code file links keep the worktree root under upstre…
syz51 Nov 23, 2026
9fc3c67
fix(fork): an exit still wakes the agent for a stopped task it awaited
syz51 Nov 23, 2026
f9af3a1
fix(fork): only a stop that no turn saw is owed on exit
syz51 Nov 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions apps/desktop/src/app/DesktopCliShim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ const fakeAppImage = (canMount = true, app = REPORTER) => {
return { root, image, appImage, shim };
};

// Stays up after a signal until the test lets it finish, like a server shutting down.
// Stays up after a signal until the test lets it finish, like a server shutting down. A group
// signal and the launcher's forwarded one can both arrive; a re-run trap would read stdin's EOF.
const SLOW_SERVER = [
"#!/bin/sh",
"trap 'echo stopping >&3; read go; echo \"stopped $go\" >&3; exit 7' TERM HUP",
'trap \'trap "" TERM HUP; echo stopping >&3; read go; echo "stopped $go" >&3; exit 7\' TERM HUP',
"echo ready",
"while :; do sleep 0.05; done",
"",
Expand Down
45 changes: 45 additions & 0 deletions apps/desktop/src/electron/ElectronMenu.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { assert, describe, it } from "@effect/vitest";
import * as HostProcess from "@t3tools/shared/HostProcess";
import type * as Electron from "electron";
import * as Effect from "effect/Effect";
import * as Option from "effect/Option";
import { vi } from "vite-plus/test";

const { menu } = vi.hoisted(() => ({
menu: { template: [] as Electron.MenuItemConstructorOptions[] },
}));

vi.mock("electron", () => ({
Menu: {
buildFromTemplate: (template: Electron.MenuItemConstructorOptions[]) => {
menu.template = template;
return { popup: (options: Electron.PopupOptions) => options.callback?.() };
},
},
}));

import * as ElectronMenu from "./ElectronMenu.ts";

describe("ElectronMenu", () => {
it.effect("shows ampersands in labels instead of reading them as mnemonics", () =>
Effect.gen(function* () {
const electronMenu = yield* ElectronMenu.make;
yield* electronMenu.showContextMenu({
window: { webContents: { getZoomFactor: () => 1 } } as Electron.BrowserWindow,
items: [
{ id: "filter", label: "Filter by R&D" },
{ id: "more", label: "A&B", children: [{ id: "child", label: "C && D" }] },
],
position: Option.none(),
source: Option.none(),
});

assert.deepEqual(
menu.template.map((item) => item.label),
["Filter by R&&D", "A&&B"],
);
const submenu = menu.template[1]!.submenu as Electron.MenuItemConstructorOptions[];
assert.equal(submenu[0]!.label, "C &&&& D");
}).pipe(Effect.provideService(HostProcess.Platform, "win32")),
);
});
3 changes: 2 additions & 1 deletion apps/desktop/src/electron/ElectronMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ export const make = Effect.gen(function* () {
}

const itemOption: Electron.MenuItemConstructorOptions = {
label: item.label,
// Electron reads a single & as a mnemonic marker and drops it.
label: item.label.replaceAll("&", "&&"),
enabled: !item.disabled,
...(typeof item.checked === "boolean" ? { type: "checkbox", checked: item.checked } : {}),
};
Expand Down
56 changes: 26 additions & 30 deletions apps/desktop/src/ipc/methods/window.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import type { ManagedPolicyLimits } from "@t3tools/contracts";
import { EDITORS, REMOTE_CAPABLE_EDITOR_IDS } from "@t3tools/contracts";
import { resolveEditorCommand } from "@t3tools/shared/editor";
import * as HostProcess from "@t3tools/shared/HostProcess";
import { makePathDirectoryListings, PathDirectoryListings } from "@t3tools/shared/shell";
import { ManagedPolicyFileError } from "@t3tools/shared/managedPolicyFile";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Stream from "effect/Stream";
import * as TestClock from "effect/testing/TestClock";
import { vi } from "vite-plus/test";
import type * as Electron from "electron";

Expand Down Expand Up @@ -550,6 +552,7 @@ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
);

describe("probeRemoteEditors PATH scan", () => {
const FIXTURE_MTIME = 1_767_225_600;
const platform = HostProcess.Platform.defaultValue();
const launcherName = (command: string) => (platform === "win32" ? `${command}.cmd` : command);

Expand All @@ -570,6 +573,9 @@ describe("probeRemoteEditors PATH scan", () => {
yield* fs.writeFileString(file, "#!/bin/sh\n");
if (platform !== "win32") yield* fs.chmod(file, 0o755);
}
// A listing of a directory changed moments ago is not kept, so age them past that window.
for (const dir of dirs) yield* fs.utimes(dir, FIXTURE_MTIME, FIXTURE_MTIME);
yield* TestClock.setTime((FIXTURE_MTIME + 60) * 1000);
return {
root,
env: {
Expand All @@ -581,19 +587,15 @@ describe("probeRemoteEditors PATH scan", () => {
};
});

const countingFileSystem = (counter: { stat: number; reads: Map<string, number> }) =>
const countingFileSystem = (reads: Map<string, number>) =>
Layer.effect(
FileSystem.FileSystem,
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
return FileSystem.FileSystem.of({
...fs,
stat: (target) => {
counter.stat += 1;
return fs.stat(target);
},
readDirectory: (target, options) => {
counter.reads.set(target, (counter.reads.get(target) ?? 0) + 1);
reads.set(target, (reads.get(target) ?? 0) + 1);
return fs.readDirectory(target, options);
},
});
Expand All @@ -612,44 +614,38 @@ describe("probeRemoteEditors PATH scan", () => {
return available;
});

it.effect("reads each PATH directory once instead of stat-ing every candidate per editor", () =>
it.effect("finds the editors a serial scan finds, listing each PATH directory at most once", () =>
Effect.gen(function* () {
const { env: baseEnv } = yield* makeFakePath();
const delimiter = platform === "win32" ? ";" : ":";
const uncachedCounter = { stat: 0, reads: new Map<string, number>() };
const cachedCounter = { stat: 0, reads: new Map<string, number>() };
const uncachedEnv = { ...baseEnv, PATH: `${baseEnv.PATH}${delimiter}${baseEnv.HOME}x1` };
const cachedEnv = { ...baseEnv, PATH: `${baseEnv.PATH}${delimiter}${baseEnv.HOME}x2` };
const uncached = yield* serialReference(uncachedEnv).pipe(
Effect.provide(countingFileSystem(uncachedCounter)),
const reads = new Map<string, number>();
// Distinct PATH values keep one scan from answering the other out of the resolution cache.
const serialEnv = { ...baseEnv, PATH: `${baseEnv.PATH}${delimiter}${baseEnv.HOME}x1` };
const probeEnv = { ...baseEnv, PATH: `${baseEnv.PATH}${delimiter}${baseEnv.HOME}x2` };
const serial = yield* serialReference(serialEnv).pipe(
Effect.provideServiceEffect(PathDirectoryListings, makePathDirectoryListings),
);
const cached = yield* probeRemoteEditors
const probed = yield* probeRemoteEditors
.handler(undefined)
.pipe(
Effect.provideService(HostProcess.Environment, cachedEnv),
Effect.provideService(HostProcess.Environment, probeEnv),
Effect.provideService(HostProcess.Platform, platform),
Effect.provide(countingFileSystem(cachedCounter)),
Effect.provide(countingFileSystem(reads)),
Effect.provideServiceEffect(PathDirectoryListings, makePathDirectoryListings),
);
// The host can add editors from app folders the fixture can't redirect (e.g. /Applications).
const fixtureEditors = ["cursor", "vscode", "zed", "webstorm"];
assert.deepStrictEqual(
uncached.filter((id) => fixtureEditors.includes(id)),
serial.filter((id) => fixtureEditors.includes(id)),
fixtureEditors,
);
assert.deepStrictEqual(cached, uncached);
assert.isAbove(uncachedCounter.stat, 0);
// On every platform the probe lists each PATH directory at most once. Only PATH entries count:
// resolveEditorCommand also reads app folders such as /Applications on macOS.
const pathReads = cachedEnv.PATH.split(delimiter)
assert.deepStrictEqual(probed, serial);
// Only PATH entries count: resolveEditorCommand also reads app folders such as /Applications
// on macOS. PATH directories are listed on Windows only, once even for concurrent probes.
const pathReads = probeEnv.PATH.split(delimiter)
.filter((entry) => entry.length > 0)
.map((entry) => cachedCounter.reads.get(entry) ?? 0);
assert.isAbove(Math.max(...pathReads), 0);
assert.isAtMost(Math.max(...pathReads), 1);
// Without the listings, Windows stats every PATH entry x PATHEXT candidate for each editor;
// elsewhere there is no PATHEXT, so the stat count is about the same either way.
if (platform === "win32") {
assert.isBelow(cachedCounter.stat, uncachedCounter.stat / 2);
}
.map((entry) => reads.get(entry) ?? 0);
assert.strictEqual(Math.max(...pathReads), platform === "win32" ? 1 : 0);
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
);
});
4 changes: 1 addition & 3 deletions apps/desktop/src/ipc/methods/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from "@t3tools/contracts";
import { PROJECT_FAVICON_EXTENSIONS } from "@t3tools/shared/projectFavicon";
import { resolveEditorCommand } from "@t3tools/shared/editor";
import { withPathDirectoryListings } from "@t3tools/shared/shell";
import * as HostProcess from "@t3tools/shared/HostProcess";
import { isRelayTracingEnabled } from "@t3tools/shared/otelEnvironment";
import * as FileSystem from "effect/FileSystem";
Expand Down Expand Up @@ -446,7 +445,6 @@ export const probeRemoteEditors = DesktopIpc.makeIpcMethod({
result: Schema.Array(EditorId),
handler: Effect.fn("desktop.ipc.window.probeRemoteEditors")(function* () {
const env = yield* HostProcess.Environment;
// Shared listings stop each editor re-stating every PATH entry x PATHEXT candidate on Windows.
const resolved = yield* Effect.forEach(
REMOTE_CAPABLE_EDITOR_IDS,
(editorId) => {
Expand All @@ -456,7 +454,7 @@ export const probeRemoteEditors = DesktopIpc.makeIpcMethod({
: Effect.succeed(false);
},
{ concurrency: REMOTE_EDITOR_PROBE_CONCURRENCY },
).pipe(withPathDirectoryListings);
);
return REMOTE_CAPABLE_EDITOR_IDS.filter((_, index) => resolved[index]);
}),
});
Expand Down
42 changes: 41 additions & 1 deletion apps/desktop/src/wsl/DesktopWslEnvironment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,40 @@ describe("parseResolvedPath", () => {

// Path.layer joins with POSIX separators here, so the test windir is a POSIX path.
const WSL_EXE = "/windows/System32/wsl.exe";
const STORE_SERVICE = "HKLM\\SYSTEM\\CurrentControlSet\\Services\\WSLService";
const INBOX_SERVICE = "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LxssManager";

const registrySpawner = (keys: ReadonlyArray<string>) =>
ChildProcessSpawner.make((command) =>
Effect.succeed(
ChildProcessSpawner.makeHandle({
pid: ChildProcessSpawner.ProcessId(1),
stdout: Stream.empty,
stderr: Stream.empty,
all: Stream.empty,
exitCode: Effect.succeed(
ChildProcessSpawner.ExitCode(
command._tag === "StandardCommand" &&
command.command === "reg.exe" &&
keys.some((key) => command.args.includes(key))
? 0
: 1,
),
),
isRunning: Effect.succeed(false),
kill: () => Effect.void,
stdin: Sink.drain,
getInputFd: () => Sink.drain,
getOutputFd: () => Stream.empty,
unref: Effect.succeed(Effect.void),
}),
),
);

const isAvailable = (policy?: Parameters<typeof DesktopManagedPolicy.layerTest>[0]) =>
const isAvailable = (
policy?: Parameters<typeof DesktopManagedPolicy.layerTest>[0],
serviceKeys: ReadonlyArray<string> = [STORE_SERVICE],
) =>
makeIsAvailable("win32", "/windows").pipe(
Effect.provide(
Layer.mergeAll(
Expand All @@ -565,9 +597,17 @@ const isAvailable = (policy?: Parameters<typeof DesktopManagedPolicy.layerTest>[
DesktopManagedPolicy.layerTest(policy),
),
),
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, registrySpawner(serviceKeys)),
);

describe("makeIsAvailable", () => {
it.effect("needs a registered WSL service, not just the System32 install stub", () =>
Effect.gen(function* () {
assert.isFalse(yield* isAvailable(undefined, []));
assert.isTrue(yield* isAvailable(undefined, [INBOX_SERVICE]));
}),
);

it.effect("turns WSL off on a machine with a managed policy, even an invalid one", () =>
Effect.gen(function* () {
assert.isTrue(yield* isAvailable());
Expand Down
42 changes: 41 additions & 1 deletion apps/desktop/src/wsl/DesktopWslEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1119,13 +1119,50 @@ const getUserHomeImpl = (
Effect.orElseSucceed(() => Option.none<string>()),
);

// Store/MSI WSL registers WSLService and inbox WSL registers LxssManager; either key means installed.
const WSL_SERVICE_KEYS = [
"HKLM\\SYSTEM\\CurrentControlSet\\Services\\WSLService",
"HKLM\\SYSTEM\\CurrentControlSet\\Services\\LxssManager",
] as const;
const SERVICE_QUERY_TIMEOUT = Duration.seconds(5);

const wslServiceRegistered = Effect.scoped(
Effect.gen(function* () {
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
const registered = yield* Effect.forEach(
WSL_SERVICE_KEYS,
(key) =>
spawner
.spawn(
ChildProcess.make("reg.exe", ["query", key], {
stdin: "ignore",
stdout: "ignore",
stderr: "ignore",
killSignal: "SIGTERM",
forceKillAfter: PROCESS_TERMINATE_GRACE,
}),
)
.pipe(Effect.flatMap((handle) => handle.exitCode)),
{ concurrency: "unbounded" },
);
return registered.some((exitCode) => (exitCode as unknown as number) === 0);
}),
).pipe(
Effect.timeoutOption(SERVICE_QUERY_TIMEOUT),
Effect.map(Option.getOrElse(() => false)),
Effect.orElseSucceed(() => false),
);

export const makeIsAvailable = Effect.fn("DesktopWslEnvironment.makeIsAvailable")(function* (
platform: NodeJS.Platform,
windir: string,
): Effect.fn.Return<
boolean,
never,
FileSystem.FileSystem | Path.Path | DesktopManagedPolicy.DesktopManagedPolicy
| FileSystem.FileSystem
| Path.Path
| DesktopManagedPolicy.DesktopManagedPolicy
| ChildProcessSpawner.ChildProcessSpawner
> {
if (platform !== "win32") return false;
const path = yield* Path.Path;
Expand All @@ -1134,6 +1171,8 @@ export const makeIsAvailable = Effect.fn("DesktopWslEnvironment.makeIsAvailable"
if (!(yield* fileSystem.exists(wslExePath).pipe(Effect.orElseSucceed(() => false)))) {
return false;
}
// System32\wsl.exe is also an install stub on Windows without WSL, so check for its service.
if (!(yield* wslServiceRegistered)) return false;
// A server in WSL reads Linux's policy, never this machine's, so a managed machine runs none.
return yield* (yield* DesktopManagedPolicy.DesktopManagedPolicy).read.pipe(
Effect.map((found) => found === undefined),
Expand Down Expand Up @@ -1245,6 +1284,7 @@ export const layer = Layer.effect(
// Cache availability so synchronous IPC bootstrap can read it without yielding to filesystem I/O.
const wslAvailable = yield* makeIsAvailable(environment.platform, windir).pipe(
Effect.provideService(FileSystem.FileSystem, fileSystem),
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
Effect.provideService(Path.Path, environment.path),
Effect.provideService(
DesktopManagedPolicy.DesktopManagedPolicy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public class T3ComposerEditorModule: Module {
"onComposerBlur",
"onComposerSubmit",
"onComposerPasteImages",
"onComposerPasteImagesPending",
"onComposerContextPress",
"onComposerPasteContext",
"onComposerPasteText",
Expand Down
Loading
Loading