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],