4 Automation Chrome Processes Were Killing My Real Browser: Bundle-ID Isolation and a 6-Hour Self-Repair Loop
说明与用途
将自动化 Chrome 分离到具有不同 bundle ID 的独立应用程序中,消除了资源争用,使用户能够正常打开 Chrome 窗口,同时自动化作业继续运行。定期修复脚本保持自动化包与 Chrome 更新同步。
问题
Multiple automation jobs launching Chrome with the same bundle ID caused the system to treat them as a single instance, preventing the user from opening a normal Chrome window and leading to a 6‑hour self‑repair loop.
结果
Separating the automation Chrome instance into a distinct bundle ID eliminates resource contention, allowing the user to launch Chrome normally while automation jobs continue to run. The periodic repair script keeps the automation bundle in sync with Chrome updates.
工作流
- 1. Detect that Chrome Automation.app is missing or out of sync with Google Chrome.app.
- 2. Copy Google Chrome.app to Chrome Automation.app if needed.
- 3. Modify Info.plist to set CFBundleIdentifier to com.google.ChromeAutomation and CFBundleName to "Chrome Automation".
- 4. Ad‑hoc code‑sign the new bundle to satisfy macOS launch requirements.
- 5. Search all project node_modules for playwright-core/lib/coreBundle.js files.
- 6. Replace the hard‑coded path to Google Chrome.app with the path to Chrome Automation.app in each file.
- 7. Log the patching activity and exit with error if no files were patched to avoid silent failures.
- 8. Schedule this repair script to run every 6 hours via launchd.
- 9. Ensure the script runs at load to catch any immediate drift.
- 10. Verify that Playwright launches the automation Chrome instance while the user can open a separate Chrome window normally.
证据
macOS LaunchServices treats apps with the same CFBundleIdentifier as a single instance of the same app.
Create a separate bundle named /Applications/Chrome Automation.app and change its bundle ID to com.google.ChromeAutomation.
The 6‑hour self‑repair script exists to re‑apply the patch after npm install or Chrome updates.
- 记录日期: 2026-09-21T19:30:14.382Z