Commit 21677b3
fix(memory): Stage-2 target_type 修正 log 合并去重,按 (猜→实际) 计数 (#1414)
* fix(memory): Stage-2 target_type 修正 log 合并去重,按 (猜→实际) 计数
Stage-2 LLM 单次调用经常返回 N 条 signal 都对同一 reflection 报告
target_type 不一致(LLM 在猜命名规范:"persona" vs "persona.relationship"
vs "persona.relationship.prom",看到啥前缀就抄啥),兜底逻辑按设计在跑
不丢数据,但每条一行 log 在 review 高峰会刷 N 行同样内容。
按 (LLM 报的 → obs 实际) 去重计数,循环结束统一一行汇总:
Stage-2 target_type 修正 'persona.relationship'→persona×3
这样既不丢"哪种猜法在被反复纠"的可观测性,又不刷屏。功能完全等价
(兜底依旧以 obs['target_type'] 为准 append 到 validated)。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(memory): guard ttype hashability before进 dict key (codex review #1414)
ttype 来自 LLM JSON,理论上是 str/None;如果 hallucinate 成 list/dict 等
非 hashable,直接进 `target_type_fixes[(ttype, ...)]` 的 dict key 会
TypeError 把整个 Stage-2 validation 拖崩。改前的 f-string log 任何值都能
渲染,不会 crash —— 这版让 ttype 加入 hashable 要求是新增 surface。
兜底:非 str/None 用 repr() 转 str。功能等价,且 log 里能看到 LLM 实际
输出的怪东西,方便排查。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Hongzhi Wen <cartabio.coder1@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 18bedaf commit 21677b3
1 file changed
Lines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
886 | 892 | | |
887 | 893 | | |
888 | 894 | | |
| |||
914 | 920 | | |
915 | 921 | | |
916 | 922 | | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
922 | 931 | | |
923 | 932 | | |
924 | 933 | | |
| |||
929 | 938 | | |
930 | 939 | | |
931 | 940 | | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
932 | 951 | | |
933 | 952 | | |
934 | 953 | | |
| |||
0 commit comments