Exercise queued and failed material intake through HTTP
ci / vet-and-test (pull_request) Successful in 49s
ci / vet-and-test (pull_request) Successful in 49s
Why: The stage-6 browser proof must cover the real queued and failed-start user states. Evidence: Two Playwright paths failed before fixture support, then passed; full Backend vet and Go tests passed. Impact: Adds only task-owned mechanism fixture behavior under the live test tag. Refs: U3 r0.5 independent review finding
This commit is contained in:
@@ -108,6 +108,9 @@ func evalMechanismStream(ctx context.Context, model string, msgs []agentllm.Mess
|
||||
content := "已收到材料,正在后台整理;请结合阶段发现继续工作。"
|
||||
var calls []agentllm.ToolCall
|
||||
if checkpoint {
|
||||
if toolReplies == 0 && strings.Contains(sourceText, "[fixture:queue-hold]") {
|
||||
time.Sleep(8 * time.Second)
|
||||
}
|
||||
count := toolReplies
|
||||
matches := mechanismCheckpointSources(sourceText)
|
||||
matches = filterCheckpointSources(matches)
|
||||
@@ -280,7 +283,44 @@ func TestServeWorkCheckpointEval(t *testing.T) {
|
||||
if e = os.WriteFile(manifest, raw, 0600); e != nil {
|
||||
t.Fatal(e)
|
||||
}
|
||||
httpServer := &http.Server{Handler: server.Handler()}
|
||||
baseHandler := server.Handler()
|
||||
var handler http.Handler = baseHandler
|
||||
if mode == "mechanism" {
|
||||
handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/__fixture/material-start-failure" {
|
||||
baseHandler.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
if r.Method != http.MethodPost {
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
var request struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&request); err != nil {
|
||||
http.Error(w, "invalid fixture request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
db, err := sql.Open("sqlite", filepath.Join(dir, "agent-system.db"))
|
||||
if err != nil {
|
||||
http.Error(w, "fixture storage unavailable", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
defer db.Close()
|
||||
statement := `DROP TRIGGER IF EXISTS fixture_fail_material_claim`
|
||||
if request.Enabled {
|
||||
statement = `CREATE TRIGGER IF NOT EXISTS fixture_fail_material_claim BEFORE INSERT ON conversation_executions
|
||||
WHEN NEW.conversation_id LIKE 'task:%' BEGIN SELECT RAISE(FAIL, 'fixture material claim failure'); END`
|
||||
}
|
||||
if _, err := db.Exec(statement); err != nil {
|
||||
http.Error(w, "fixture storage fault unavailable", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
})
|
||||
}
|
||||
httpServer := &http.Server{Handler: handler}
|
||||
done := make(chan error, 1)
|
||||
go func() { done <- httpServer.Serve(listener) }()
|
||||
stop := make(chan os.Signal, 1)
|
||||
|
||||
Reference in New Issue
Block a user