From 653101e5f6b2f5ac095c3130a5029d8e913ba1b8 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Thu, 25 Sep 2025 16:50:42 +0300 Subject: [PATCH] fix(coderd): fix parsing of response format in tasks send (#19960) --- coderd/aitasks.go | 2 +- coderd/aitasks_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coderd/aitasks.go b/coderd/aitasks.go index 61c7df396f..7161eec510 100644 --- a/coderd/aitasks.go +++ b/coderd/aitasks.go @@ -675,7 +675,7 @@ func (api *API) taskSend(rw http.ResponseWriter, r *http.Request) { }) } - if v, ok := respBody["status"].(string); !ok || v != "ok" { + if v, ok := respBody["ok"].(bool); !ok || !v { return httperror.NewResponseError(http.StatusBadGateway, codersdk.Response{ Message: "Task app rejected the message.", Detail: fmt.Sprintf("Upstream response: %v", respBody), diff --git a/coderd/aitasks_test.go b/coderd/aitasks_test.go index 9b49aa731e..6e51a6917d 100644 --- a/coderd/aitasks_test.go +++ b/coderd/aitasks_test.go @@ -449,7 +449,7 @@ func TestTasks(t *testing.T) { assert.Equal(t, `{"content":"Hello, Agent!","type":"user"}`, string(b), "expected message content") w.WriteHeader(http.StatusOK) - io.WriteString(w, `{"status": "ok"}`) + io.WriteString(w, `{"ok": true}`) return } w.WriteHeader(http.StatusInternalServerError)