Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(pi-remote): uninstall socket sweep 排除 grep 和本 shell
yan6041eb4c7e05
diff --git a/packages/maker-remote-ssh/src/__tests__/remote-agent-installer.test.ts b/packages/maker-remote-ssh/src/__tests__/remote-agent-installer.test.tsindex d5838d59a2..9a382a10a9 100644--- a/packages/maker-remote-ssh/src/__tests__/remote-agent-installer.test.ts+++ b/packages/maker-remote-ssh/src/__tests__/remote-agent-installer.test.ts@@ -169,6 +169,9 @@ describe('remote agent installer', () => {// 轮 18-T4:SIGTERM 3s 未退出 → 补 SIGKILL 升级序列expect(killCmd).toContain('kill -9 "$PID"');expect(killCmd).toContain('WARN: pi-manager daemon (PID $PID) still alive after SIGKILL');+ // socket-only sweep 不得匹配 grep / 本 bash -c(否则误杀卸载脚本自己)。+ expect(killCmd).toContain('grep -v -F "grep"');+ expect(killCmd).toContain('[ "$ORPHAN" = "$$" ] && continue');// python daemon 已退役:不再有 pi-daemon.py kill 路径expect(killCmd).not.toContain('pi-daemon.py kill');diff --git a/packages/maker-remote-ssh/src/bootstrap/installer.ts b/packages/maker-remote-ssh/src/bootstrap/installer.tsindex 1930770aed..f849c8b0ea 100644--- a/packages/maker-remote-ssh/src/bootstrap/installer.ts+++ b/packages/maker-remote-ssh/src/bootstrap/installer.ts@@ -364,7 +364,10 @@ export async function uninstallRemoteAgent(// 后旧 daemon 带着 pi 子进程与凭证 env 在 unlinked socket 后继续跑。// 按 cmdline 扫本 install 的 daemon(socket 独有路径) + 确认退出。`if [ -S ${instDir}/pi-manager/pi-manager.sock ]; then`,- ` for ORPHAN in $(ps -axo pid=,command= | grep -F -- "pi-manager.mjs daemon --socket ${instDir}/pi-manager/pi-manager.sock" | awk '{print $1}'); do`,+ // 与 ensure 侧 orphan sweep 同口径:grep / 本 bash -c 命令行也含匹配串,+ // 不排除会误杀卸载脚本自己, 随后 rm -rf 仍继续, 未扫到的 daemon 带着凭证残留。+ ` for ORPHAN in $(ps -axo pid=,command= | grep -F -- "pi-manager.mjs daemon --socket ${instDir}/pi-manager/pi-manager.sock" | grep -v -F "grep" | awk '{print $1}'); do`,+ ` [ "$ORPHAN" = "$$" ] && continue`,` kill "$ORPHAN" >/dev/null 2>&1 || true`,` for i in $(seq 1 15); do kill -0 "$ORPHAN" 2>/dev/null || break; sleep 0.2; done`,` if kill -0 "$ORPHAN" 2>/dev/null; then`,