fix(backend): Agent 任务 - 限制循环读取并收紧提交后的取消边界
This commit is contained in:
1 parent
bc0d109428
commit
a218996e23
16 files changed
+778
-46
No files matched your search
@@ -110,6 +110,50 @@ func TestCloudAgentMediaApprovalAllowsMovesButRejectsContentChanges(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloudAgentMediaApprovalReusesPreparedInputsAfterModelRetry(t *testing.T) {
|
||||
s, db, a := agentMediaFixture(t)
|
||||
run, _ := agentMediaRun(t, s, a, "auto")
|
||||
if err := s.advanceCloudAgentByID("user", run.ID); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
run, _ = s.repo.CloudAgent("user", run.ID)
|
||||
state, err := cloudAgentDecode(run)
|
||||
if err != nil || state.Approval == nil || state.Approval.Prepared == nil {
|
||||
t.Fatalf("missing prepared media approval: %v", err)
|
||||
}
|
||||
|
||||
canvas, err := s.repo.CanvasProjectForUser("user", "agent-canvas")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
doc, err := creationDocument(canvas.PayloadJSON)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
nodes, err := creationObjects(doc["nodes"])
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
nodes[a.NodeID]["position"] = map[string]any{"x": 1800.0, "y": 920.0}
|
||||
raw, err := json.Marshal(doc)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := db.Model(canvas).Update("payload_json", string(raw)).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
retried := state.Approval.Call
|
||||
retried.ID = "media-call-retry"
|
||||
_, plan, err := s.prepareCloudAgentMedia(run, &state, retried)
|
||||
if err != nil {
|
||||
t.Fatalf("layout-only edit plus regenerated tool-call ID must reuse prepared media: %v", err)
|
||||
}
|
||||
if plan == nil {
|
||||
t.Fatal("retry did not retain prepared media admission")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloudAgentImageApprovalEditsAreValidatedAndIdempotent(t *testing.T) {
|
||||
s, db, a := agentMediaFixture(t)
|
||||
capability := DefaultModelCapabilityConfigForModel(string(model.ChannelInterfaceGrokImage), "grok-image")
|
||||
|
||||
Reference in new issue
Block a user