Skip to content

Commit dfb5ae2

Browse files
cameroncookecodex
andcommitted
fix(device): Remove stale log session state
Remove the remaining physical-device log capture bookkeeping now that the standalone device log capture tools are gone. This keeps session status and shutdown cleanup aligned with the actual device build-and-run behavior. Also correct the device build-and-run manifest and changelog wording so they no longer claim physical-device runtime logs are captured automatically. Co-Authored-By: OpenAI Codex <noreply@openai.com>
1 parent 1d9bfc0 commit dfb5ae2

9 files changed

Lines changed: 5 additions & 170 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixed
66

7+
- Removed stale physical-device log session status and shutdown cleanup for deprecated standalone device log capture, and corrected the device build-and-run tool description.
78
- Fixed CLI test summaries showing false-positive compiler errors from xcodebuild NSError dump lines, and added compiler-error snapshot coverage for simulator, device, and macOS build-style flows ([#383](https://github.com/getsentry/XcodeBuildMCP/issues/383)).
89
- Fixed simulator OSLog helper cleanup so server and daemon startup reconcile same-workspace orphaned log streams without stopping helpers owned by live sessions in other workspaces ([#382](https://github.com/getsentry/XcodeBuildMCP/issues/382)).
910

@@ -34,7 +35,7 @@ xcodebuildmcp simulator build-and-run --scheme MyApp --project-path ./MyApp.xcod
3435
xcodebuildmcp simulator launch-app --simulator-id <UDID> --bundle-id com.example.MyApp
3536
```
3637

37-
For MCP clients, use `build_run_sim`, `launch_app_sim`, or `build_run_device` and read the returned runtime log path.
38+
For MCP clients, use `build_run_sim` or `launch_app_sim` and read the returned runtime log path.
3839

3940
### New! Structured outputs
4041

manifests/tools/build_run_device.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ module: mcp/tools/device/build_run_device
33
names:
44
mcp: build_run_device
55
cli: build-and-run
6-
description: Build, install, and launch on physical device. Runtime logs are captured automatically and the log file path is included in the response. Preferred single-step run tool when defaults are set.
6+
description: Build, install, and launch on physical device. Preferred single-step run tool when defaults are set.
77
outputSchema:
88
schema: xcodebuildmcp.output.build-run-result
9-
version: "1"
9+
version: '1'
1010
predicates:
1111
- hideWhenXcodeAgentMode
1212
annotations:

src/mcp/resources/__tests__/session-status.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { ChildProcess } from 'node:child_process';
77
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
88
import { clearDaemonActivityRegistry } from '../../../daemon/activity-registry.ts';
99
import { getDefaultDebuggerManager } from '../../../utils/debugger/index.ts';
10-
import { activeDeviceLogSessions } from '../../../utils/log-capture/device-log-sessions.ts';
1110
import {
1211
clearAllSimulatorLaunchOsLogSessionsForTests,
1312
registerSimulatorLaunchOsLogSession,
@@ -39,15 +38,13 @@ describe('session-status resource', () => {
3938
workspaceKey: 'workspace-a',
4039
});
4140
setSimulatorLaunchOsLogRecordActiveOverrideForTests(async () => true);
42-
activeDeviceLogSessions.clear();
4341
clearAllProcesses();
4442
await clearAllSimulatorLaunchOsLogSessionsForTests();
4543
clearDaemonActivityRegistry();
4644
await getDefaultDebuggerManager().disposeAll();
4745
});
4846

4947
afterEach(async () => {
50-
activeDeviceLogSessions.clear();
5148
clearAllProcesses();
5249
await clearAllSimulatorLaunchOsLogSessionsForTests();
5350
clearDaemonActivityRegistry();
@@ -66,7 +63,7 @@ describe('session-status resource', () => {
6663
const parsed = JSON.parse(result.contents[0].text);
6764

6865
expect(parsed.logging.simulator.activeLaunchOsLogSessions).toEqual([]);
69-
expect(parsed.logging.device.activeSessionIds).toEqual([]);
66+
expect(parsed.logging.device).toBeUndefined();
7067
expect(parsed.debug.currentSessionId).toBe(null);
7168
expect(parsed.debug.sessionIds).toEqual([]);
7269
expect(parsed.watcher).toEqual({ running: false, watchedPath: null });

src/server/__tests__/mcp-shutdown.test.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ const mocks = vi.hoisted(() => ({
44
stopXcodeStateWatcher: vi.fn(async () => undefined),
55
shutdownXcodeToolsBridge: vi.fn(async () => undefined),
66
disposeAll: vi.fn(async () => undefined),
7-
stopAllDeviceLogCaptures: vi.fn(async () => ({
8-
stoppedSessionCount: 0,
9-
errorCount: 0,
10-
errors: [],
11-
})),
127
stopOwnedSimulatorLaunchOsLogSessions: vi.fn(async () => ({
138
stoppedSessionCount: 0,
149
errorCount: 0,
@@ -38,9 +33,6 @@ vi.mock('../../integrations/xcode-tools-bridge/index.ts', () => ({
3833
vi.mock('../../utils/debugger/index.ts', () => ({
3934
getDefaultDebuggerManager: () => ({ disposeAll: mocks.disposeAll }),
4035
}));
41-
vi.mock('../../utils/log-capture/device-log-sessions.ts', () => ({
42-
stopAllDeviceLogCaptures: mocks.stopAllDeviceLogCaptures,
43-
}));
4436
vi.mock('../../utils/log-capture/simulator-launch-oslog-sessions.ts', () => ({
4537
stopOwnedSimulatorLaunchOsLogSessions: mocks.stopOwnedSimulatorLaunchOsLogSessions,
4638
}));
@@ -88,7 +80,6 @@ describe('runMcpShutdown', () => {
8880
debuggerSessionCount: 0,
8981
simulatorLaunchOsLogSessionCount: 0,
9082
ownedSimulatorLaunchOsLogSessionCount: 0,
91-
deviceLogSessionCount: 0,
9283
videoCaptureSessionCount: 0,
9384
swiftPackageProcessCount: 0,
9485
matchingMcpProcessCount: 0,
@@ -105,7 +96,6 @@ describe('runMcpShutdown', () => {
10596
expect(mocks.stopXcodeStateWatcher).toHaveBeenCalledTimes(1);
10697
expect(mocks.shutdownXcodeToolsBridge).toHaveBeenCalledTimes(1);
10798
expect(mocks.disposeAll).toHaveBeenCalledTimes(1);
108-
expect(mocks.stopAllDeviceLogCaptures).toHaveBeenCalledTimes(1);
10999
expect(mocks.stopOwnedSimulatorLaunchOsLogSessions).toHaveBeenCalledTimes(1);
110100
expect(mocks.stopAllVideoCaptureSessions).toHaveBeenCalledTimes(1);
111101
expect(mocks.stopAllTrackedProcesses).toHaveBeenCalledTimes(1);
@@ -135,7 +125,6 @@ describe('runMcpShutdown', () => {
135125
debuggerSessionCount: 0,
136126
simulatorLaunchOsLogSessionCount: 1,
137127
ownedSimulatorLaunchOsLogSessionCount: 1,
138-
deviceLogSessionCount: 0,
139128
videoCaptureSessionCount: 0,
140129
swiftPackageProcessCount: 0,
141130
matchingMcpProcessCount: 0,
@@ -175,7 +164,6 @@ describe('runMcpShutdown', () => {
175164
debuggerSessionCount: 0,
176165
simulatorLaunchOsLogSessionCount: 2,
177166
ownedSimulatorLaunchOsLogSessionCount: 2,
178-
deviceLogSessionCount: 0,
179167
videoCaptureSessionCount: 0,
180168
swiftPackageProcessCount: 0,
181169
matchingMcpProcessCount: 0,
@@ -214,7 +202,6 @@ describe('runMcpShutdown', () => {
214202
debuggerSessionCount: 1,
215203
simulatorLaunchOsLogSessionCount: 0,
216204
ownedSimulatorLaunchOsLogSessionCount: 0,
217-
deviceLogSessionCount: 0,
218205
videoCaptureSessionCount: 0,
219206
swiftPackageProcessCount: 0,
220207
matchingMcpProcessCount: 0,

src/server/mcp-lifecycle.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import process from 'node:process';
22
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
33
import { getDefaultDebuggerManager } from '../utils/debugger/index.ts';
4-
import { activeDeviceLogSessions } from '../utils/log-capture/device-log-sessions.ts';
54
import {
65
listActiveSimulatorLaunchOsLogSessions,
76
terminateLiveSimulatorLaunchOsLogSessionsSync,
@@ -65,7 +64,6 @@ export interface McpLifecycleSnapshot {
6564
debuggerSessionCount: number;
6665
simulatorLaunchOsLogSessionCount: number;
6766
ownedSimulatorLaunchOsLogSessionCount: number;
68-
deviceLogSessionCount: number;
6967
videoCaptureSessionCount: number;
7068
swiftPackageProcessCount: number;
7169
matchingMcpProcessCount: number | null;
@@ -306,7 +304,6 @@ export async function buildMcpLifecycleSnapshot(options: {
306304
ownedSimulatorLaunchOsLogSessionCount: simulatorLaunchOsLogSessions.filter(
307305
(session) => session.ownedByCurrentProcess,
308306
).length,
309-
deviceLogSessionCount: activeDeviceLogSessions.size,
310307
videoCaptureSessionCount: listActiveVideoCaptureSessionIds().length,
311308
swiftPackageProcessCount: activeProcesses.size,
312309
matchingMcpProcessCount: peerSample.count,

src/server/mcp-shutdown.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
22
import { getDefaultDebuggerManager } from '../utils/debugger/index.ts';
33
import { stopXcodeStateWatcher } from '../utils/xcode-state-watcher.ts';
44
import { shutdownXcodeToolsBridge } from '../integrations/xcode-tools-bridge/index.ts';
5-
import { stopAllDeviceLogCaptures } from '../utils/log-capture/device-log-sessions.ts';
65
import { stopOwnedSimulatorLaunchOsLogSessions } from '../utils/log-capture/simulator-launch-oslog-sessions.ts';
76
import { stopAllVideoCaptureSessions } from '../utils/video_capture.ts';
87
import { stopAllTrackedProcesses } from '../mcp/tools/swift-package/active-processes.ts';
@@ -196,11 +195,6 @@ export async function runMcpShutdown(input: {
196195
timeoutMs: bulkStepTimeoutMs(input.snapshot.ownedSimulatorLaunchOsLogSessionCount),
197196
operation: () => stopOwnedSimulatorLaunchOsLogSessions(STEP_TIMEOUT_MS),
198197
},
199-
{
200-
name: 'device-logs.stop-all',
201-
timeoutMs: bulkStepTimeoutMs(input.snapshot.deviceLogSessionCount),
202-
operation: () => stopAllDeviceLogCaptures(STEP_TIMEOUT_MS),
203-
},
204198
{
205199
name: 'video-capture.stop-all',
206200
timeoutMs: bulkStepTimeoutMs(input.snapshot.videoCaptureSessionCount),

src/snapshot-tests/__fixtures__/mcp/resources/session-status--success.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
22
"logging": {
33
"simulator": {
4-
"activeSessionIds": [],
54
"activeLaunchOsLogSessions": []
6-
},
7-
"device": {
8-
"activeSessionIds": []
95
}
106
},
117
"debug": {

src/utils/log-capture/device-log-sessions.ts

Lines changed: 0 additions & 132 deletions
This file was deleted.

src/utils/session-status.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { getDefaultDebuggerManager } from './debugger/index.ts';
22
import { listActiveSimulatorLaunchOsLogSessions } from './log-capture/index.ts';
3-
import { activeDeviceLogSessions } from './log-capture/device-log-sessions.ts';
43
import { getDaemonActivitySnapshot } from '../daemon/activity-registry.ts';
54
import { activeProcesses } from '../mcp/tools/swift-package/active-processes.ts';
65
import { listActiveVideoCaptureSessionIds } from './video_capture.ts';
@@ -19,7 +18,6 @@ export type SessionRuntimeStatusSnapshot = {
1918
ownedByCurrentProcess: boolean;
2019
}>;
2120
};
22-
device: { activeSessionIds: string[] };
2321
};
2422
debug: {
2523
currentSessionId: string | null;
@@ -61,9 +59,6 @@ export async function getSessionRuntimeStatusSnapshot(): Promise<SessionRuntimeS
6159
simulator: {
6260
activeLaunchOsLogSessions: await listActiveSimulatorLaunchOsLogSessions(),
6361
},
64-
device: {
65-
activeSessionIds: Array.from(activeDeviceLogSessions.keys()).sort(),
66-
},
6762
},
6863
debug: {
6964
currentSessionId: debuggerManager.getCurrentSessionId(),

0 commit comments

Comments
 (0)