Skip to content

Commit 650e69f

Browse files
Merge branch 'main' into fix/2077-workspace-search-gitignore
2 parents 0d149a2 + 6891c77 commit 650e69f

54 files changed

Lines changed: 4016 additions & 597 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/release.yml‎

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ jobs:
160160
platform: win
161161
target: nsis
162162
arch: x64
163+
- label: Windows arm64
164+
runner: windows-11-arm
165+
platform: win
166+
target: nsis
167+
arch: arm64
163168
steps:
164169
- name: Checkout
165170
uses: actions/checkout@v6
@@ -272,6 +277,17 @@ jobs:
272277
done
273278
fi
274279
280+
# Windows updater metadata is channel-specific (for example
281+
# "latest.yml" or "nightly.yml"). Suffix each per-arch copy so the
282+
# release job can merge matching arm64/x64 manifests back into one
283+
# canonical manifest per channel.
284+
if [[ "${{ matrix.platform }}" == "win" ]]; then
285+
shopt -s nullglob
286+
for manifest in release-publish/*.yml; do
287+
mv "$manifest" "${manifest%.yml}-win-${{ matrix.arch }}.yml"
288+
done
289+
fi
290+
275291
- name: Upload build artifacts
276292
uses: actions/upload-artifact@v7
277293
with:
@@ -342,11 +358,36 @@ jobs:
342358
for x64_manifest in release-assets/*-mac-x64.yml; do
343359
arm64_manifest="${x64_manifest%-x64.yml}.yml"
344360
if [[ -f "$arm64_manifest" ]]; then
345-
node scripts/merge-mac-update-manifests.ts "$arm64_manifest" "$x64_manifest"
361+
node scripts/merge-update-manifests.ts --platform mac "$arm64_manifest" "$x64_manifest"
346362
rm -f "$x64_manifest"
347363
fi
348364
done
349365
366+
- name: Merge Windows updater manifests
367+
run: |
368+
shopt -s nullglob
369+
found_windows_manifest=false
370+
for x64_manifest in release-assets/*-win-x64.yml; do
371+
arm64_manifest="${x64_manifest/-x64.yml/-arm64.yml}"
372+
output_manifest="${x64_manifest/-win-x64.yml/.yml}"
373+
if [[ ! -f "$arm64_manifest" ]]; then
374+
echo "Missing matching arm64 Windows manifest for $x64_manifest" >&2
375+
exit 1
376+
fi
377+
378+
found_windows_manifest=true
379+
node scripts/merge-update-manifests.ts --platform win \
380+
"$arm64_manifest" \
381+
"$x64_manifest" \
382+
"$output_manifest"
383+
rm -f "$arm64_manifest" "$x64_manifest"
384+
done
385+
386+
if [[ "$found_windows_manifest" != true ]]; then
387+
echo "No Windows updater manifests found to merge." >&2
388+
exit 1
389+
fi
390+
350391
- name: Publish release
351392
if: needs.preflight.outputs.previous_tag != ''
352393
uses: softprops/action-gh-release@v2

‎CLAUDE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
AGENTS.md
1+
AGENTS.md

‎apps/desktop/src/clientPersistence.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ const clientSettings: ClientSettings = {
5252
confirmThreadArchive: true,
5353
confirmThreadDelete: false,
5454
diffWordWrap: true,
55+
sidebarProjectGroupingMode: "repository_path",
56+
sidebarProjectGroupingOverrides: {
57+
"environment-1:/tmp/project-a": "separate",
58+
},
5559
sidebarProjectSortOrder: "manual",
5660
sidebarThreadSortOrder: "created_at",
5761
timestampFormat: "24-hour",

‎apps/desktop/src/main.ts‎

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,35 @@ const TITLEBAR_COLOR = "#01000000"; // #00000000 does not work correctly on Linu
160160
const TITLEBAR_LIGHT_SYMBOL_COLOR = "#1f2937";
161161
const TITLEBAR_DARK_SYMBOL_COLOR = "#f8fafc";
162162

163+
function normalizeContextMenuItems(source: readonly ContextMenuItem[]): ContextMenuItem[] {
164+
const normalizedItems: ContextMenuItem[] = [];
165+
166+
for (const sourceItem of source) {
167+
if (typeof sourceItem.id !== "string" || typeof sourceItem.label !== "string") {
168+
continue;
169+
}
170+
171+
const normalizedItem: ContextMenuItem = {
172+
id: sourceItem.id,
173+
label: sourceItem.label,
174+
destructive: sourceItem.destructive === true,
175+
disabled: sourceItem.disabled === true,
176+
};
177+
178+
if (sourceItem.children) {
179+
const normalizedChildren = normalizeContextMenuItems(sourceItem.children);
180+
if (normalizedChildren.length === 0) {
181+
continue;
182+
}
183+
normalizedItem.children = normalizedChildren;
184+
}
185+
186+
normalizedItems.push(normalizedItem);
187+
}
188+
189+
return normalizedItems;
190+
}
191+
163192
type WindowTitleBarOptions = Pick<
164193
BrowserWindowConstructorOptions,
165194
"titleBarOverlay" | "titleBarStyle" | "trafficLightPosition"
@@ -1715,14 +1744,7 @@ function registerIpcHandlers(): void {
17151744
ipcMain.handle(
17161745
CONTEXT_MENU_CHANNEL,
17171746
async (_event, items: ContextMenuItem[], position?: { x: number; y: number }) => {
1718-
const normalizedItems = items
1719-
.filter((item) => typeof item.id === "string" && typeof item.label === "string")
1720-
.map((item) => ({
1721-
id: item.id,
1722-
label: item.label,
1723-
destructive: item.destructive === true,
1724-
disabled: item.disabled === true,
1725-
}));
1747+
const normalizedItems = normalizeContextMenuItems(items);
17261748
if (normalizedItems.length === 0) {
17271749
return null;
17281750
}
@@ -1743,28 +1765,37 @@ function registerIpcHandlers(): void {
17431765
if (!window) return null;
17441766

17451767
return new Promise<string | null>((resolve) => {
1746-
const template: MenuItemConstructorOptions[] = [];
1747-
let hasInsertedDestructiveSeparator = false;
1748-
for (const item of normalizedItems) {
1749-
if (item.destructive && !hasInsertedDestructiveSeparator && template.length > 0) {
1750-
template.push({ type: "separator" });
1751-
hasInsertedDestructiveSeparator = true;
1752-
}
1753-
const itemOption: MenuItemConstructorOptions = {
1754-
label: item.label,
1755-
enabled: !item.disabled,
1756-
click: () => resolve(item.id),
1757-
};
1758-
if (item.destructive) {
1759-
const destructiveIcon = getDestructiveMenuIcon();
1760-
if (destructiveIcon) {
1761-
itemOption.icon = destructiveIcon;
1768+
const buildTemplate = (
1769+
entries: readonly ContextMenuItem[],
1770+
): MenuItemConstructorOptions[] => {
1771+
const template: MenuItemConstructorOptions[] = [];
1772+
let hasInsertedDestructiveSeparator = false;
1773+
for (const item of entries) {
1774+
if (item.destructive && !hasInsertedDestructiveSeparator && template.length > 0) {
1775+
template.push({ type: "separator" });
1776+
hasInsertedDestructiveSeparator = true;
1777+
}
1778+
const itemOption: MenuItemConstructorOptions = {
1779+
label: item.label,
1780+
enabled: !item.disabled,
1781+
};
1782+
if (item.children && item.children.length > 0) {
1783+
itemOption.submenu = buildTemplate(item.children);
1784+
} else {
1785+
itemOption.click = () => resolve(item.id);
17621786
}
1787+
if (item.destructive && (!item.children || item.children.length === 0)) {
1788+
const destructiveIcon = getDestructiveMenuIcon();
1789+
if (destructiveIcon) {
1790+
itemOption.icon = destructiveIcon;
1791+
}
1792+
}
1793+
template.push(itemOption);
17631794
}
1764-
template.push(itemOption);
1765-
}
1795+
return template;
1796+
};
17661797

1767-
const menu = Menu.buildFromTemplate(template);
1798+
const menu = Menu.buildFromTemplate(buildTemplate(normalizedItems));
17681799
menu.popup({
17691800
window,
17701801
...popupPosition,

‎apps/server/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"start": "node dist/bin.mjs",
2121
"prepare": "effect-language-service patch",
2222
"typecheck": "tsc --noEmit",
23-
"test": "vitest run"
23+
"test": "vitest run",
24+
"test:process-reaper": "vitest run src/server.test.ts src/provider/Layers/ClaudeAdapter.test.ts src/provider/Layers/ProviderSessionDirectory.test.ts src/provider/Layers/ProviderSessionReaper.test.ts src/provider/Layers/CodexAdapter.test.ts"
2425
},
2526
"dependencies": {
2627
"@anthropic-ai/claude-agent-sdk": "^0.2.111",

‎apps/server/src/codexAppServerManager.test.ts‎

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,154 @@ describe("startSession", () => {
470470
manager.stopAll();
471471
}
472472
});
473+
474+
it("disposes an existing session before starting a replacement for the same thread", async () => {
475+
const manager = new CodexAppServerManager();
476+
const existingContext = {
477+
session: {
478+
provider: "codex",
479+
status: "ready",
480+
threadId: asThreadId("thread-1"),
481+
runtimeMode: "full-access",
482+
createdAt: "2026-02-10T00:00:00.000Z",
483+
updatedAt: "2026-02-10T00:00:00.000Z",
484+
},
485+
};
486+
487+
(
488+
manager as unknown as {
489+
sessions: Map<ThreadId, typeof existingContext>;
490+
}
491+
).sessions.set(asThreadId("thread-1"), existingContext);
492+
493+
const disposeSession = vi
494+
.spyOn(
495+
manager as unknown as {
496+
disposeSession: (
497+
context: typeof existingContext,
498+
options?: { readonly emitLifecycleEvent?: boolean },
499+
) => void;
500+
},
501+
"disposeSession",
502+
)
503+
.mockImplementation(() => {});
504+
const assertSupportedCodexCliVersion = vi
505+
.spyOn(
506+
manager as unknown as {
507+
assertSupportedCodexCliVersion: (input: {
508+
binaryPath: string;
509+
cwd: string;
510+
homePath?: string;
511+
}) => void;
512+
},
513+
"assertSupportedCodexCliVersion",
514+
)
515+
.mockImplementation(() => {});
516+
const processCwd = vi.spyOn(process, "cwd").mockImplementation(() => {
517+
throw new Error("cwd missing");
518+
});
519+
520+
try {
521+
await expect(
522+
manager.startSession({
523+
threadId: asThreadId("thread-1"),
524+
provider: "codex",
525+
binaryPath: "codex",
526+
runtimeMode: "full-access",
527+
}),
528+
).rejects.toThrow("cwd missing");
529+
530+
expect(disposeSession).toHaveBeenCalledWith(existingContext, {
531+
emitLifecycleEvent: false,
532+
});
533+
expect(assertSupportedCodexCliVersion).not.toHaveBeenCalled();
534+
} finally {
535+
disposeSession.mockRestore();
536+
assertSupportedCodexCliVersion.mockRestore();
537+
processCwd.mockRestore();
538+
(
539+
manager as unknown as {
540+
sessions: Map<ThreadId, typeof existingContext>;
541+
}
542+
).sessions.clear();
543+
manager.stopAll();
544+
}
545+
});
546+
547+
it("continues replacement start when existing session disposal fails", async () => {
548+
const manager = new CodexAppServerManager();
549+
const existingContext = {
550+
session: {
551+
provider: "codex",
552+
status: "ready",
553+
threadId: asThreadId("thread-1"),
554+
runtimeMode: "full-access",
555+
createdAt: "2026-02-10T00:00:00.000Z",
556+
updatedAt: "2026-02-10T00:00:00.000Z",
557+
},
558+
};
559+
560+
(
561+
manager as unknown as {
562+
sessions: Map<ThreadId, typeof existingContext>;
563+
}
564+
).sessions.set(asThreadId("thread-1"), existingContext);
565+
566+
const disposeSession = vi
567+
.spyOn(
568+
manager as unknown as {
569+
disposeSession: (
570+
context: typeof existingContext,
571+
options?: { readonly emitLifecycleEvent?: boolean },
572+
) => void;
573+
},
574+
"disposeSession",
575+
)
576+
.mockImplementation(() => {
577+
throw new Error("dispose failed");
578+
});
579+
const assertSupportedCodexCliVersion = vi
580+
.spyOn(
581+
manager as unknown as {
582+
assertSupportedCodexCliVersion: (input: {
583+
binaryPath: string;
584+
cwd: string;
585+
homePath?: string;
586+
}) => void;
587+
},
588+
"assertSupportedCodexCliVersion",
589+
)
590+
.mockImplementation(() => {});
591+
const processCwd = vi.spyOn(process, "cwd").mockImplementation(() => {
592+
throw new Error("cwd missing");
593+
});
594+
595+
try {
596+
await expect(
597+
manager.startSession({
598+
threadId: asThreadId("thread-1"),
599+
provider: "codex",
600+
binaryPath: "codex",
601+
runtimeMode: "full-access",
602+
}),
603+
).rejects.toThrow("cwd missing");
604+
605+
expect(disposeSession).toHaveBeenCalledWith(existingContext, {
606+
emitLifecycleEvent: false,
607+
});
608+
expect(assertSupportedCodexCliVersion).not.toHaveBeenCalled();
609+
} finally {
610+
disposeSession.mockRestore();
611+
assertSupportedCodexCliVersion.mockRestore();
612+
processCwd.mockRestore();
613+
(
614+
manager as unknown as {
615+
sessions: Map<ThreadId, typeof existingContext>;
616+
}
617+
).sessions.clear();
618+
manager.stopAll();
619+
}
620+
});
473621
});
474622

475623
describe("sendTurn", () => {

0 commit comments

Comments
 (0)