Preserve selected host for WSL-share generation workspaces

This commit is contained in:
Brennan Benson
2026-11-12 07:10:31 -08:00
parent 7da77b1664
commit 6527bf139d
2 changed files with 27 additions and 1 deletions
@@ -33,7 +33,9 @@ export function runLocalPlanForAgent(input: {
}): Promise<InternalTextGenerationResult> {
const needsPolicy = ['codex', 'kimi', 'dsh', 'antigravity', 'amp', 'muse'].includes(input.agentId)
const wslDistro =
wslDistroForCommand(input.target.cwd, input.target.wslDistro) ?? input.target.wslDistro
input.plan.promptFile || input.plan.taskFiles?.length || needsPolicy
? (wslDistroForCommand(input.target.cwd, input.target.wslDistro) ?? undefined)
: input.target.wslDistro
const target = {
...input.target,
wslDistro,
@@ -140,6 +140,30 @@ it('launches a non-policy agent in the resolved cwd while cancel still targets t
child.emit('close', 0)
})
it('keeps a Windows-host generation in a WSL-share workspace on the selected host', async () => {
const cwd = '\\\\wsl.localhost\\Ubuntu\\home\\repo'
const child = createMockDiscoveryChild()
child.stdin.end.mockImplementation(() =>
queueMicrotask(() => {
child.stdout.emit('data', Buffer.from('Keep the selected Windows host\n'))
child.emit('close', 0)
})
)
await expect(
runLocalPlanForAgent({
agentId: 'claude',
plan: planned('claude'),
target: { kind: 'local', cwd },
operation: 'commit-message',
spawnAgent: (input) => {
expect(input.cwd).toBe(cwd)
expect(input.wslDistro).toBeUndefined()
return child
}
})
).resolves.toMatchObject({ success: true, rawOutput: 'Keep the selected Windows host' })
})
it('uses the resolved project for Antigravity policy discovery and the resulting generation', async () => {
runWsl.mockResolvedValue(output('/c/repo\n'))
const child = createMockDiscoveryChild()