From 26bd9286ad232703123177b4bd58b014d4d8f05e Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 7 Oct 2026 18:04:08 +0000 Subject: [PATCH] Make the rewind happy test tolerant of the settle-release window Why: run terminal status persists before the conversation claim is released; on the slow CI runner the rewind POST landed inside that window and got a 409. Retry the POST until the claim frees (bounded). Evidence: go test -count=5 ./internal/server/ -run TestRewindFilesHTTPHappy green; full suite green. Impact: test-only. Refs: Agent-System-Backend#94 #97 --- internal/server/rewind_http_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/server/rewind_http_test.go b/internal/server/rewind_http_test.go index 6032350..3ddc8dc 100644 --- a/internal/server/rewind_http_test.go +++ b/internal/server/rewind_http_test.go @@ -86,7 +86,21 @@ func TestRewindFilesHTTPHappy(t *testing.T) { t.Fatal(err) } - code, out := doJSON(t, h, "POST", "/api/conversations/"+convID+"/rewind", map[string]any{"messageId": userMsgID}) + // run 行已终态与释放会话占用之间有个 settle 窗口(CI 慢机上会撞 409): + // 有界重试直到放行。 + var code int + var out map[string]any + deadline2 := time.Now().Add(3 * time.Second) + for { + code, out = doJSON(t, h, "POST", "/api/conversations/"+convID+"/rewind", map[string]any{"messageId": userMsgID}) + if code != http.StatusConflict { + break + } + if time.Now().After(deadline2) { + break + } + time.Sleep(15 * time.Millisecond) + } if code != http.StatusOK { t.Fatalf("rewind status %d: %v", code, out) }