Skip to content

Commit 7047de8

Browse files
committed
fix(platform-linux): keep the detached app launch on the ambient provider
The ambient Linux tool provider named `runCommand: runCmd` explicitly, so after the injected-executor rule it launched apps through the captured runCmd instead of the detached runner. It now names no executor and takes the host-local defaults. A real-process test pins the ambient provider: the launched app's stderr is /dev/null, where it was a socket before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016qAu53rMak1bXMuR5U2gF4
1 parent 1cce2ef commit 7047de8

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

‎packages/platform-linux/src/__tests__/tool-provider.test.ts‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import {
88
} from '@agent-device/host-kit/diagnostics';
99
import assert from 'node:assert/strict';
1010
import { pressLinux } from '../input-actions.ts';
11-
import { createLocalLinuxToolProvider, withLinuxToolProvider } from '../tool-provider.ts';
11+
import {
12+
createLocalLinuxToolProvider,
13+
resolveLinuxToolProvider,
14+
withLinuxToolProvider,
15+
} from '../tool-provider.ts';
1216
import type { ExecDetachedExit } from '@agent-device/host-kit/command';
1317

1418
bindTestCommandHost();
@@ -170,10 +174,21 @@ test('local Linux desktop provider translates semantic lifecycle calls to host t
170174
});
171175

172176
// `open <binary>` used to run the app as a piped child of the daemon, which kept every
173-
// byte the app printed in daemon memory for the app's whole life. The default launcher detaches.
174-
test.skipIf(!fs.existsSync('/proc/self/fd'))(
175-
'local Linux desktop provider launches an app binary detached from daemon pipes by default',
176-
async () => {
177+
// byte the app printed in daemon memory for the app's whole life. The default launcher detaches,
178+
// for a provider built over a host and for the ambient one a call outside any runtime resolves.
179+
test.skipIf(!fs.existsSync('/proc/self/fd')).each([
180+
[
181+
'a host-built',
182+
() =>
183+
createLocalLinuxToolProvider({
184+
host: { env: process.env, cwd: process.cwd() },
185+
whichCommand: async (cmd) => cmd === 'fake-desktop-app',
186+
}),
187+
],
188+
['the ambient', () => resolveLinuxToolProvider()],
189+
] as const)(
190+
'%s Linux desktop provider launches an app binary detached from daemon pipes',
191+
async (_name, makeProvider) => {
177192
const binDir = await mkdtempForTest('linux-open-binary-');
178193
const report = path.join(binDir, 'stdout-target');
179194
fs.writeFileSync(
@@ -184,12 +199,7 @@ test.skipIf(!fs.existsSync('/proc/self/fd'))(
184199
const originalPath = process.env['PATH'];
185200
process.env['PATH'] = `${binDir}${path.delimiter}${originalPath ?? ''}`;
186201
try {
187-
const provider = createLocalLinuxToolProvider({
188-
host: { env: process.env, cwd: process.cwd() },
189-
whichCommand: async (cmd) => cmd === 'fake-desktop-app',
190-
});
191-
192-
await provider.desktop.openTarget('fake-desktop-app');
202+
await makeProvider().desktop.openTarget('fake-desktop-app');
193203

194204
await vi.waitFor(() => assert.ok(fs.existsSync(report)));
195205
assert.equal(fs.readFileSync(report, 'utf8').trim(), '/dev/null');

‎packages/platform-linux/src/tool-provider.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ export function createLocalLinuxToolProvider(
153153
* ambient read it replaces. A composed runtime binds its own host at `createLinuxInteractor`, so
154154
* its display decision never comes from here (#3794).
155155
*/
156+
// Names no executor, so the host-local defaults apply, including the detached app launcher.
156157
const localLinuxToolProvider = completeLocalLinuxToolProvider({
157-
runCommand: runCmd,
158-
whichCommand: whichOnPath,
159158
display: {
160159
detectDisplayServer: () => detectLinuxDisplayServer(commandHostEnvironment().env),
161160
},

0 commit comments

Comments
 (0)