docs(runtime): internal/runtime/loop 44 个文件注释改中文(逐行 1:1,代码零字节改动)
主人 2026-10-03 拍板「注释一律中文」;本模块按长期分批协议(一个模块一次派工)执行。 注释行数 1329 → 1329 逐行 1:1(含中文 33 → 1304);行尾注释 5 条一并译。 校验:机械校验(非注释改动行)= 空;独立 Go AST 程序(剥注释复渲)证明 44/44 文件代码全等; 全树 go test ./... 58 包 ok / 0 FAIL;交叉编译绿。 gofmt:capacity_loop_test.go / flow.go 改动前即未格式化,按铁律保留原样未动。
This commit is contained in:
1 parent
355f81d04a
commit
91e8d7a029
44 files changed
+1315
-1315
No files matched your search
@@ -12,8 +12,8 @@ import (
|
||||
|
||||
func TestRun_DuplicateCallInBatch_Skipped(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Two identical calls in one batch: the second must be skipped, not executed,
|
||||
// and fed back as a duplicate hint.
|
||||
// 一批中有两个相同调用:第二个必须被跳过而非执行,
|
||||
// 并作为重复提示回灌。
|
||||
call := `{"tool_calls":[{"name":"echo","args":{"q":"x"}},{"name":"echo","args":{"q":"x"}}]}`
|
||||
ad := &mockAdapter{chat: []mgResp{
|
||||
{resp: model.Response{Content: call}},
|
||||
@@ -37,8 +37,8 @@ func TestRun_DuplicateCallInBatch_Skipped(t *testing.T) {
|
||||
t.Fatalf("StopReason = %q, want stop", res.StopReason)
|
||||
}
|
||||
last := ad.reqs[len(ad.reqs)-1].Messages
|
||||
// Round 1 appended two tool messages: the executed call result, then the
|
||||
// duplicate skip. The last two messages before the final turn are those.
|
||||
// 第 1 轮追加了两条工具消息:已执行调用的结果,然后是
|
||||
// 重复跳过。最终轮之前的最后两条消息就是它们。
|
||||
result := last[len(last)-2]
|
||||
skip := last[len(last)-1]
|
||||
if !strings.Contains(result.Content[0].Text, "hi") {
|
||||
@@ -51,8 +51,8 @@ func TestRun_DuplicateCallInBatch_Skipped(t *testing.T) {
|
||||
|
||||
func TestRun_CriticalToolLoop_Terminates(t *testing.T) {
|
||||
t.Parallel()
|
||||
// The identical call repeats across rounds: round 2 is blocked (critical
|
||||
// loop flagged), round 3 terminates the run.
|
||||
// 相同调用跨轮重复:第 2 轮被拦截(标记为关键
|
||||
// 循环),第 3 轮终止该 run。
|
||||
call := `{"tool_calls":[{"name":"echo","args":{"q":"x"}}]}`
|
||||
ad := &mockAdapter{chat: []mgResp{
|
||||
{resp: model.Response{Content: call}},
|
||||
@@ -151,8 +151,8 @@ func TestRun_Sequential_ExecutesAll(t *testing.T) {
|
||||
|
||||
func TestRun_ArgumentValidation_ErrorKind(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Missing required field -> the fed-back failure carries errorKind
|
||||
// argument-validation so the model can re-issue a corrected call.
|
||||
// 缺少必填字段 -> 回灌的失败携带 errorKind
|
||||
// argument-validation,使模型能重新发出修正后的调用。
|
||||
call := `{"tool_calls":[{"name":"req","args":{}}]}`
|
||||
ad := &mockAdapter{chat: []mgResp{
|
||||
{resp: model.Response{Content: call}},
|
||||
@@ -268,8 +268,8 @@ func TestRun_AfterCall_RewritesResult(t *testing.T) {
|
||||
|
||||
func TestRun_ToolCallRepair_FencedJSON(t *testing.T) {
|
||||
t.Parallel()
|
||||
// A code-fenced tool-call envelope is repaired and executed rather than
|
||||
// silently becoming a text answer.
|
||||
// 围栏代码块中的工具调用信封被修复并执行,而不是
|
||||
// 悄悄变成文本答案。
|
||||
call := "```json\n{\"tool_calls\":[{\"name\":\"echo\",\"args\":{\"q\":\"hi\"}}]}\n```"
|
||||
ad := &mockAdapter{chat: []mgResp{
|
||||
{resp: model.Response{Content: call}},
|
||||
|
||||
Reference in new issue
Block a user