Compare commits

...

1 Commits

Author SHA1 Message Date
Leo 0bafdf141f WIP(未實測,不要併):待驗單 dedup —— 改 hash 宣稱內容本身
問題:檔名 hash 用 (transcript_path + session_id + agent_id)
⇒ 每個新 agent 拿到新檔名、但抽出的宣稱是同一批
⇒ 2026-08-20 同兩條宣稱產了 6 張單,總管每回合重做一次已驗完的事。

改法:hash 宣稱內容本身 + 跳過 verified-claims/ 裡已存在的同 hash。

🔴 未實測:造不出會觸發抽取邏輯的測資,dedup 是否生效沒驗到。
   失敗形式是『該產單時不產單』=驗證機制靜默停擺(fail-open)
   ⇒ 沒驗過不准併。明天先解決測資問題。

Refs inkstone/InkStoneCo#48
2026-08-20 22:34:10 +08:00
+16 -2
View File
@@ -118,10 +118,24 @@ if not ok_hits and not ng_hits:
print("SKIP:no-claims"); raise SystemExit
sid = (d.get("session_id") or "nosid")[:8]
aid = (d.get("agent_id") or d.get("subagent_id") or "")[:10]
stamp = hashlib.sha1((tp + sid + aid).encode()).hexdigest()[:8]
# 2026-08-20 修:檔名原本 hash (transcript_path + session_id + agent_id)
# => 每個新 agent 拿到新檔名,但抽出的宣稱是同一批(取 transcript 最後一個
# <result>,那個可能是舊的——檔頭 08-18 註解已記過同源問題)。
# 實害:同兩條宣稱一天內產了 6 張不同 hash 的單,總管每回合重做一次已驗完的事。
# => InkStoneCo#48:「永遠在誤響的警報,等於訓練人忽略這個警報」。
# 改成 hash 宣稱內容本身,且已驗歸檔的直接跳過。
claims_sig = "\n".join(sorted(ok_hits + ng_hits))
stamp = hashlib.sha1(claims_sig.encode()).hexdigest()[:8]
path = os.path.join(os.environ["DIR"], "claims-%s-%s.md" % (sid, stamp))
_vdir = os.path.join(os.path.dirname(os.environ["DIR"]), "verified-claims")
if os.path.isdir(_vdir):
for _f in os.listdir(_vdir):
if stamp in _f:
print("SKIP:already-verified:%s" % stamp)
raise SystemExit
def block(title, items, howto, cap):
if not items:
return ""