Skip to content

Commit b299429

Browse files
committed
fix(responses): align codex responses events and routing
Split chat and responses boundaries more clearly, emit responses failed/reasoning/custom tool events in the OpenAI responses path, and update websocket plus route tests to keep Codex-compatible behavior stable.
1 parent 7e175af commit b299429

15 files changed

+1001
-91
lines changed

cmd/server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
)
3737

3838
var (
39-
Version = "v6.9.42"
39+
Version = "v6.9.43"
4040
Commit = "none"
4141
BuildDate = "unknown"
4242
DefaultConfigPath = ""

internal/api/modules/amp/routes_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func TestRegisterProviderAliases_AllProvidersRegistered(t *testing.T) {
113113
{"/api/provider/google/models", http.MethodGet},
114114
{"/api/provider/groq/models", http.MethodGet},
115115
{"/api/provider/openai/chat/completions", http.MethodPost},
116+
{"/api/provider/openai/responses", http.MethodPost},
116117
{"/api/provider/anthropic/v1/messages", http.MethodPost},
117118
{"/api/provider/google/v1beta/models", http.MethodGet},
118119
}
@@ -179,6 +180,7 @@ func TestRegisterProviderAliases_V1Routes(t *testing.T) {
179180
{"/api/provider/openai/v1/models", http.MethodGet},
180181
{"/api/provider/openai/v1/chat/completions", http.MethodPost},
181182
{"/api/provider/openai/v1/completions", http.MethodPost},
183+
{"/api/provider/openai/v1/responses", http.MethodPost},
182184
{"/api/provider/anthropic/v1/messages", http.MethodPost},
183185
{"/api/provider/anthropic/v1/messages/count_tokens", http.MethodPost},
184186
}

internal/api/server_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,32 @@ func TestAmpProviderModelRoutes(t *testing.T) {
200200
}
201201
}
202202

203+
func TestServerRegistersProtectedOpenAIRoutes(t *testing.T) {
204+
server := newTestServer(t)
205+
206+
protectedPaths := []struct {
207+
name string
208+
method string
209+
path string
210+
}{
211+
{name: "chat completions", method: http.MethodPost, path: "/v1/chat/completions"},
212+
{name: "responses", method: http.MethodPost, path: "/v1/responses"},
213+
{name: "responses compact", method: http.MethodPost, path: "/v1/responses/compact"},
214+
}
215+
216+
for _, tc := range protectedPaths {
217+
t.Run(tc.name, func(t *testing.T) {
218+
req := httptest.NewRequest(tc.method, tc.path, strings.NewReader(`{}`))
219+
req.Header.Set("Content-Type", "application/json")
220+
rr := httptest.NewRecorder()
221+
server.engine.ServeHTTP(rr, req)
222+
if rr.Code != http.StatusUnauthorized {
223+
t.Fatalf("unexpected status code for %s: got %d want %d; body=%s", tc.path, rr.Code, http.StatusUnauthorized, rr.Body.String())
224+
}
225+
})
226+
}
227+
}
228+
203229
func TestDefaultRequestLoggerFactory_UsesResolvedLogDirectory(t *testing.T) {
204230
t.Setenv("WRITABLE_PATH", "")
205231
t.Setenv("writable_path", "")

internal/buildinfo/buildinfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package buildinfo
55
// Defaults cover local development builds.
66
var (
77
// Version is the semantic version or git describe output of the binary.
8-
Version = "v6.9.42"
8+
Version = "v6.9.43"
99

1010
// Commit is the git commit SHA baked into the binary.
1111
Commit = "none"

0 commit comments

Comments
 (0)