hmo
058c42ce27
feat(health): recent XMPP conversation log panel + stale error fix
...
User requirement: health tab should show recent XMPP conversations.
- bot hooks log_xmpp on inbound (on_msg) and outbound (_deliver_loop)
so real chats land in xmpp_messages.jsonl (was: only cron/scanner)
- index.html health tab: new '最近对话' panel (last 10 msgs, dir arrow,
preview, status, time); refreshHealth updates it incrementally
- last_error now shows age and resolved state: once a successful
outbound happens after an error, it's shown gray as '已恢复'
instead of alarming red forever; unresolved errors still red
- health() status no longer degraded by errors that were later
resolved by successful outbound
2026-07-20 00:07:28 +08:00
hmo
cb334ddd54
fix(bot+auto_heal): stop auto_heal from killing bot during slow LLM calls
...
Root cause of 'no response': auto_heal restart_zhiwei_bot fired whenever
inbound>0 + outbound=0 + errors>0 — which is exactly the normal state while
the bot waits for a slow LLM call (agent tool-use turns take 1-10 min).
Restart killed the in-flight LLM call -> user never got reply -> next cron
cycle saw same state -> restart again. Death loop (fired 22:30,22:35,22:40,
22:45,22:50,23:35).
Fixes:
- CALL_HERMES_TIMEOUT 180s -> 600s (agent tool calls need minutes)
- health(): parse last_inbound/outbound timestamps from journal
- auto_heal: restart bot ONLY if last inbound >600s old with no outbound
since (truly stuck), plus 600s bot-restart cooldown
- slow-but-normal state now logs bot_busy_not_stuck instead of killing
2026-07-19 23:43:28 +08:00
hmo
bb1529909b
feat(bot): screenshot OCR pipeline + ack delay 120s
...
D fix: screenshots were silently dropped (empty body + OOB url).
- register xep_0066, capture msg['oob']['url'] when body empty
- also handle body-as-URL messages (some clients put URL in body)
- download from upload.yoin.fun, OCR via SenseNova (sensenova-6.7-flash-lite)
- inject OCR text as context into LLM call
- config at /home/hmo/.config/mofin/ocr_config.json (outside repo)
- replaces dead node122 GLM-OCR path (host unreachable)
A+B fix: ACK_DELAY 15s -> 120s. 15s fired on every normal LLM
cold-start (20-100s), now only signals genuine hangs.
2026-07-19 23:23:46 +08:00
hmo
e0f47f9349
fix(xmpp_monitor): exclude key7(kimi) from auto-heal switch candidates
...
zhiwei must stay on ocg-key6 (deepseek-v4-flash) per user decision.
key7 is kimi — different model provider, incompatible model name.
If best_key returns key7, auto_heal logs skip_switch instead of switching.
2026-07-19 22:09:15 +08:00
hmo
9509b80d8b
feat(xmpp_monitor): dynamic key switching + coalesce auto-heal
...
- xmpp_logger.py:
- Add switch_key(key_id): switch Hermes model.provider via sed + systemctl restart
- Add current_provider() reading model: block correctly (not just first ' provider:' line)
- Add KEY_TO_PROVIDER mapping (AgentsMeeting key_id -> Hermes provider name)
- Add RESTART_COOLDOWN_FILE/SEC = 180s to prevent restart loops
- auto_heal(): detect HTTP 429 / Weekly usage limit -> call best_key() -> switch_key()
- auto_heal(): detect timeout/error -> async systemctl restart (Popen, not blocking)
- _verify_llm(): bump timeout 25s -> 90s (cold-start gateway takes 20-40s)
- health(): urlopen timeout 8s -> 90s (match verify window)
- Use sudo NOPASSWD (hmo ALL=(ALL) NOPASSWD: ALL already configured)
- agents_health_check.py:
- Replace inline pkill+Popen restart logic (caused multiple instances) with systemctl
- Add RESTART_COOLDOWN_FILE state to skip restart within 3 min of last
- Call xmpp_logger.auto_heal() at end of every cron cycle
- Both inline restart and auto_heal restarts share cooldown file
- scripts/key_status.py: Reports weekly/monthly/rolling status of all 6 OCG keys
- scripts/test_llm.py: 90s timeout test (was 15s, gateway cold-start >= 30s)
- scripts/test_production.py: smoke test on /home/hmo/MoFin/ (hardlinked to web-dashboard)
Fixes:
- Old assumption 'Cloudflare blocks Python User-Agent' was WRONG.
True cause was HTTP 429 Weekly usage limit on key5 (12hr reset window).
Hermes silently ignored providers.X.headers config keys; only model.default_headers works.
Config already has model.default_headers: User-Agent: curl/8.5.0 (defense in depth).
- Multiple gateway instances were caused by 3 competing systemd units
(hermes-gateway@.service template + hermes-gateway-zhiwei.service named).
Masked the template unit @position-analyst and @zhiwei so only the named one wins.
2026-07-19 20:12:47 +08:00
hmo
6d66cc6cf2
feat: auto-heal — gateway down auto-restart via cron every 5min
2026-07-19 18:22:45 +08:00
hmo
04308facde
feat: XMPP health auto-collection every 5min via cron pipeline
2026-07-19 15:17:08 +08:00
hmo
bff246313b
feat: auto-heal checks key availability before restarting gateway
2026-07-19 14:46:46 +08:00
hmo
f791d8dee7
feat: API key availability monitoring — auto-select best key from AgentsMeeting
2026-07-19 14:41:18 +08:00
hmo
6398f595b2
feat: auto-heal pipeline — detect+restart gateway/bot/ejabberd on failure
2026-07-19 14:18:45 +08:00
hmo
0802046d5c
feat: Hermes Gateway + LLM provider monitoring, root cause visible in health tab
2026-07-19 13:25:37 +08:00
hmo
50ae4e1cc9
feat: XMPP bot journal monitoring — detect inbound/outbound/errors, smooth health refresh
2026-07-19 13:15:37 +08:00
hmo
9f3d1d8106
refactor: remove redundant dashboard tab, health tab now unified
2026-07-19 12:57:08 +08:00
hmo
b41bed7959
feat: XMPP observability — logger, monitor endpoints, clean dead xiaoguo refs
2026-07-19 12:47:15 +08:00
hmo
fec2bc9106
refactor: integrate spec system into all 9 tabs — ?§ buttons, native health monitoring
2026-07-19 11:22:56 +08:00
hmo
49ccd7467d
docs: update module list — 10 specs completed
2026-07-19 11:18:22 +08:00
hmo
06e59f3d9c
feat: add prompts and reports module specs (10 specs total)
2026-07-19 11:18:00 +08:00
hmo
8356946de3
refactor: health tab now uses new dashboard, added dashboard tab
2026-07-19 11:11:59 +08:00
hmo
e45c3bb01f
feat: integrate dashboard tab into main index.html navbar
2026-07-19 11:11:18 +08:00
hmo
b08bfa5d03
refactor: integrate dashboard into server.py :8899, remove standalone dashboard
2026-07-19 11:06:50 +08:00
hmo
782a914a3c
fix: dashboard port 5804→5807 (avoid conflicts with wechat_webhook and zhiwei bot)
2026-07-19 10:56:42 +08:00
hmo
747fdfe467
feat: introduce spec system + dashboard + health pipeline (AgentsMeeting template)
2026-07-19 10:50:34 +08:00
知微
81c6dd2314
fix: 移除deploy/profile-scripts中错放的bot文件
2026-07-17 23:13:03 +08:00
知微
80d59c9331
feat: 统一部署目录——所有运行时文件归入MoFin repo
...
- deploy/bot/ — XMPP bot核心(xmpp_agent_core + xmpp_zhiwei_bot)
- deploy/profile-scripts/ — cron脚本(price_monitor等)
- 运行时文件已替换为指向MoFin的符号链接
- 改代码只需改MoFin,系统自动生效
2026-07-17 23:12:35 +08:00
知微
ab74188915
chore: 移除已跟踪的pycache文件(已加入gitignore)
2026-07-17 23:09:18 +08:00
知微
90966c63ca
chore: 同步运行版本与git一致
...
- strategy_lifecycle.py: GATE_9D_ANALYSIS → GATE_12D_ANALYSIS(12维交叉验证)
- system_audit.py: 审计策略评估改用holding_strategies.updated_at
- CHANGELOG.md + analyst-knowledge-log.md 日常更新
2026-07-17 23:08:11 +08:00
知微
b4a5020cf5
fix: 暴跌告警仅持仓触发 + 状态立即持久化防重复推送
2026-07-14 15:33:35 +08:00
知微
2c0d6ff587
fix: Gateway看门狗v2 — 新增session健康检查,卡死自动重启
2026-07-14 15:00:56 +08:00
知微
c9ae1e143b
fix: cron_to_xmpp取最后一个Response节防误判(parts[1]→parts[-1])
2026-07-14 12:14:08 +08:00
知微
377bb4d1e4
price_monitor: 5min regenerate_all冷却 + 跳过冗余全量重评
2026-07-14 11:48:34 +08:00
知微
d972553b6e
fix: divergence_detector 改用新浪API直接获取指数数据(原mo_data不支持指数代码)
2026-07-14 11:08:07 +08:00
知微
136f3f9fb8
sync scripts/mofin_db.py with root + knowledge log
2026-07-14 11:01:59 +08:00
知微
59e94d135c
fix: 盘中脚本统一使用get_conn()替代raw sqlite3.connect防DB死锁
...
- mofin_health.py, cron_health_monitor.py, intraday_health_check.py,
self_todo_executor.py: 替换raw sqlite3.connect() → get_conn()
统一使用WAL模式+busy_timeout=30s连接
- mofin_db.py: get_conn()每次新建连接时WAL checkpoint
防止被kill进程残留WAL导致后续全部卡死
- 并发测试验证: 3x price_monitor + 3x mofin_health同时运行
6/6通过,WAL仅32bytes
关联问题: 2026-07-14 SQLite写锁死锁根因诊断
2026-07-14 10:56:38 +08:00
知微
3ee3d9ba6c
fix: price_monitor添加os.nice(10)降低优先级减少DB竞争
2026-07-14 10:47:58 +08:00
知微
93dce81413
fix: price_monitor DB写锁死锁根治 + mofin_db.py reassessed_at同步
...
1. price_monitor.py: 统一BEGIN IMMEDIATE包裹所有DB写操作,
5次重试+指数退避(1→2→4→8→16s),重试耗尽后自动
emergency WAL checkpoint,try/finally确保conn释放
2. 补充进程锁:防止cron每2分钟触发但脚本跑3分钟时的并发
3. mofin_db.py: 同步cron版本的reassessed_at列处理逻辑
2026-07-14 10:42:54 +08:00
知微
02d1c93923
fix(price_monitor): DB写锁死锁根治 - 统一BEGIN IMMEDIATE + 5次重试指数退避 + emergency WAL checkpoint
...
- 统一一个BEGIN IMMEDIATE事务包裹所有写操作,替代独立写函数调用
- 5次重试 + 指数退避 (1s,2s,4s,8s,16s),原3次+固定2s
- 重试耗尽后自动 emergency WAL checkpoint(TRUNCATE)释放死锁
- try/except确保连接始终释放,修复conn泄漏
- 三副本同步:profile/scripts + MoFin/scripts + MoFin/root
2026-07-14 10:30:15 +08:00
知微
9239ab40c0
docs: 更新CHANGELOG + 开发日志记录07/13全部变更
...
- XMPP Bot非阻塞/本地XMPP/MUC修复
- price_monitor推送冷却持久化
- 深套股规则重构+换股规划swap-plan
- 周月线技术分析增强
- 健康Tab写无读清零
- stale_push_wlin/per_stock_reassess/promote_candidates更新
- static/index.html + mofin_health.json + server.py同步
2026-07-13 12:09:25 +08:00
知微
2109289668
feat: 换股规划 swap-plan — 深套股可替代性排序+资金释放方案
...
- print_swap_plan(): 五维评分(亏损程度/仓位/技术趋势/流动性/前景)
- 排序输出,明确标注"当前亏损X%深套"而非"深套持有"
- --need 参数模拟指定资金需求,自动计算卖几只够
- 可独立运行:python strategy_lifecycle.py swap-plan [--need 金额]
2026-07-13 12:05:36 +08:00
知微
a6d37c6f30
fix: 删除深套股全部硬编码限制——该加就加,一切根据客观判断
...
- 删除 is_deep_loss 对止损/止盈/买入区/推荐的全部 guard
- 删除 action_note="深套持有" 覆盖
- 删除 position_advice="不补不割" / time_horizon="长期"
- 深套股回归正常分析流程,stock_category="深套"仅作标签
- "深套持有" 改为 "亏损X%深套" 实际状态描述
2026-07-13 12:02:06 +08:00
知微
be961c6af6
fix: _push_cooldown持久化到文件,避免每2分钟重复推送操作区间通知
2026-07-13 11:17:59 +08:00
知微
ab72288296
fix: stock_weekly/monthly/watchlist_log加manual readers消除写无读警告
2026-07-10 21:12:28 +08:00
知微
e92e4473c8
feat: 周线+月线趋势/MA/支撑阻力注入mtf_context
2026-07-10 21:07:59 +08:00
知微
ea139b05b0
fix: 每日汇总只发一次(16:35)+加sent标记防重复
2026-07-10 17:05:29 +08:00
知微
e2f02ad023
fix: 资金流采集器正常运行(修import+科创板null处理)
2026-07-10 14:06:20 +08:00
知微
ea07d8c8df
feat: 买入信号写入时自动推XMPP通知(通过5805桥)
2026-07-10 13:58:23 +08:00
知微
49ef74826a
fix: 触发重评推送条件收紧(仅买入/加仓/卖出/止盈信号才推)
2026-07-10 13:43:39 +08:00
知微
b9ba737248
fix: 不构成操作建议不推XMPP+代码降级改报错+LLM失败=None
2026-07-10 13:29:32 +08:00
知微
ba70700e4d
fix: 代码降级分析也加时间标注+LLM路径日志改为12维
2026-07-10 13:23:34 +08:00
知微
98d6189b69
feat: 每维数据标注时间窗口(MA日数/资金近5日/消息最近3条/财报最新)
2026-07-10 13:17:40 +08:00
知微
005903af83
fix: 9维→12维(3横×4纵:大盘/行业/个股×基本面/消息面/技术面/资金面)
2026-07-10 12:47:05 +08:00