Skip to content

fix(macos): Target app processes exactly#484

Draft
cameroncooke wants to merge 3 commits into
mainfrom
codex/fix-stop-mac-targeting
Draft

fix(macos): Target app processes exactly#484
cameroncooke wants to merge 3 commits into
mainfrom
codex/fix-stop-mac-targeting

Conversation

@cameroncooke

Copy link
Copy Markdown
Collaborator

stop_mac_app now treats an application name as an exact executable name instead of a regular expression matched against every process argument. This prevents unrelated tmux, shell, editor, or agent processes from being terminated merely because their arguments contain the app name.

The tool also rejects empty names and process IDs that are zero, negative, or fractional before executing pkill or kill. Name-based calls still stop every process with that exact executable name; callers targeting one instance should continue using processId.

Fixes #306.

Stop macOS apps by exact executable name instead of matching the app name against every process argument. Reject empty app names and unsafe process IDs before command execution.

Fixes #306
@pkg-pr-new

pkg-pr-new Bot commented Jul 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/xcodebuildmcp@484

commit: 77586cb

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the stop_mac_app tool’s process targeting on macOS by switching from command-line substring matching to exact process-name matching, preventing accidental termination of unrelated processes (e.g., tmux, shells) whose arguments contain the app name.

Changes:

  • Tightened tool input validation: appName must be non-empty and processId must be a positive integer.
  • Changed name-based termination from pkill -f to pkill -x (exact process name), with escaping to prevent regex interpretation.
  • Updated unit tests and added a changelog entry for the behavior change and validation hardening.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/mcp/tools/macos/stop_mac_app.ts Updates schema validation and switches pkill invocation to exact-name matching with regex escaping.
src/mcp/tools/macos/tests/stop_mac_app.test.ts Expands schema validation assertions and updates command-generation expectations for pkill -x.
CHANGELOG.md Documents the fix under ## [Unreleased] and links it to issue #306.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/mcp/tools/macos/stop_mac_app.ts
Reject unsafe process IDs before constructing or invoking kill, even when callers bypass the typed-tool schema.

Refs #306
Copilot AI review requested due to automatic review settings July 21, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread src/mcp/tools/macos/stop_mac_app.ts
@cameroncooke cameroncooke mentioned this pull request Jul 21, 2026
Copilot AI review requested due to automatic review settings July 21, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@cameroncooke

Copy link
Copy Markdown
Collaborator Author

CI status note: all repository-controlled checks pass and all review threads are resolved on the current head.

The remaining external warden and warden: find-bugs failures are infrastructure-only. Warden's aggregate check reports “No issues” and zero findings; security-review passes, while both find-bugs chunks terminate with the service's model/provider authentication error. The organization-managed Warden workflow was rerun and completed successfully on attempt 2: https://github.com/getsentry/XcodeBuildMCP/actions/runs/29858809494

GitHub marks the external suite rerequestable, but the documented check-suite rerequest endpoint returns 404 for the maintainer token, so only the Warden app/service owner can clear these app-owned statuses. No repository code failure remains to address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants