Your Unattended AI Agent Looks Healthy and Does Nothing: 7 Silent Failures on macOS launchd (2026)
说明与用途
macOS launchd 中的无人值守 AI 代理往往在日志中看似正常,但实际上没有执行任何工作,原因包括缺失环境变量、钥匙串访问、CPU 限制、watchdog 配置错误以及锁文件过期。解决方案包括添加 USER、移除 ProcessType Background、修正 watchdog 退出码以及验证锁文件年龄。
问题
Unattended AI agents scheduled via macOS launchd often appear healthy in logs yet perform no work, due to silent failures such as missing environment variables, keychain access, CPU throttling, watchdog misconfiguration, and stale lock files.
结果
The agent now reliably performs scheduled tasks, with failures logged and actionable alerts instead of silent health signals.
工作流
- Verify launchctl list and plist installation
- Check plist paths and environment variables
- Add USER to EnvironmentVariables for keychain access
- Remove ProcessType Background or set to Interactive
- Adjust watchdog to exit 1 on timeout
- Implement lock‑age check to prevent stale lock files
- Test agent execution and log output
证据
Every one of the seven bugs produced the SAME symptom: a healthy-looking log and zero work done.
A launchd agent gets a near-empty environment. Without USER the Claude CLI cannot read its login-keychain credential and dies in 1 second with 'Not logged in'.
ProcessType Background confines the job and every child to E-cores. Measured 5.0x slower on an M3 Ultra: 147ms interactive vs 735ms.
A watchdog that exits 0 on timeout turns a truncated run into a reported success. Exit 1.
- 记录日期: 2026-09-22T04:30:20.261Z