WorkBuddy、CodeBuddy 桌面端增强助手:签到猫猫旅行成长计划查询、多账号独立备份、点切即用;免打扰模式让 AI 无人值守跑长任务;跨账号会话迁移、异常中断自动续接;暂存/快捷提示词;毛玻璃主题与更多实用功能。
fix: discard lifecycle pids reused by readable unrelated processes
[email protected]b01626e700eb
diff --git a/scripts/windows-native/main.go b/scripts/windows-native/main.goindex fec0ed9..05a0384 100644--- a/scripts/windows-native/main.go+++ b/scripts/windows-native/main.go@@ -838,6 +838,9 @@ func inspectExactProcess(pid int, expectedPath string, label string) (bool, int,return false, exitIdentityMismatch, fmt.Errorf("PID %d %s executable path is unavailable", pid, label)}if !samePath(actual, expectedPath) {+ if processNameDiffers(filepath.Base(actual), expectedPath) {+ return false, 0, nil+ }return false, exitIdentityMismatch, fmt.Errorf("PID %d is %s, expected %s", pid, actual, expectedPath)}return true, 0, nildiff --git a/scripts/windows-native/main_test.go b/scripts/windows-native/main_test.goindex 5281436..3b32c55 100644--- a/scripts/windows-native/main_test.go+++ b/scripts/windows-native/main_test.go@@ -3,6 +3,7 @@package mainimport (+ "fmt""os""path/filepath""testing"@@ -86,3 +87,24 @@ func TestLifecycleIgnoresRecycledSystemPID(t *testing.T) {t.Fatal("System process disappeared")}}++func TestLifecycleIgnoresRecycledReadablePID(t *testing.T) {+ t.Setenv("APPDATA", t.TempDir())+ dir, err := dataDir(profileCodeCN)+ if err != nil {+ t.Fatal(err)+ }+ if err := os.MkdirAll(dir, 0700); err != nil {+ t.Fatal(err)+ }+ // The test executable has a readable path but is not bundled Node.+ if err := os.WriteFile(filepath.Join(dir, ".daemon.lock"), []byte(fmt.Sprintf(`{"pid":%d}`, os.Getpid())), 0600); err != nil {+ t.Fatal(err)+ }+ if code := stopLifecycle(profileCodeCN, t.TempDir(), false); code != 0 {+ t.Fatalf("recycled PID for unrelated readable process blocks cleanup: %d", code)+ }+ if _, err := os.Stat(filepath.Join(dir, ".daemon.lock")); !os.IsNotExist(err) {+ t.Fatalf("stale lock remains: %v", err)+ }+}diff --git a/test/windows-native-flow.test.js b/test/windows-native-flow.test.jsindex 0f349a9..f8cda4c 100644--- a/test/windows-native-flow.test.js+++ b/test/windows-native-flow.test.js@@ -285,6 +285,7 @@ test('native lifecycle cleanup clears an access-denied PID that is absent from tassert.ok(absent > snapshot && deniedResult > absent, 'absent PIDs must be treated as stale while uncertain identities remain fail-closed');assert.match(inspect.slice(snapshot, deniedResult), /record\.PID == uint32\(pid\)[\s\S]*if !present[\s\S]*return false, 0, nil/);assert.match(inspect.slice(snapshot, deniedResult), /processNameDiffers\(record\.Name, expectedPath\)[\s\S]*return false, 0, nil/);+ assert.match(inspect, /if !samePath\(actual, expectedPath\)[\s\S]*processNameDiffers\(filepath\.Base\(actual\), expectedPath\)[\s\S]*return false, 0, nil/);});test('elevated lifecycle cleanup inspects exact state before refusing active termination', () => {