OoO
dda0a06bfd
fix(strategist): cast metadata_json text to jsonb for stale alert dedupe
critic post-review #1 (HIGH): `_send_data_stale_alert` 的 dedupe SQL 對
`ai_insights.metadata_json` (Column(Text)) 直接套用 `->>` operator,PG 會
raise `operator does not exist: text ->> unknown`,被外層 try/except 吞掉,
導致 dedupe 完全失效,daily/weekly/monthly 同日 stale 會送 2-3 次告警噪音。
修法:`metadata_json::jsonb->>'report_type'` 即時 cast Text→JSONB 再取 key
(寫入端用 json.dumps,內容為合法 JSON)。
影響:
- 僅修 services/openclaw_strategist_service.py:353 一行
- grep 確認全 repo 僅此一處 `metadata_json->>` 用法
- 不動 dedupe 視窗 / telegram 發送 / _save_to_ai_insights
- 不動 tests / requirements.txt / 其他檔案
Regression:cast 每次 stale 告警跑一次,效能影響可忽略;若歷史 row
metadata_json 內容非合法 JSON,cast 會 raise 並被 try/except 吞掉,
行為退回現狀(dedupe 失效,但不影響告警送出)。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 12:29:22 +08:00
..
2026-04-28 15:26:20 +08:00
2026-05-03 12:28:17 +08:00
2026-04-19 01:21:13 +08:00
2026-05-01 14:02:37 +08:00
2026-04-29 23:41:03 +08:00
2026-04-29 23:57:36 +08:00
2026-04-19 01:21:13 +08:00
2026-04-29 22:56:00 +08:00
2026-05-01 16:34:13 +08:00
2026-04-25 03:30:14 +08:00
2026-05-03 01:55:34 +08:00
2026-04-29 23:41:03 +08:00
2026-05-01 16:34:13 +08:00
2026-04-29 21:35:56 +08:00
2026-05-02 14:34:30 +08:00
2026-05-02 23:44:01 +08:00
2026-05-01 20:56:17 +08:00
2026-04-19 01:21:13 +08:00
2026-04-28 13:57:44 +08:00
2026-04-28 15:37:07 +08:00
2026-04-27 21:28:23 +08:00
2026-05-02 13:07:30 +08:00
2026-04-22 01:12:23 +08:00
2026-05-02 13:09:34 +08:00
2026-05-03 01:54:21 +08:00
2026-05-02 14:39:10 +08:00
2026-04-30 13:59:12 +08:00
2026-04-30 09:33:39 +08:00
2026-05-02 15:01:55 +08:00
2026-04-19 01:21:13 +08:00
2026-04-27 21:11:52 +08:00
2026-05-03 00:03:38 +08:00
2026-04-29 22:37:20 +08:00
2026-04-28 19:42:05 +08:00
2026-04-27 21:28:23 +08:00
2026-05-02 15:01:55 +08:00
2026-04-25 01:42:40 +08:00
2026-04-19 01:21:13 +08:00
2026-04-19 01:21:13 +08:00
2026-05-03 00:03:38 +08:00
2026-04-29 22:48:24 +08:00
2026-04-29 22:37:20 +08:00
2026-04-30 10:24:15 +08:00
2026-04-29 23:10:27 +08:00
2026-05-02 13:04:18 +08:00
2026-05-03 12:29:22 +08:00
2026-04-19 01:21:13 +08:00
2026-04-20 06:09:33 +08:00
2026-04-19 01:21:13 +08:00
2026-04-22 01:12:23 +08:00
2026-05-03 12:28:17 +08:00
2026-05-02 12:00:34 +08:00
2026-04-27 21:28:23 +08:00
2026-05-03 00:03:38 +08:00
2026-04-29 22:48:24 +08:00
2026-05-02 12:01:04 +08:00
2026-04-19 01:21:13 +08:00
2026-04-19 01:21:13 +08:00
2026-04-27 20:34:15 +08:00
2026-04-19 01:21:13 +08:00
2026-05-01 14:20:09 +08:00