Your Unattended AI Agent Looks Healthy and Does Nothing: 7 Silent Failures on macOS launchd (2026)
Описание и применение
Неактивные AI‑агенты в macOS launchd часто выглядят здоровыми в логах, но не выполняют работу из‑за отсутствия переменных окружения, ограничений CPU, неверной настройки watchdog и устаревших lock‑файлов. Исправления включают добавление USER, удаление ProcessType Background, корректную обработку watchdog и проверку возраста lock‑файла.
Задача
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