Skip to content

[Bug]: stop_mac_app with appName kills unrelated processes due to pkill -f #306

@ryotapoi

Description

@ryotapoi

Bug Description

When stop_mac_app is called with appName, it uses pkill -f (substring match on the full command line), which sends SIGTERM to unrelated processes whose command line happens to contain the app name.

Debug Output

XcodeBuildMCP Doctor

Generated: 2026-04-03T11:57:07.527Z
Server Version: 2.3.2
Output Mode: ⚠️ Non-redacted (opt-in)

## System Information
- platform: darwin
- release: 25.4.0
- arch: arm64
- cpus: 14 x Apple M4 Pro
- memory: 48 GB
- hostname: mbp-m4.local
- username: ryota
- homedir: /Users/ryota
- tmpdir: /var/folders/1y/l1zx_f3n7s987jz5n6hhfd2c0000gn/T

## Node.js Information
- version: v25.6.0
- execPath: /opt/homebrew/Cellar/node/25.6.0/bin/node
- pid: 74395
- ppid: 74301
- platform: darwin
- arch: arm64
- cwd: /Users/ryota/Sources/ryotapoi/Brimday/.claude/worktrees/cross_block_drag
- argv: /opt/homebrew/Cellar/node/25.6.0/bin/node /Users/ryota/.npm/_npx/99336612077b7094/node_modules/.bin/xcodebuildmcp mcp

## Process Tree
- Running under Xcode: ❌ No
- 74395 (ppid 74301): node — node /Users/ryota/.npm/_npx/99336612077b7094/node_modules/.bin/xcodebuildmcp mcp
- 74301 (ppid 74287): npm — exec xcodebu npm exec xcodebuildmcp@latest mcp
- 74287 (ppid 57325): claude — claude --append-system-prompt-file /Users/ryota/.claude/resources/rules/personality.md --resume eaef67d1-ebc8-47de-9dcb-bd35f6d5b185
- 57325 (ppid 5714): -zsh — -zsh
- 5714 (ppid 1): tmux — tmux new -s SKM
- 1 (ppid 0): /sbin/launchd — /sbin/launchd

## Xcode Information
- version: Xcode 26.4 - Build version 17E192
- path: /Applications/Xcode-26.4.0.app/Contents/Developer
- selectedXcode: /Applications/Xcode-26.4.0.app/Contents/Developer/usr/bin/xcodebuild
- xcrunVersion: xcrun version 72.

## Dependencies
- axe: ✅ v1.5.2
- mise: ❌ Not found

## Environment Variables
- INCREMENTAL_BUILDS_ENABLED: (not set)
- DEVELOPER_DIR: (not set)
- HOME: /Users/ryota
- USER: ryota
- TMPDIR: /var/folders/1y/l1zx_f3n7s987jz5n6hhfd2c0000gn/T/
- NODE_ENV: (not set)
- SENTRY_DISABLED: (not set)
- AXE_PATH: (not set)
- XBMCP_LAUNCH_JSON_WAIT_MS: (not set)
- XCODEBUILDMCP_DEBUGGER_BACKEND: (not set)
- XCODEBUILDMCP_UI_DEBUGGER_GUARD_MODE: (not set)
- XCODEBUILDMCP_DEBUG: true
- XCODEBUILDMCP_RUNTIME: mcp
- XCODEBUILDMCP_SILENCE_LOGS: true

## Feature Status

### UI Automation (axe)
- Available: ✅ Yes
- UI Automation Supported: ✅ Yes
- Simulator Video Capture Supported (AXe >= 1.1.0): ✅ Yes
- UI-Debugger Guard Mode: error

### Incremental Builds
- Enabled: ❌ No
- xcodemake Binary Available: ❌ No
- Makefile exists (cwd): (not checked: incremental builds disabled)

### Mise Integration
- Running under mise: ❌ No
- Mise available: ❌ No

### Debugger Backend (DAP)
- lldb-dap available: ✅ Yes
- Selected backend: dap

### Manifest Tool Inventory
- Total Unique Tools: 82
- Workflow Count: 16
- coverage: 2 tools
- debugging: 8 tools
- device: 17 tools
- doctor: 1 tools
- logging: 4 tools
- macos: 13 tools
- project-discovery: 5 tools
- project-scaffolding: 2 tools
- session-management: 5 tools
- simulator-management: 8 tools
- simulator: 23 tools
- swift-package: 8 tools
- ui-automation: 11 tools
- utilities: 1 tools
- workflow-discovery: 1 tools
- xcode-ide: 5 tools

### Runtime Tool Registration
- Enabled Workflows: 4
- Registered Tools: 35
- Workflows: doctor, macos, session-management, simulator

### Xcode IDE Bridge (mcpbridge)
- Workflow enabled: ❌ No
- mcpbridge path: /Applications/Xcode-26.4.0.app/Contents/Developer/usr/bin/mcpbridge
- Xcode running: true
- Connected: ❌ No
- Bridge PID: (none)
- Proxied tools: 0
- Last error: (none)
- Note: Bridge debug tools (status/sync/disconnect) are only registered when debug: true

## Tool Availability Summary
- Build Tools: ✅ Available
- UI Automation Tools: ✅ Available
- Incremental Build Support: ❌ Not available

## Sentry
- Sentry enabled: ✅ Yes

Editor/Client

Claude Code

MCP Server Version

2.3.2

LLM

Claude Opus 4.6

Steps to Reproduce

  1. Create a tmux session with the same name as the app: tmux new -s Brimday
  2. Launch Claude Code inside that tmux session
  3. Build and launch a macOS app via build_run_macos
  4. Stop the app via stop_mac_app({ appName: "Brimday" })
  5. The tmux client is killed and the session is detached

Expected Behavior

Only the target application process should be terminated. Alternatively, build_run_macos / launch_mac_app should return a processId so that stop_mac_app can be called with processId to terminate only the specific process.

Actual Behavior

pkill -f "Brimday" matches the tmux client process (whose command line contains the session name "Brimday") and kills it. The tmux server survives so tmux a can reconnect, but the workflow is interrupted. Using processId instead of appName does not cause this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions