Log R4 reminder injection for observable evidence
ci / vet-and-test (pull_request) Successful in 56s

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).
This commit is contained in:
2026-10-11 01:22:49 +00:00
parent 6647d4879c
commit 5ebd1bb525
+4 -1
View File
@@ -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