watchdog-discord-route
繁體中文 / English bilingual README (same file)
這個 repo 是一個可攜式 OpenClaw skill bundle,用於打通並驗證 watchdog-b → owner-facing Discord 回報鏈路。
This repo is a portable OpenClaw skill bundle to deliver and verify the watchdog-b → owner-facing Discord reporting route.
TL;DR 最短安裝(建議) / Quick Install (recommended)
1) 安裝 bundle + 建立設定檔 / Install + create config
./scripts/install_watchdog_bundle.sh --install-env-example
mkdir -p ~/.config/openclaw && cp ~/.config/openclaw/watchdog-b.env.example ~/.config/openclaw/watchdog-b.env
2) 設定 Discord 目標(必要) / Set Discord target (required)
把 WATCHDOG_B_OWNER_REPORT_TARGET 改成真的 channel id(不要留 placeholder):
Replace WATCHDOG_B_OWNER_REPORT_TARGET with a real channel id (do not keep the placeholder):
sed -i 's#^WATCHDOG_B_OWNER_REPORT_TARGET=.*#WATCHDOG_B_OWNER_REPORT_TARGET=channel:YOUR_DISCORD_CHANNEL_ID#' ~/.config/openclaw/watchdog-b.env
3) Bootstrap(通過後才開 timer) / Bootstrap (enable timer only after pass)
./scripts/bootstrap_watchdog_bundle.sh
systemctl --user daemon-reload
systemctl --user enable --now openclaw-watchdog-b.timer
4)(可選)跑 E2E 驗證 / (Optional) run E2E verification
cd ~/.openclaw/workspace/scripts/watchdog-b
./verify_watchdog_b_e2e.sh
安裝流程圖 / Install Flow
flowchart TD
A[取得 repo / bundle] --> B[install_watchdog_bundle.sh --install-env-example]
B --> C[建立 ~/.config/openclaw/watchdog-b.env]
C --> D[設定 WATCHDOG_B_OWNER_REPORT_TARGET]
D --> E[bootstrap_watchdog_bundle.sh]
E --> F{Bootstrap 通過?}
F -- 否 / No --> G[修正 env/runtime/path 後重跑 bootstrap]
G --> E
F -- 是 / Yes --> H[systemctl --user enable --now openclaw-watchdog-b.timer]
H --> I[可選:verify_watchdog_b_e2e.sh]
這是用來做什麼的 / What this is for
中文
用這個 bundle 來:
- 在新主機快速部署 watchdog-b(採
systemd --user timer) - 驗證 owner-facing Discord 訊息是否真的送達
- 修復
owner_report_*routing 路徑錯誤 - 刷新 live bundle(
~/.openclaw/workspace/scripts/watchdog-b/)
English
Use this bundle to:
- deploy watchdog-b on a new OpenClaw host (via
systemd --user timer) - verify owner-facing Discord delivery end-to-end
- fix broken
owner_report_*routing / path issues - refresh the live install under
~/.openclaw/workspace/scripts/watchdog-b/
包含內容 / Included
- Skill doc:
SKILL.md - Scripts:
scripts/*.sh,scripts/*.py,scripts/watchdog-b.env.example - systemd user units:
scripts/openclaw-watchdog-b.service,scripts/openclaw-watchdog-b.timer - References:
references/*.md
重要設定(單一來源) / Single source of config
設定檔 / Config file:
~/.config/openclaw/watchdog-b.env
最低必填 / Minimum required:
WATCHDOG_B_OWNER_REPORT_TARGET=channel:YOUR_DISCORD_CHANNEL_ID
可選(只有 host 上真的存在該 agent id 才設)/ Optional (only set if the agent id exists on the host):
WATCHDOG_B_MAIN_AGENT_ID=backend
未設定時,stalled/idle 的 main-agent nudge 會被 skip,避免因 Unknown agent id 直接 fail。
If unset, stalled/idle main-agent nudge is skipped to avoid Unknown agent id failures.
驗收/證據標準 / Evidence Standard
請把「成功」拆成三層,不要混為一談:
- transport accepted:send API 回傳成功/有 message id
- channel-readable:可以從 target channel 讀回
- human-confirmed:Eric 確認在 Discord 看到
Do not collapse “success” into one claim:
- transport accepted: send returned success / message id
- channel-readable: message can be read back from the target channel
- human-confirmed: Eric confirmed it is visible in Discord
最低 E2E 成功訊號 / Minimum E2E success signals:
~/.clawteam/owner-reports/pending/pending created- pending moved into
~/.clawteam/owner-reports/sent/ - Discord send success / message id
- artifacts written under
state/watchdog-b-verify-e2e/<run-id>/
已知故障排查 FAQ(雙語對照) / Troubleshooting FAQ (bilingual)
Q1(中文)
錯誤: can't open file .../scripts/scripts/owner_report_producer.py
原因: notifier 使用了錯誤的 base path。
正確路徑: .../scripts/watchdog-b/owner_report_producer.py
處理: 先強制刷新 bundle,再跑 bootstrap:
./scripts/install_watchdog_bundle.sh --install-env-example --force
./scripts/bootstrap_watchdog_bundle.sh
Q1 (English)
Error: can't open file .../scripts/scripts/owner_report_producer.py
Cause: the notifier is using a wrong base path.
Correct path: .../scripts/watchdog-b/owner_report_producer.py
Fix: force refresh the bundle, then rerun bootstrap:
./scripts/install_watchdog_bundle.sh --install-env-example --force
./scripts/bootstrap_watchdog_bundle.sh
Q2(中文)
錯誤: bootstrap_watchdog_bundle.sh 說 owner-reporting-system root missing
原因: host 上仍是舊版 bootstrap(期待舊的 live tree)。
處理: 刷新 bundle 之後再 bootstrap:
./scripts/install_watchdog_bundle.sh --install-env-example --force
./scripts/bootstrap_watchdog_bundle.sh
期待行為: bootstrap 只檢查 scripts/watchdog-b/*.py,不再要求獨立的 owner-reporting-system/ 目錄。
Q2 (English)
Error: bootstrap_watchdog_bundle.sh says owner-reporting-system root missing
Cause: you are still running an older bootstrap that expects the legacy live tree.
Fix: refresh the bundle, then rerun bootstrap:
./scripts/install_watchdog_bundle.sh --install-env-example --force
./scripts/bootstrap_watchdog_bundle.sh
Expected behavior: bootstrap validates only the installed live bundle under scripts/watchdog-b/*.py and no longer requires a separate owner-reporting-system/ directory.
Q3(中文)
錯誤: Unknown agent id "main"
原因: 某些路徑(stalled/idle)嘗試 nudge hard-coded main,但該 host 上不存在。
處理:
- 最保守:不要設定
WATCHDOG_B_MAIN_AGENT_ID(讓它自動 skip) - 或:設定為 host 上真的存在的 agent id(例如
backend)
WATCHDOG_B_MAIN_AGENT_ID=backend
Q3 (English)
Error: Unknown agent id "main"
Cause: stalled/idle path attempted to nudge a hard-coded main, which does not exist on this host.
Fix:
- safest: leave
WATCHDOG_B_MAIN_AGENT_IDunset (it will be skipped) - or set it to a real host-local agent id (e.g.
backend)
WATCHDOG_B_MAIN_AGENT_ID=backend
Q4(中文)
問題: ~/.config/openclaw/watchdog-b.env 不存在
原因: 只有產生 example,但沒有建立 live env。
處理:
mkdir -p ~/.config/openclaw
cp ~/.config/openclaw/watchdog-b.env.example ~/.config/openclaw/watchdog-b.env
然後至少設定:
WATCHDOG_B_OWNER_REPORT_TARGET=channel:YOUR_DISCORD_CHANNEL_ID
Q4 (English)
Problem: ~/.config/openclaw/watchdog-b.env does not exist
Cause: the example exists, but the live env file was never created.
Fix:
mkdir -p ~/.config/openclaw
cp ~/.config/openclaw/watchdog-b.env.example ~/.config/openclaw/watchdog-b.env
Then set at least:
WATCHDOG_B_OWNER_REPORT_TARGET=channel:YOUR_DISCORD_CHANNEL_ID
Q5(中文)
問題: bootstrap 通過,但 Discord 還是沒送到
檢查順序:
WATCHDOG_B_OWNER_REPORT_TARGET是否真實(不是 placeholder)pending/是否有檔、是否有進sent/- send 是否只有 transport accepted(有 message id)但其實你看不到(非 channel-readable)
state/watchdog-b-verify-e2e/<run-id>/artifacts 是否齊全
建議動作:
cd ~/.openclaw/workspace/scripts/watchdog-b
./verify_watchdog_b_e2e.sh
Q5 (English)
Problem: bootstrap passes, but Discord delivery still fails
Check in order:
WATCHDOG_B_OWNER_REPORT_TARGETis real (not placeholder)- a pending file exists and moves from
pending/tosent/ - distinguish transport accepted (message id) vs channel-readable visibility
- verify artifacts exist under
state/watchdog-b-verify-e2e/<run-id>/
Suggested action:
cd ~/.openclaw/workspace/scripts/watchdog-b
./verify_watchdog_b_e2e.sh
Q6(中文)
問題: timer active / service success,但 owner-facing route 仍不通
解釋: timer 代表排程活著,不代表鏈路通。仍需以 verify/evidence 為準。
Q6 (English)
Problem: timer is active / service is successful, but owner-facing route still doesn’t work
Explanation: a live scheduler does not guarantee the delivery chain works. Verify using E2E evidence.
Q7(中文)
問題: 我該 rerun install 還是只跑 verify?
規則:
- scripts/env/units 可能舊了 → rerun install
- 要做 host readiness 檢查 → rerun bootstrap
- 安裝都在,只需要新證據 → rerun verify
實務順序:
./scripts/install_watchdog_bundle.sh --install-env-example --force
./scripts/bootstrap_watchdog_bundle.sh
cd ~/.openclaw/workspace/scripts/watchdog-b
./verify_watchdog_b_e2e.sh
Q7 (English)
Problem: should I rerun install or just rerun verify?
Rule:
- scripts/env/units may be stale → rerun install
- need host readiness validation → rerun bootstrap
- install is fine, need fresh evidence → rerun verify
Practical order:
./scripts/install_watchdog_bundle.sh --install-env-example --force
./scripts/bootstrap_watchdog_bundle.sh
cd ~/.openclaw/workspace/scripts/watchdog-b
./verify_watchdog_b_e2e.sh
Safety / 清理規則
- 不要刪
~/.clawteam/owner-reports/sent/歷史(除非明確要求) - 不要刪
state/watchdog-b/notify-state.json(除非做 hard reset)