### 诊断流程样例
**场景**:twitter-fetcher 自动化启动后 90 秒无 stdout,用户不确定是 API 慢还是进程假死。
**运行**
```bash
automation-preflight-watchdog preflight --task twitter-fetcher --cwd ~/Documents/Codex/2026-04-21-https-github-com-haopenglau-skills/repo
automation-preflight-watchdog watch --task twitter-fetcher --pidfile .codex_tmp/twitter-fetcher.pid --outputs .codex_tmp/twitter_fetcher_*.json
```
**检查顺序**
1. 解析 skill 引用:发现文档引用 `skills/twitter-fetcher`,但目录不存在。
2. 解析配置:发现 `.claude/skills/config.json` 没有 `skills.twitter-fetcher.users`,从 `.codex_tmp/twitter_fetcher_*.json` 恢复 17 个账号作为候选输入。
3. 校验路径:发现 `CODEX_HOME` 为空会展开到 `/automations/...`,改用真实 `~/.codex/automations/automation/`。
4. 监控进程:stdout 超时,但输出 JSON 的 mtime/size 在增长,判为 slow-but-alive;若 2 分钟无增量且 Python 子进程仍在,判为 suspected-hang。
**成功信号**:产物写出、memory 写到真实 Codex 目录、进程退出码为 0、无同任务残留 PID。
**失败信号**:关键 skill/config 缺失且无 fallback、CODEX_HOME 指向危险路径、stdout/产物/CPU 同时静止、cleanup 后仍存在同 cwd 的残留 Python 进程。
**落地**:先作为本地 CLI 旁路接入高风险自动化;稳定后抽成 `automation-preflight` skill,成为所有长任务启动前的默认 gate。