返回 DeepSeek-Reasonix
ordinary_readiness_test.go
根目录 / internal / agent / ordinary_readiness_test.go
1 package agent
2
3 import (
4 "context"
5 "testing"
6
7 "reasonix/internal/instruction"
8 "reasonix/internal/provider"
9 "reasonix/internal/tool"
10 )
11
12 func TestTargetedTurnReturnsIncompleteReceiptInsteadOfReadinessRecovery(t *testing.T) {
13 reg := tool.NewRegistry()
14 reg.Add(fakeTool{name: "write_file", readOnly: false})
15 reg.Add(fakeTool{name: "bash", readOnly: false})
16 prov := &scriptedProvider{name: "p", turns: [][]provider.Chunk{
17 {
18 toolCallChunk("c1", "write_file", `{"path":"changed.go","content":"package main"}`),
19 {Type: provider.ChunkDone},
20 },
21 {{Type: provider.ChunkText, Text: "changed, verification not run"}, {Type: provider.ChunkDone}},
22 }}
23 sink := &phaseSink{}
24 a := New(prov, reg, NewSession(""), Options{
25 ProjectChecks: []instruction.VerifyCheck{{Command: "go test ./...", SourcePath: "AGENTS.md", Line: 3}},
26 }, sink)
27
28 if err := a.Run(withNoClosedLoop(context.Background()), "update changed.go"); err != nil {
29 t.Fatalf("targeted Run returned a readiness recovery: %v", err)
30 }
31 receipt := a.CompletionReceipt()
32 if receipt == nil || receipt.Verdict != "unknown" {
33 t.Fatalf("completion receipt = %+v, want incomplete", receipt)
34 }
35 if len(receipt.Gaps) != 0 || len(sink.summaries) != 0 {
36 t.Fatalf("host invented requirements: %+v summaries=%+v", receipt.Gaps, sink.summaries)
37 }
38 }
39
39 lines GO