feat(chat): broker Codex approvals and complete typed tool interactions

This commit is contained in:
2026-10-20 17:41:35 +01:00
parent f31806cfcb
commit 35329e4022
21 changed files with 879 additions and 84 deletions
@@ -5,6 +5,8 @@ import (
"net/http"
"net/http/httptest"
"testing"
"git.a-wan.net/alan/pipelines/internal/protocol"
)
func TestChatFormsReadbackUsesSessionOwnership(t *testing.T) {
@@ -22,3 +24,22 @@ func TestChatFormsReadbackUsesSessionOwnership(t *testing.T) {
t.Fatalf("forms=%+v err=%v", forms, err)
}
}
func TestChatQuestionCancellationDoesNotSendAnAnswer(t *testing.T) {
calls := 0
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls++
if r.Method != "DELETE" || r.URL.Path != "/api/session/ses_test/form/form_test" {
t.Errorf("unexpected cancellation: %s %s", r.Method, r.URL.Path)
}
w.WriteHeader(http.StatusNoContent)
}))
defer srv.Close()
chat := NewChat(&Connection{Backend: "v2", URL: srv.URL})
if err := chat.Answer(context.Background(), protocol.ChatAnswerRequest{SessionID: "ses_test", FormID: "form_test", Action: "cancel"}); err != nil {
t.Fatal(err)
}
if calls != 1 {
t.Fatalf("calls=%d", calls)
}
}