Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
186 commits
Select commit Hold shift + click to select a range
86cdf80
fix(web): sidebar edge uses the same resize cursor as side panels (#3…
tenyoru Nov 15, 2026
ab319a5
fix(web): attach command palette threads outside the sidebar (#37054)
Yash-Singh1 Nov 15, 2026
d8b80a1
fix(server): status reports no branch while a clone has not checked o…
juliusmarminge Nov 15, 2026
97edb7a
perf(scripts): check:changed on Windows no longer spends minutes walk…
Pyseph Nov 15, 2026
4117bd4
perf(web): answering a question no longer re-renders the whole chat v…
OmarAlex24 Nov 15, 2026
a5d21a3
perf(server): command palette status rows skip the Changes totals the…
Yuruzuu Nov 15, 2026
aace48b
fix(web): PR file order follows alias imports of dotted modules (#32364)
jancuk Nov 15, 2026
015eba4
fix(acp): a failed MCP-over-ACP disconnect can be retried (#33069)
notzenco Nov 15, 2026
1b04bab
fix(web): settle check lines up with row timestamps (#33053)
sergiiopm Nov 15, 2026
9ec7143
fix(provider-core): handoff work reserve fits small context windows (…
MiaAI-Lab Nov 15, 2026
fbfebc8
fix(mobile): video previews survive re-signed URLs and a late-attache…
bartlomiejbloniarz Nov 15, 2026
7ced2ca
fix(mobile): honor Android clock format in message timestamps (#33078)
razzeee Nov 15, 2026
528c77f
fix(shared): .localdomain hosts no longer leak to the favicon service…
mrlufepines Nov 15, 2026
7f575e6
fix(web): collapsing Electron main no longer hides the backend server…
thepradipvc Nov 15, 2026
b1050d3
test: remove duplicate client call-site coverage (#36776)
t3-code-bot[bot] Nov 15, 2026
2d80ca0
fix(github): pull request activity reports a rate-limited review-thre…
only21mil Nov 15, 2026
f52fba4
fix(web): stacked composer banners no longer show dark seam bands (#3…
Pulsar-Programmer Nov 15, 2026
8e06750
fix(web): draft images keep their order after a reload (#32709)
only21mil Nov 15, 2026
71adeef
fix(web): open PDF links in the file viewer (#37064)
Yash-Singh1 Nov 15, 2026
ab2420f
fix(server): a selected-file commit keeps other files' merge conflict…
only21mil Nov 15, 2026
9a79883
fix(web): a file opened from a diff in a project folder inside a repo…
Entrpi Nov 15, 2026
294a841
test(web): ACP project picker test waits for the popup to take focus …
seancarnahan Nov 15, 2026
147de34
fix(web): stop held dictation when shortcut modifiers are released (#…
mrlufepines Nov 15, 2026
2386789
perf(web): resting on a PR row also reads its activity, so the timeli…
Bil0000 Nov 15, 2026
62d33c1
fix(server): agents can see whether a thread is pinned (#32727)
shadizx Nov 15, 2026
52c6208
fix(server): a pushed commit no longer reports failure when the final…
only21mil Nov 15, 2026
da9c848
test(web): the streaming render scenario gives the timeline stable pr…
Entrpi Nov 15, 2026
3a1dfb7
fix(web): HTML file previews use the current canvas color (#37072)
Yash-Singh1 Nov 15, 2026
ca31ab6
fix(web): an image-only send that fails behind a new draft now says s…
only21mil Nov 15, 2026
40f63b4
fix(assets): align app icons and retain a folder placeholder while lo…
Yash-Singh1 Nov 15, 2026
ab45ce7
fix(github): pull request activity says when its comments were cut (#…
only21mil Nov 15, 2026
742a912
test(github): activity mock sets the new truncated flag (#37078)
juliusmarminge Nov 15, 2026
9f815c9
fix(server): a branch's own pull request shows past a hundred same-na…
only21mil Nov 15, 2026
033ae7c
fix(server): an effect this build can't read no longer blocks its thr…
only21mil Nov 15, 2026
781ab05
fix(acp-registry): a failed agent install no longer floods provider s…
only21mil Nov 15, 2026
3fe1dd9
fix(web): terminal reports focus changes to programs that request the…
StiensWout Nov 15, 2026
37b71a4
fix(web): remove redundant subagent action from background row (#37079)
Yash-Singh1 Nov 15, 2026
4fa5f0e
fix(web): a side chat's subagent opens its parent as a side chat tab,…
Yuruzuu Nov 15, 2026
79e47e9
fix(shared): inline code paths like `docker/Dockerfile` become file c…
felixlaga Nov 15, 2026
63b5645
fix(web): Esc in Clerk's account modal no longer closes Settings (#32…
thepradipvc Nov 15, 2026
d738edf
fix(mobile): show thread sync status in the header, not above the com…
juliusmarminge Nov 15, 2026
154c0fd
fix(mobile): undo toast lines up with the folded Duo's tab bar (#37081)
juliusmarminge Nov 15, 2026
ca0ca71
fix(desktop): Stable switch no longer tells policy-blocked nightly ap…
only21mil Nov 15, 2026
2f30d98
fix(web): live dictation transcript keeps the newest words in view (#…
SharoonRafeek Nov 15, 2026
0720280
fix(server): preserve shell paths containing spaces and dashes (#37069)
StiensWout Nov 15, 2026
efddcfe
perf(server): batch terminal output that arrives within 2 ms (#37060)
juliusmarminge Nov 15, 2026
5d58954
perf(desktop): WSL preflight starts the staged runtime once instead o…
juliusmarminge Nov 15, 2026
93f8563
fix(mobile): worktree setup shows in the chat from the first moment (…
juliusmarminge Nov 15, 2026
f36c835
fix(server): an MCP pin lands at the top of the Pinned section (#33978)
xwchen Nov 15, 2026
9de4a2f
fix(mobile): keep Diagnostics and Client Storage content above floati…
j-gaertig Nov 15, 2026
5e0127c
fix(acp-registry): observe delayed model discovery and avoid stale ca…
hxbib Nov 15, 2026
986975e
test(web): Settings Esc test waits for the modal's initial focus (#37…
juliusmarminge Nov 15, 2026
52451a7
fix(claude): keep monitor threads waiting between updates (#37085)
Yash-Singh1 Nov 15, 2026
278e47d
fix(mobile): the iPhone Duo's sidebar list ends above its tab bar in …
juliusmarminge Nov 15, 2026
2dc5ebd
fix(web): switching providers no longer drops the thread's stored eff…
only21mil Nov 15, 2026
aaf5b9c
fix(mobile): PR activity filter remembers bot and resolved visibility…
juliusmarminge Nov 15, 2026
2cb2fa1
fix(web): terminal links open bare compiler filenames (#37071)
StiensWout Nov 15, 2026
b35c970
fix(acp): optional text questions can be left blank (#36997)
shivamhwp Nov 15, 2026
4ab3b98
fix(shared): MCP apps that fall back to a blob: frame no longer rende…
u9g Nov 15, 2026
2045004
fix(shared): keep coalescing workers alive when processors throw (#32…
luke2x Nov 15, 2026
9618837
fix(server): an empty Antigravity MCP config still allows text genera…
saphid Nov 15, 2026
570640b
perf(server): active thread reads filter on the archived_at column (#…
mahirozdin Nov 15, 2026
6444087
perf(resource-monitor): look up external process identities by PID (#…
hieu-lee Nov 15, 2026
3ee4aa6
fix(server): accept ASCII whitespace in base64 image payloads (#31798)
darshmahadevia Nov 15, 2026
8c80003
perf(server): Codex skills for four workspaces load in a median 138 m…
Yuruzuu Nov 15, 2026
f2c9449
fix(web): recover expired composer uploads before sending (#32910)
Adamulek123 Nov 15, 2026
32c069e
fix(server): content search recovers after a slow first index (#33138)
ItsThierry Nov 15, 2026
e101cae
fix(terminal): show shell startup failures across attachments (#37088)
StiensWout Nov 15, 2026
4f82964
perf(server): long threads open about 2.5x faster (#34014)
valuin Nov 15, 2026
50a2f5b
perf(server): long threads open about 2.5x faster (#34014)
valuin Nov 15, 2026
4564962
fix(mobile): inline markdown images page through their message's imag…
juliusmarminge Nov 15, 2026
bcdd6a5
fix(mobile): /model suggestion opens the model picker (#37109)
StiensWout Nov 15, 2026
178570d
fix(desktop): release cancelled Codex callback listeners during brows…
romil-bijarnia Nov 15, 2026
94edd64
perf(server): skip compression for the desktop's local connection (#3…
voltcrash Nov 15, 2026
f28c74a
fix(server): outside MCP clients stop being offered thread-bound tool…
RVZO6 Nov 15, 2026
c8a1b5f
fix(ssh): preserve literal home paths in Include expansion (#33288)
Lucenx9 Nov 15, 2026
2b83dd0
fix(server): finish closed terminal kills before shutdown (#37113)
StiensWout Nov 15, 2026
7d9c365
fix(web): keep distinct images with matching attachment metadata (#37…
StiensWout Nov 15, 2026
8dba23e
fix(web): large terminal pastes reach the program intact (#37103)
StiensWout Nov 15, 2026
f0a3321
fix(server): settling a thread keeps exec and foreground Bash termina…
juliusmarminge Nov 15, 2026
96290af
fix(codex): keep browser access prompts available in full access (#37…
Yash-Singh1 Nov 15, 2026
46f3ab3
fix(web): open terminal file links naming the server hostname (#37133)
StiensWout Nov 15, 2026
1b14aad
fix(mobile): recheck the current branch before selecting it (#37121)
StiensWout Nov 15, 2026
834eb51
fix(acp): wait for session/load to reply before prompting (#37139)
shivamhwp Nov 15, 2026
d8c7855
fix(web): terminal mouse reports hit the drawn cell (#37148)
StiensWout Nov 15, 2026
def4cd4
fix(server): run_scheduled_task_now returns why a started run failed …
SouthCarpet Nov 15, 2026
70abb6c
fix(azure-devops): pull request titles like `@notes.txt` are saved as…
juliusmarminge Nov 15, 2026
789d10f
fix(web): Sharing & access can select a desktop-local WSL backend (#3…
juliusmarminge Nov 15, 2026
0afd8c0
fix(mobile): pasted GIFs on iOS keep their animation (#37143)
StiensWout Nov 15, 2026
4b9cf57
fix(acp): Copilot's reply after a background agent wakes it opens a c…
juliusmarminge Nov 15, 2026
a16796b
fix(shared): ß no longer splits words in generated folder and branch …
lowlyleon Nov 15, 2026
86a9d9f
fix(server): name the missing project when a change request's reposit…
Sidreyas Nov 15, 2026
ff9dca8
fix(server): an oversized provider request reads as too large, not ra…
Sidreyas Nov 15, 2026
649d9fc
fix(provider-acp): Grok early task completion no longer replaces the …
juliusmarminge Nov 15, 2026
7379f19
fix(web): keypad navigation works with NumLock off (#37175)
StiensWout Nov 15, 2026
8897a6e
fix(web): keep thread mentions when editing sent messages (#37183)
StiensWout Nov 15, 2026
dcaedc9
fix(server): skills linked by a SessionStart hook appear in the $ pic…
caitlon Nov 15, 2026
2becf31
fix(server): Windows spawn workers no longer leak a short child's out…
juliusmarminge Nov 15, 2026
be8c4c6
fix(web): repaint terminal when programs change default colors (#37193)
StiensWout Nov 15, 2026
cb251b9
fix(web): composer suggestions stay reachable in short windows (#37179)
StiensWout Nov 15, 2026
6071022
fix(server): Claude session name follows thread renames without waiti…
juliusmarminge Nov 15, 2026
6d3f642
fix(web): Enter sends when a panel-conditioned shortcut is inactive (…
StiensWout Nov 15, 2026
7e69e88
fix(server): project search starts working once a slow content index …
juliusmarminge Nov 15, 2026
304cf14
fix(web): terminal file links preserve numeric filename suffixes (#37…
StiensWout Nov 15, 2026
5070931
fix(mobile): cutting text in the iOS composer can be undone (#37158)
StiensWout Nov 15, 2026
449deb6
fix(web): modified F3 reaches ncurses terminal bindings (#37211)
juliusmarminge Nov 15, 2026
d21d8d8
fix(mobile): iOS video previews keep their contain fit instead of som…
juliusmarminge Nov 15, 2026
9c1dfbb
fix(server): delegate_task names the CLI version that hides a model (…
juliusmarminge Nov 15, 2026
0b489da
fix(web): switching a draft’s machine keeps its selected models (#37208)
StiensWout Nov 15, 2026
a3708b5
fix(web): concealed terminal text stays hidden under the cursor (#37141)
StiensWout Nov 15, 2026
45dbb44
fix(web): legacy mouse reports reach the PTY byte for byte (#37223)
StiensWout Nov 15, 2026
0de6ddb
fix(web): editing a queued message into /btw no longer saves it to th…
juliusmarminge Nov 15, 2026
16854a7
fix(web): usage chart and share-bar figures reach screen readers (#37…
juliusmarminge Nov 15, 2026
b5d9c71
fix(web): screen readers announce each Usage figure with its label (#…
juliusmarminge Nov 15, 2026
3e7f5ec
fix(desktop): a renderer that keeps crashing is reloaded with a backo…
juliusmarminge Nov 15, 2026
256dce7
fix(web,mobile): @ picker finds older settled threads on linked machi…
StiensWout Nov 15, 2026
14f295e
fix(terminal): one web viewer answers shared PTY queries (#37233)
StiensWout Nov 15, 2026
c2e54e3
fix(acp): recognize sessions already owned by a thread (#37244)
drstrangerujn Nov 15, 2026
aee2311
fix(acp): show local agent reported version (#37229)
drstrangerujn Nov 15, 2026
09fc222
fix(server): imported Claude sessions are titled after the prompt ins…
juliusmarminge Nov 15, 2026
2182097
fix(server): theme set help names which clients apply the theme (#37259)
juliusmarminge Nov 15, 2026
ed7f069
test(desktop): two-account callback test uses two distinct ports (#37…
t3dotgg Nov 15, 2026
073989f
fix(mobile): Duo scroll indicator sits past the vertical bar, at the …
juliusmarminge Nov 15, 2026
12c495a
fix(mobile): sending a message no longer shifts the feed before it se…
juliusmarminge Nov 15, 2026
598296e
fix(web): copied code blocks drop the fence's trailing newline (#37284)
juliusmarminge Nov 15, 2026
2579c3c
fix(web): close Usage without reloading (#37272)
dustinwloring1988 Nov 15, 2026
f1919eb
fix(server): Codex prompt suggestions no longer imitate delegated tas…
juliusmarminge Nov 15, 2026
249b92c
fix(mobile): tasks in unconnected linked environments no longer show …
juliusmarminge Nov 15, 2026
16ff4b4
fix(mobile): fully typed /model keeps its suggestion (#37280)
StiensWout Nov 15, 2026
21fe33c
fix(server): schedule_task uses the project's effective default model…
juliusmarminge Nov 15, 2026
64e7e23
fix(mobile): swipe actions no longer clip in short thread rows (#37285)
abdfattahz Nov 15, 2026
03e05f6
fix(server): a background OpenCode subagent's question survives its p…
juliusmarminge Nov 15, 2026
dd7255d
fix(server): PowerShell process scans keep non-ASCII names on Windows…
SouthCarpet Nov 15, 2026
c5e6b24
fix(mobile): iOS multi-item text paste folds into an attachment (#37301)
juliusmarminge Nov 15, 2026
295a0a7
feat(mobile): open iOS images in a native viewer modelled on Messages…
juliusmarminge Nov 15, 2026
1d74a17
fix(mobile): iPhone New chat stays beside the tabs after a Settings p…
cwilkus1-bit Nov 15, 2026
af8faa9
fix(server): dismissing a background OpenCode subagent's question let…
juliusmarminge Nov 15, 2026
26b63a4
fix(mobile): environment filter leaves out switched-off environments …
tomhmoses Nov 15, 2026
51cdf23
fix(server): work a dead provider process was running no longer stays…
juliusmarminge Nov 15, 2026
19b33ec
fix(server): remote tasks report their actual model (#37332)
yazcaleb Nov 15, 2026
f82162f
fix(provider-grok): steer queued messages into a running Grok turn (#…
juliusmarminge Nov 15, 2026
b9bc038
fix(web): terminal decorations stay visible under the block cursor (#…
StiensWout Nov 15, 2026
b732621
fix(clients): command palette skips tasks shown under their parent (#…
Onkarj012 Nov 15, 2026
ac5dd1f
fix(mobile): inline audio keeps playing when its row scrolls out of v…
cmcgrabby-hue Nov 15, 2026
f5d86e3
fix(server): clear title markers stuck on old subagent and fork threa…
ahatzz11 Nov 15, 2026
72ddc3e
fix(server): nested Claude subagent summaries no longer show Claude C…
Jacksondr5 Nov 15, 2026
109e9db
fix(web): file tabs keep their scroll position when you switch back (…
juliusmarminge Nov 15, 2026
69f8f59
fix(server): Windows PowerShell terminal reads native UTF-8 output co…
juliusmarminge Nov 15, 2026
06150a0
fix(web): No project threads in New worktree mode send without a base…
juliusmarminge Nov 15, 2026
3a74577
fix(mobile): Stop stays reachable while a question card is expanded (…
juliusmarminge Nov 15, 2026
623047c
fix(server): an ACP agent's open tool call ends when its process dies…
juliusmarminge Nov 15, 2026
58b6e1c
fix(web): a disabled Merge back button shows why it is disabled (#37395)
Jacksondr5 Nov 15, 2026
e367ef0
fix(server): a delegated child's turn end re-offers only its own pare…
juliusmarminge Nov 15, 2026
eeae88d
fix(server): service protect and status say when the kernel has no me…
juliusmarminge Nov 16, 2026
5374e2d
fix(server): a wake stuck on one thread's parent lock no longer holds…
juliusmarminge Nov 16, 2026
86dbf2a
fix(mobile): first visit to an iOS tab no longer flashes black (#37083)
juliusmarminge Nov 16, 2026
5da89cf
fix(server): one busy thread's lock no longer stalls other threads' q…
juliusmarminge Nov 16, 2026
6b7027b
fix(mobile): a tab's bar buttons no longer fade in on its first visit…
juliusmarminge Nov 16, 2026
0813f49
fix(server): the first file search after a big folder lands no longer…
juliusmarminge Nov 16, 2026
6234afb
fix(mobile): thread context menu offers Mark unread (#37426)
juliusmarminge Nov 16, 2026
94c0784
fix(server): a timed-out branch totals diff is not rerun until HEAD o…
juliusmarminge Nov 16, 2026
ddb7fb3
fix(cli): t3 pair --tailscale names the operator fix when Tailscale d…
juliusmarminge Nov 16, 2026
82ce745
fix(server): fx and Muse refreshes drop models they no longer list (#…
Sharad-Patel1 Nov 16, 2026
e47a96e
fix(pi): image reads show a preview in the work log (#37471)
juliusmarminge Nov 16, 2026
05ccd6b
fix(pi): resume the session file an extension switched the thread to …
juliusmarminge Nov 16, 2026
40dcbc5
fix(web): a stopped run no longer shows the green Done badge in the s…
juliusmarminge Nov 16, 2026
ad1b136
fix(server): a child's question no longer waits behind another coordi…
Sharad-Patel1 Nov 16, 2026
83f35da
fix(desktop): an update download fetches the newest release, not the …
juliusmarminge Nov 16, 2026
a7d17cd
fix(server): session scan keeps recent Claude sessions in a large hom…
matthewcosier Nov 16, 2026
399ea10
fix(web): Update everything no longer offers a Nightly build to a Sta…
juliusmarminge Nov 16, 2026
39e269a
fix(server): checkpoint capture no longer rehashes unchanged untracke…
juliusmarminge Nov 16, 2026
45dedf2
fix(web): an open delegated task selects its parent's sidebar row (#3…
juliusmarminge Nov 16, 2026
558790a
fix(web): stashed prompt previews show thread mentions by name, not a…
tiliakoos Nov 16, 2026
c1b23e9
fix(mobile): Show feedback when a response fork fails (#37390)
mwolson Nov 16, 2026
57ec00d
fix(web): source control settings notice a CLI login made outside the…
juliusmarminge Nov 16, 2026
3cf00c3
fix(web): composer drafts keep underscores in non-Latin names (#37495)
tiliakoos Nov 16, 2026
f083f26
fix(provider-core): generated thread titles keep the closing quote of…
tiliakoos Nov 16, 2026
1b84e72
fix(web): Cmd+Enter on an edited queued message steers it into the ru…
smirea Nov 16, 2026
e8bfaba
fix(server): preserve whitespace in ACP history replay (#37505)
StiensWout Nov 16, 2026
7f1fa0d
fix(acp): keep providers available after naming custom models (#37516)
StiensWout Nov 16, 2026
f8c8f30
fix(mobile): switching threads no longer flashes the feed header or m…
juliusmarminge Nov 16, 2026
e5b6c96
fix(pi): restore selected model after native extension switches (#37512)
StiensWout Nov 16, 2026
506a043
fix(web): keep Pi and ACP model selections during catalog gaps (#37528)
StiensWout Nov 16, 2026
16695c8
feat(mobile): move Language into General settings (#37553)
juliusmarminge Nov 16, 2026
5ea039e
chore(fork): merge upstream v0.1.10-nightly.20261116.4774
tebiggs Nov 16, 2026
4d5879d
test(server): compression test mocks the fork's push services
tebiggs Nov 16, 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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/fork/upstream-tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.10-nightly.20261115.4723
v0.1.10-nightly.20261116.4774
108 changes: 74 additions & 34 deletions apps/desktop/src/app/CodexAuthCallback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@ import { codexAuthDeliveryUrl, readCodexAuthDelivery } from "@t3tools/shared/cod
import { EnvironmentId, ProviderInstanceId } from "@t3tools/contracts";
import { receiveCodexAuthCallback, cancelCodexAuthCallback } from "./CodexAuthCallback.ts";

// Holds every probe socket until all ports are read, so one call never returns the same port twice.
async function freePorts(count: number) {
const servers = Array.from({ length: count }, () => NodeHttp.createServer());
await Promise.all(
servers.map((server) => new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve))),
);
const ports = servers.map((server) => {
const address = server.address();
if (!address || typeof address === "string") throw new Error("address");
return address.port;
});
await Promise.all(
servers.map((server) => new Promise<void>((resolve) => server.close(() => resolve()))),
);
return ports;
}
async function freePort() {
const server = NodeHttp.createServer();
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
const address = server.address();
if (!address || typeof address === "string") throw new Error("address");
await new Promise<void>((resolve) => server.close(() => resolve()));
return address.port;
const [port] = await freePorts(1);
return port!;
}
function request(port: number, state = "a".repeat(43)) {
const url = new URL("https://auth.openai.com/api/accounts/authorize");
Expand All @@ -37,18 +49,27 @@ function callback(authorizationUrl: string) {
}

describe("desktop Codex callback helper", () => {
it("binds before opening sign-in, ignores a foreign response, and returns only the code callback", async () => {
it("binds before opening sign-in, ignores a foreign response, and returns only the code callback", async ({
onTestFinished,
}) => {
const authorizationUrl = request(await freePort());
const expected = callback(authorizationUrl);
const received = await receiveCodexAuthCallback(authorizationUrl, async () => {
const opening = Promise.withResolvers<boolean>();
onTestFinished(() => opening.resolve(true));
const checkResponse = async () => {
const invalid = new URL(expected);
invalid.searchParams.set("state", "foreign");
expect((await fetch(invalid)).status).toBe(400);
const response = await fetch(expected);
expect(response.headers.get("cache-control")).toBe("no-store");
expect(await response.text()).not.toContain("test-code");
return true;
};
let responseChecked!: Promise<void>;
const received = await receiveCodexAuthCallback(authorizationUrl, () => {
responseChecked = checkResponse();
return responseChecked.then(() => opening.promise);
});
await responseChecked;
expect(received).toBe(expected);
});
it("returns hosted web to the exact instance and environment without putting the code in its query", async () => {
Expand All @@ -61,38 +82,57 @@ describe("desktop Codex callback helper", () => {
instanceId: ProviderInstanceId.make("work"),
flowId: "flow-one",
};
const openBrowser = async () => {
const response = await fetch(expected, { redirect: "manual" });
expect(response.status).toBe(303);
const delivery = response.headers.get("location")!;
expect(new URL(delivery).searchParams.has("code")).toBe(false);
expect(readCodexAuthDelivery(delivery)?.callbackUrl).toBe(expected);
expect(readCodexAuthDelivery(delivery)?.returnUrl).toBe(input.returnUrl);
return true;
};
let opening!: Promise<boolean>;
await receiveCodexAuthCallback(
authorizationUrl,
async () => {
const response = await fetch(expected, { redirect: "manual" });
expect(response.status).toBe(303);
const delivery = response.headers.get("location")!;
expect(new URL(delivery).searchParams.has("code")).toBe(false);
expect(readCodexAuthDelivery(delivery)?.callbackUrl).toBe(expected);
expect(readCodexAuthDelivery(delivery)?.returnUrl).toBe(input.returnUrl);
return true;
},
() => (opening = openBrowser()),
(url) => codexAuthDeliveryUrl(input, url),
);
await opening;
});
it("cancels and releases its listener so exact-port reauthorization can run again", async () => {
const authorizationUrl = request(await freePort());
await expect(
receiveCodexAuthCallback(authorizationUrl, async () => {
cancelCodexAuthCallback(authorizationUrl);
return true;
}),
).rejects.toThrow("cancelled");
expect(
await receiveCodexAuthCallback(authorizationUrl, async () => {
await fetch(callback(authorizationUrl));
return true;
}),
).toBe(callback(authorizationUrl));
it("cancels and releases its listener so exact-port reauthorization can run again", async ({
onTestFinished,
signal,
}) => {
for (const external of [false, true]) {
const authorizationUrl = request(await freePort());
const abort = new AbortController();
const opening = Promise.withResolvers<boolean>();
onTestFinished(() => opening.resolve(true));
await expect(
receiveCodexAuthCallback(
authorizationUrl,
async () => {
if (external) abort.abort();
else cancelCodexAuthCallback(authorizationUrl);
return opening.promise;
},
undefined,
abort.signal,
),
).rejects.toThrow("cancelled");
if (signal.aborted) return;
expect(
await receiveCodexAuthCallback(authorizationUrl, async () => {
await fetch(callback(authorizationUrl));
return true;
}),
).toBe(callback(authorizationUrl));
}
});
it("allows two accounts to complete independently", async () => {
const a = request(await freePort(), "a".repeat(43));
const b = request(await freePort(), "c".repeat(43));
const [portA, portB] = await freePorts(2);
const a = request(portA!, "a".repeat(43));
const b = request(portB!, "c".repeat(43));
const openedA = Promise.withResolvers<void>();
const openedB = Promise.withResolvers<void>();
const receiveA = receiveCodexAuthCallback(a, async () => {
Expand Down
2 changes: 0 additions & 2 deletions apps/desktop/src/app/DesktopApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,9 @@ const bootstrap = Effect.fn("desktop.bootstrap")(function* (backendStarted: bool
}

const primaryBackend = yield* (yield* DesktopBackendPool.DesktopBackendPool).primary;
// WSL-only fallback can change the primary endpoint before readiness.
const config = yield* primaryBackend.currentConfig;
if (
!environment.isDevelopment &&
!settings.wslOnly &&
Option.isSome(config) &&
Option.isNone(config.value.preflightFailure)
) {
Expand Down
3 changes: 2 additions & 1 deletion apps/desktop/src/app/DesktopClerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ export const make = Effect.gen(function* () {
Effect.gen(function* () {
yield* electronApp.whenReady;
yield* Effect.tryPromise({
try: () =>
try: (signal) =>
receiveCodexAuthCallback(
request.authorizationUrl,
(url) => runPromise(shell.openExternal(url)),
(callbackUrl) => codexAuthDeliveryUrl(request, callbackUrl),
signal,
),
catch: () =>
new CodexAuthCallbackError({
Expand Down
72 changes: 72 additions & 0 deletions apps/desktop/src/app/DesktopStartupRecovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,75 @@ it.effect.each([
}),
).pipe(Effect.provide(DesktopState.layer)),
);

it.effect("installs the build the update action downloaded, not the one it offered", () =>
Effect.scoped(
Effect.gen(function* () {
const installed = yield* Deferred.make<string>();
const shown = yield* Deferred.make<void>();
let navigate: ((event: { preventDefault: () => void }, url: string) => void) | undefined;
const recovery = {
isDestroyed: () => false,
loadURL: () => Promise.resolve(),
once: () => {},
webContents: {
setWindowOpenHandler: () => {},
on: (_event: string, listener: typeof navigate) => {
navigate = listener;
Deferred.doneUnsafe(shown, Effect.void);
},
},
} as unknown as Electron.BrowserWindow;
const offered = updateState({ status: "available", availableVersion: "0.1.4" });
const state = yield* DesktopState.DesktopState;
yield* listen.pipe(
Effect.provide(
Layer.mergeAll(
FileSystem.layerNoop({ readFileString: () => Effect.succeed("0.1.3") }),
Layer.succeed(DesktopEnvironment.DesktopEnvironment, {
appVersion: "0.1.3",
stateDir: "/task/state",
logDir: "/task/logs",
path: { join: (...parts: string[]) => parts.join("/") },
} as unknown as DesktopEnvironment.DesktopEnvironment["Service"]),
Layer.succeed(ElectronApp.ElectronApp, {
on: () => Effect.void,
} as unknown as ElectronApp.ElectronApp["Service"]),
Layer.succeed(
ElectronShell.ElectronShell,
{} as ElectronShell.ElectronShell["Service"],
),
Layer.succeed(ElectronTheme.ElectronTheme, {
shouldUseDarkColors: Effect.succeed(false),
} as ElectronTheme.ElectronTheme["Service"]),
Layer.succeed(ElectronWindow.ElectronWindow, {
main: Effect.succeedNone,
create: () => Effect.succeed(recovery),
} as unknown as ElectronWindow.ElectronWindow["Service"]),
Layer.succeed(DesktopUpdates.DesktopUpdates, {
subscribe: Effect.succeed({ latest: offered, changes: Stream.empty }),
check: () => Effect.void,
getState: Effect.succeed(offered),
// A release published since the offer: the download fetches it instead.
download: Effect.succeed({
accepted: true,
completed: true,
state: updateState({ status: "downloaded", downloadedVersion: "0.1.5" }),
}),
installPrepared: (version: string) => Deferred.succeed(installed, version),
} as unknown as DesktopUpdates.DesktopUpdates["Service"]),
),
),
);
yield* SubscriptionRef.set(state.primaryBackendStartup, {
_tag: "Failing",
reason: "Server failed before readiness",
managedPolicy: false,
output: "Failure details",
});
yield* Deferred.await(shown);
navigate!({ preventDefault: () => {} }, "https://startup-recovery.invalid/update");
expect(yield* Deferred.await(installed)).toBe("0.1.5");
}),
).pipe(Effect.provide(DesktopState.layer)),
);
9 changes: 6 additions & 3 deletions apps/desktop/src/app/DesktopStartupRecovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,15 @@ export const listen: Effect.Effect<
switch (action) {
case "update": {
if (current._tag !== "Update") return;
const state = yield* updates.getState;
if (state.downloadedVersion === null) {
let { downloadedVersion } = yield* updates.getState;
if (downloadedVersion === null) {
// The download re-checks first, so it can fetch a newer build than the one offered.
const download = yield* updates.download;
if (!download.completed) return;
downloadedVersion = download.state.downloadedVersion;
}
yield* updates.installPrepared(current.version);
if (downloadedVersion === null) return;
yield* updates.installPrepared(downloadedVersion);
return;
}
case "reinstall":
Expand Down
22 changes: 11 additions & 11 deletions apps/desktop/src/backend/DesktopBackendConfiguration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ describe("DesktopBackendConfiguration", () => {
runtimeId: string;
sha256: string;
}> = [];
const observedProbeRoots: string[] = [];
let probeCount = 0;
let legacyCleanupCount = 0;
const linuxAppRoot = "/home/test/.t3/wsl-runtime/1.2.3-x64";
const resolvedPath = "/home/test/.local/bin:/usr/bin:/bin";
Expand All @@ -406,8 +406,8 @@ describe("DesktopBackendConfiguration", () => {
});
return { ok: true, linuxAppRoot };
},
probeRuntime: (_distro, root) => {
observedProbeRoots.push(root);
probeRuntime: () => {
probeCount += 1;
return { ok: true, resolvedPath };
},
ensureNodePty: () => {
Expand All @@ -428,7 +428,7 @@ describe("DesktopBackendConfiguration", () => {
sha256: archiveHash,
},
]);
assert.deepEqual(observedProbeRoots, [linuxAppRoot]);
assert.equal(probeCount, 1);
assert.equal(
config.entryPath,
path.join(baseDir, "server.asar/apps/server/dist/bin.mjs"),
Expand Down Expand Up @@ -523,10 +523,10 @@ describe("DesktopBackendConfiguration", () => {
);
});

it.effect("resolveWsl retires a staged runtime whose executable does not start", () => {
it.effect("resolveWsl retires a staged runtime whose launch probe fails", () => {
const archiveHash = "c".repeat(64);
const stagedAppRoot = `/home/test/.t3/wsl-runtime/sha256-${archiveHash}`;
const observedProbeRoots: string[] = [];
let probeCount = 0;
const observedNodePtyRoots: string[] = [];
const invalidatedRuntimeIds: string[] = [];
return withPackagedWslHarness(
Expand All @@ -538,9 +538,9 @@ describe("DesktopBackendConfiguration", () => {
Effect.sync(() => {
invalidatedRuntimeIds.push(runtimeId);
}),
probeRuntime: (_distro, root) => {
observedProbeRoots.push(root);
return { ok: false, reason: `${root}/t3 --version failed (exit 127)` };
probeRuntime: () => {
probeCount += 1;
return { ok: false, reason: "WSL login-shell PATH could not be resolved" };
},
ensureNodePty: (_distro, root) => {
observedNodePtyRoots.push(root);
Expand All @@ -553,7 +553,7 @@ describe("DesktopBackendConfiguration", () => {
const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
const config = yield* configuration.resolveWsl({ port: 5000, distro: "Ubuntu" });

assert.deepEqual(observedProbeRoots, [stagedAppRoot]);
assert.equal(probeCount, 1);
assert.deepEqual(observedNodePtyRoots, [mountedAppRoot]);
assert.include(config.args, "/usr/bin/node");
assert.include(config.args, `${mountedAppRoot}/apps/server/dist/bin.mjs`);
Expand All @@ -578,7 +578,7 @@ describe("DesktopBackendConfiguration", () => {
Effect.sync(() => {
invalidatedRuntimeIds.push(runtimeId);
}),
probeRuntime: () => ({ ok: false, reason: "t3 --version failed (exit 1)" }),
probeRuntime: () => ({ ok: false, reason: "WSL login-shell PATH could not be resolved" }),
ensureNodePty: () => ({
ok: false,
reason: "WSL backend preflight timed out while probing for Node.js.",
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/backend/DesktopBackendConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ const runWslPreflight = Effect.fn("desktop.backendConfiguration.wslPreflight")(f
const runtime = yield* wslEnv.prepareRuntime(runningDistro, input.runtimeArchive);
if (runtime.ok) {
// Staged runtimes bundle Node and node-pty; provider PATH discovery must not require them.
const stagedProbe = yield* wslEnv.probeRuntime(runningDistro, runtime.linuxAppRoot);
const stagedProbe = yield* wslEnv.probeRuntime(runningDistro);
if (stagedProbe.ok) {
yield* wslServerTree.cleanupLegacy;
return {
Expand All @@ -437,7 +437,7 @@ const runWslPreflight = Effect.fn("desktop.backendConfiguration.wslPreflight")(f
} as const;
}
yield* Effect.logWarning(
"The staged WSL runtime did not start; retrying from the mounted server tree.",
"The staged WSL runtime probe failed; retrying from the mounted server tree.",
{ reason: stagedProbe.reason },
);
stagedFailure = { runtimeId: input.runtimeArchive.runtimeId, reason: stagedProbe.reason };
Expand Down
Loading
Loading