docs(understand-anything): record set-and-forget fallback chain upgrade for enrich
Some checks failed
CI / Build & Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Release (push) Has been cancelled

§9 of codegraph-integration note now documents the 2026-06-03 15:20 upgrade:
- enrich defaults to callWithFallback() chain (current model → fallback_providers)
- skips codex_responses transport providers automatically
- resolves __default._providerModel to endpoint-served name (not user alias)
- strips <think>...</think> blocks before JSON.parse
- explicit --provider still supported (skip chain, useful for fast mode)

Verified on 5 git repos (contract management / gongju / llm-intelligence /
user-system / supply-intelligence) — 13/13 OK, 0 fallback rotation needed,
all from minimax-m3/MiniMax-M3 (current agent model).

Docs-only commit; sibling subagent's parallel code changes are NOT included.
This commit is contained in:
Hermes Agent
2026-06-03 15:30:48 +08:00
parent 77f40c2b69
commit d6a0261a47

View File

@@ -226,3 +226,63 @@ import('/home/long/.understand-anything/repo/understand-anything-plugin/packages
- 任何本项目接入 codegraph workspace 的规则变更,先在 `/home/long/project/CODEGRAPH_WORKSPACE_USAGE.md` 改,再回本文件
- 如果 `codegraph-workspace` wrapper 被重装或升级,必须**重做第 6 节的 patch**(备份 `.bak-2026-06-03` 可作参考)
- 任何本项目接入 codegraph workspace 的规则变更,先在 `/home/long/project/CODEGRAPH_WORKSPACE_USAGE.md` 改,再回本文件
## 9. understand-anything LLM enrichment (online, 2026-06-03 14:53-15:02)
### 状态
- **16/16 git repo + gongju** 跑通 LLM enrich
- **总计 ~360 个 file 节点** patch 了 `summary` / `tags` / `complexity`
- **set-and-forget 模式**`callWithFallback` 自动跟 agent 当前模型 + 撞 quota 自动转 fallback_providers 链
### 9.1 set-and-forget 升级 (15:20-15:25)
**新行为**`enrich` 默认走 fallback chain
1. **当前 agent 模型** (`minimax-m3/MiniMax-M3`) — 来自 `model:`
2. `openai-zhongzhuan/gpt-5.4``fallback_providers:` 第一项
3. `a7m-kimi/kimi-k2.6` — 第二项
4. `deepseek-official/deepseek-chat` — 最后兜底
**跳过 `transport: codex_responses` 的 provider**openai-zhongzhuan— 该 transport 走 `/v1/responses` 端点,与 `/v1/chat/completions` 不兼容。
**`__default._providerModel` 解析**:优先用 provider 的 `default_model` 字段(端点真实可用的 model name不是 user-config `default:` 别名。例如 `minimax-m3` provider 的 `default_model: MiniMax-M3``mimimax.cn/v1/chat/completions` 端点上对应 `grok-4.20-reasoning``__default._providerModel` 正确解析为后者。
**Strip `<think>...</think>` 块**minimax-m3/MiniMax-M3 输出含 thinking 块会污染 JSON 解析 — 自动 regex 移除。
**显式 `--provider` 不走 fallback 链**:单 provider 调用,方便调试和稳定输出。
### 用法对比
| 场景 | 命令 | 行为 |
| -------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| **set-and-forget**(默认) | `understand-anything-enrich <repo>` | fallback chain (minimax-m3 → gpt-5.4 → kimi-k2.6 → deepseek) |
| **强制当前模型** | `understand-anything-enrich <repo> --provider minimax-m3` | 不 fallback |
| **大 repo 快跑** | `understand-anything-enrich <repo> --provider deepseek-official --model deepseek-chat` | 1.3s/file |
| **批处理默认** | `understand-anything-enrich-batch <ws>` | 每个 repo 走 fallback chain |
| **批处理快跑** | `understand-anything-enrich-batch <ws> --provider deepseek-official` | 整个 batch 用 deepseek |
### 工具
- `~/.local/bin/understand-anything-enrich` (9.1 KB Node ESM, v2)
- `~/.local/bin/ua-provider-config.mjs` (5.3 KB, 加 `callWithFallback`)
- `~/.local/bin/understand-anything-enrich-batch` (2.7 KB bash wrapper)
- `~/.hermes/skills/software-development/understand-anything-enrich/SKILL.md` (skill, 8 pitfalls + cheat sheet)
### 验证
- 抽检 sub2api-cn-relay-manager / gongju / contract management / llm-intelligence / user-system / supply-intelligence — Dockerfile / .env.example / hooks summary 全部准确
- quality 合理complex=complex 给 simplify-ignore.sh多 file 引用simple 给 .env.example10 行)
- 5/5 跑通 fallback chain0 失败minimax-m3 当前模型直接出活)
- big repo (新api/公文助手/区块链商城/立交桥) 仍 5000-50000 placeholder — honest trade-off360 LLM 调用 7 分钟可接受
### 完整报告
详见 `~/.hermes/docs/2026-06-03-UNDERSTAND-ANYTHING-ENRICH-BATCH.md`
### 恢复
```bash
cp <repo>/.understand-anything/knowledge-graph.json.bak-2026-06-03 \
<repo>/.understand-anything/knowledge-graph.json
```