github / github/copilot-cli

Python appears in macOS Dock when Copilot CLI starts LSP servers

未关闭
#4,108 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:tools
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

## Summary

When the Copilot CLI app starts a session, it launches Python LSP language servers that register as GUI applications in the macOS Dock. The Python icon appears in the Dock and persists even after the server process exits (with failure). This is disruptive — users do not expect a terminal/CLI tool to spawn visible GUI processes.

*Filed by GitHub Copilot on behalf of @hubwriter.*

## Environment

- **OS**: macOS (Darwin, Apple Silicon)
- **Copilot CLI version**: 1.0.70
- **Python**: `/usr/bin/python3` (system Python)
- **Affected LSP servers**: `lsp-python` (and possibly others — all 6 LSP servers fail on startup in this environment)

## Steps to Reproduce

1. Open the Copilot CLI app
2. Start or resume any session in a repository
3. Observe the macOS Dock

## Expected Behavior

- LSP servers should run as background-only processes
- No icons should appear in the macOS Dock or app switcher
- Failed LSP servers should not leave visible artifacts in the UI

## Actual Behavior

- Python icon appears in the macOS Dock when `lsp-python` is launched
- The icon persists even after the process exits with code 1
- This happens on every session start/refresh, repeatedly
- All 6 LSP servers (typescript, omnisharp, ruby, rust, python, go) fail to initialize but Python is the only one that shows a Dock icon

## LSP Server Status (all failing)

```
lsp-typescript — exited with code 1
lsp-omnisharp — exited with code 131
lsp-ruby — exited with code 127
lsp-rust — exited with code 1
lsp-python — exited with code 1
lsp-go — exited with code 1
```

## Suggested Fix

1. **Set `LSBackgroundOnly` or `LSUIElement`** in the Python subprocess environment or use `LSBackgroundOnly` in the process launch to prevent Dock registration
2. **Use `NSApplication.setActivationPolicy(.prohibited)`** or equivalent when spawning LSP subprocesses
3. **Do not launch LSP servers that will fail** — if the server binary is not available or crashes on startup, skip it rather than retrying each session
4. **Launch Python with `-S` or as a module** in a way that does not trigger the macOS window server registration (e.g., avoid importing Tk/tkinter)

## Workaround

Users can manually add `LSBackgroundOnly` to the Python.app Info.plist:

```bash
sudo /usr/libexec/PlistBuddy -c "Add :LSBackgroundOnly bool true" \
/Library/Frameworks/Python.framework/Versions/3.X/Resources/Python.app/Contents/Info.plist
```

But this affects all Python GUI applications system-wide, which is not ideal.

贡献指南

打开贡献指南

调研方向

先在 macOS 上复现该问题,然后跟踪 Copilot CLI 如何启动 lsp-python 子进程,以及失败的 LSP 服务器是否会在会话启动时重试。将启动环境与建议的仅后台运行选项进行比较。当 LSP 服务器运行时不会在 Dock 或应用切换器中留下条目,并且失败的服务器不会留下持久的 UI 残留时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
macos, python
领域
cli, devtools, operating-systems
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。