Skip to content

Commit 0f16d9d

Browse files
committed
fix: preserve local macOS recording ownership
1 parent 5bf1b38 commit 0f16d9d

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

src/platform-runtime-screen-recording-apple-runner-transport.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ beforeEach(() => {
2828
vi.clearAllMocks();
2929
});
3030

31+
const macosDevice = {
32+
...device,
33+
appleOs: 'macos' as const,
34+
id: 'host-macos-local',
35+
name: 'Mac',
36+
target: 'desktop' as const,
37+
};
38+
3139
test('scopes an unavailable runner authority instead of falling back to a local lease', async () => {
3240
await withAppleRunnerScreenRecordingTransport(undefined, async () => {
3341
const transport = resolveAppleRunnerScreenRecordingTransport();
@@ -97,3 +105,27 @@ test('does not issue an unowned stop when runner acquisition exposes no session
97105

98106
expect(runner.run).toHaveBeenCalledOnce();
99107
});
108+
109+
test('keeps macOS runner recording ownership local to the requested output path', async () => {
110+
runner.snapshot.mockReturnValue({ sessionId: 'runner-session-1', alive: true });
111+
runner.run.mockResolvedValue({ recorderStartUptimeMs: 42 });
112+
const transport = resolveAppleRunnerScreenRecordingTransport();
113+
114+
await expect(
115+
transport.start({
116+
device: macosDevice,
117+
appBundleId: 'com.apple.TextEdit',
118+
outputPath: '/tmp/capture.mp4',
119+
}),
120+
).resolves.toEqual({ runnerSessionId: 'runner-session-1', recorderStartUptimeMs: 42 });
121+
122+
expect(runner.run).toHaveBeenCalledWith(
123+
macosDevice,
124+
{
125+
command: 'recordStart',
126+
outPath: '/tmp/capture.mp4',
127+
appBundleId: 'com.apple.TextEdit',
128+
},
129+
{ signal: undefined },
130+
);
131+
});

src/platform-runtime-screen-recording-apple-runner-transport.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ async function startLocalAppleRunnerRecording({
6262
const { getRunnerSessionSnapshot, runAppleRunnerCommand } =
6363
await import('./platforms/apple/core/runner/runner-client.ts');
6464
const recordingFileName = `agent-device-recording-${Date.now()}.mp4`;
65-
const remotePath = device.kind === 'device' ? `tmp/${recordingFileName}` : undefined;
65+
const remotePath =
66+
device.appleOs === 'macos' || device.kind !== 'device' ? undefined : `tmp/${recordingFileName}`;
6667
const result = await runAppleRunnerCommand(
6768
device,
6869
{

0 commit comments

Comments
 (0)