From dd797fc65e0d5d5572bc376530f36b45c9f91c40 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 25 Oct 2026 09:27:34 -0700 Subject: [PATCH] fix(codex): a resting chat's skills probe no longer pins its worktree on Windows (#33569) On Windows, the Codex at-rest skills probe no longer starts its 70s-lived `codex app-server` inside the worktree (which locked the folder and made worker release / worktree removal fail with EBUSY); it starts from Orca's stable probe folder and still lists the worktree's skills via the per-request cwd. Fixes #33174 --- src/main/codex/codex-at-rest-skills-probe.test.ts | 3 ++- src/main/codex/codex-at-rest-skills-probe.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/codex/codex-at-rest-skills-probe.test.ts b/src/main/codex/codex-at-rest-skills-probe.test.ts index 8306a205e40..1c4b4f4333a 100644 --- a/src/main/codex/codex-at-rest-skills-probe.test.ts +++ b/src/main/codex/codex-at-rest-skills-probe.test.ts @@ -62,7 +62,8 @@ describe('a resting Codex chat lists the skills Codex would load', () => { ['--disable', 'plugins', '-c', 'features.test=true', 'app-server'], ['--disable', 'plugins', '-c', 'features.test=true', 'app-server'] ]) - expect(invocations.map(({ cwd }) => cwd)).toEqual(['/work/one', '/work/two']) + // A settling probe must not hold the folder open, or Windows cannot remove the worktree. + expect(invocations.map(({ cwd }) => cwd?.startsWith('/work'))).toEqual([false, false]) expect(invocations.every((invocation) => invocation.treeKillOnFinish)).toBe(true) expect(invocations[0]?.env).toMatchObject({ CODEX_HOME: '/home/me/.codex', diff --git a/src/main/codex/codex-at-rest-skills-probe.ts b/src/main/codex/codex-at-rest-skills-probe.ts index 0e5f22dc7fd..fdfa9257269 100644 --- a/src/main/codex/codex-at-rest-skills-probe.ts +++ b/src/main/codex/codex-at-rest-skills-probe.ts @@ -16,6 +16,7 @@ import { import { runCodexAppServerSession } from './codex-app-server-session' import { isCodexSkillsListUnsupported, requestCodexSkillReport } from './codex-skill-list' import { supportsCodexStructuredLocation } from './codex-structured-location-support' +import { resolveHiddenRateLimitPtyCwd } from '../rate-limits/hidden-rate-limit-pty-cwd' import { resolveCodexStructuredInvocation, type CodexStructuredInvocationDeps @@ -106,7 +107,8 @@ async function probeCodexSkills( { command, args: [...args, 'app-server'], - cwd, + // skills/list takes the folder per request; a settling probe in it blocks Windows worktree removal (#33174). + cwd: resolveHiddenRateLimitPtyCwd(), cliPath: command, env: { ...definedEnv(environment), CODEX_HOME: accountHomePath }, envToDelete: [NATIVE_CHAT_SCRATCH_DIR_ENV, LEGACY_NATIVE_CHAT_VISUALS_DIR_ENV],