Problem
From verify of #111 (devil's-advocate, P3):
「PR #111 的新錯誤訊息:Error: insert_equation: display_mode must be a boolean true/false, not a string or other JSON type — 沒有 echo agent 實際傳入的型別 / 值。LLM agent 收到此訊息後想做 self-repair 時,必須猜自己原本傳了什麼,loop 不容易收斂。」
— Source: team:devils-advocate (P3)
Verify report: #111 (comment)
insert_equation 新增的兩個錯誤訊息(Server.swift:8864、8895)都沒帶 received value:
Error: insert_equation: pass either 'components' (JSON tree) OR 'latex' (LaTeX subset), not both
Error: insert_equation: display_mode must be a boolean true/false, not a string or other JSON type
對比同檔其他工具 — paragraph_index out of range 的錯誤會 echo 索引值;text not found 的錯誤會 echo 搜尋字串。新訊息少了這個習慣。
Type
DX / error-message UX
Strategy
目標格式範例:
Error: insert_equation: display_mode received string "false", expected boolean true/false
Error: insert_equation: components and latex both provided (components: <kind>, latex: <chars>); pass exactly one
注意:echo 用戶值需 truncate(避免 #111 verify 提到的 unbounded user-token DoS pre-existing 問題 R3)。建議 helper:
func formatValue(_ v: Value, max: Int = 80) -> String {
switch v {
case .string(let s): return "\"" + s.prefix(max) + (s.count > max ? "..." : "") + "\""
case .int(let i): return "\(i)"
case .bool(let b): return "\(b)"
case .null: return "null"
case .double(let d): return "\(d)"
case .object: return "<object>"
case .array: return "<array>"
}
}
跨整個 Server.swift 應有 ~50 個錯誤訊息可受惠(分批,不必一個 PR 全改)。
Related
Problem
insert_equation新增的兩個錯誤訊息(Server.swift:8864、8895)都沒帶 received value:對比同檔其他工具 —
paragraph_indexout of range 的錯誤會 echo 索引值;text not found 的錯誤會 echo 搜尋字串。新訊息少了這個習慣。Type
DX / error-message UX
Strategy
目標格式範例:
注意:echo 用戶值需 truncate(避免 #111 verify 提到的 unbounded user-token DoS pre-existing 問題 R3)。建議 helper:
跨整個 Server.swift 應有 ~50 個錯誤訊息可受惠(分批,不必一個 PR 全改)。
Related
display_modestring fail-open coercion #107