From 5ebd1bb525083198e6c063a49b6aefb166f5395d Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 11 Oct 2026 01:22:49 +0000 Subject: [PATCH] Log R4 reminder injection for observable evidence Why: Reminders are attached to the request copy and never reach the session journal, so a transcript grep proves nothing about whether the R4 trigger fired - the first verification attempt was invalid evidence. The dual-speed nudge already logs for exactly this reason. Evidence: go test ./internal/runtime green; the follow-up live probe must show the [runtime] r4 escalation reminder injected line in the instance log. Impact: Two log lines, nothing else. Refs: Dev task feature/agent-e4-escalation-ledger (third fix-up). --- internal/runtime/factcheck.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/runtime/factcheck.go b/internal/runtime/factcheck.go index 637edc1..6d8ea5f 100644 --- a/internal/runtime/factcheck.go +++ b/internal/runtime/factcheck.go @@ -3,6 +3,7 @@ package runtime import ( "encoding/json" "fmt" + "log" "regexp" "strings" @@ -343,9 +344,11 @@ func (st *directRun) escalationReminders() []string { } st.toolMu.Unlock() if fails >= escalationFailureThreshold && !failNoted { - out = append(out, fmt.Sprintf("工具最近集中失败(近 %d 次调用中多次报错):停止原样重试。逐条重读最近一次错误信息,改参数、换工具或换路径再试;确认无法绕过时,如实在答复里说明卡点与已尝试的手段,不要编造结果。", fails)) + log.Printf("[runtime] r4 escalation reminder injected (tool failures %d in last %d outcomes)", fails, escalationWindow) + out = append(out, fmt.Sprintf("工具最近集中失败(近 %d 次调用中多次报错):停止原样重试。逐条重读错误信息,改参数、换工具或换路径再试;确认无法绕过时,如实在答复里说明卡点与已尝试的手段,不要编造结果。", fails)) } if zero >= escalationZeroHitThreshold && !zeroNoted { + log.Printf("[runtime] r4 escalation reminder injected (zero-hit searches %d)", zero) out = append(out, "检索已连续多次无结果:换关键词/换检索维度再试一次;仍无结果就如实写「材料中无此信息」,不要凭印象补数字。") } return out