gateway: /responses/compact is held to a key's MaxConcurrency and refused a read-only key (#7281)

6e6da86c8 added POST /v1/responses/compact and /responses/compact
without judging them in the two every-route guards, so the full gateway
suite went red on TestKeySlotEveryRoute and TestReadOnlyKeyEveryRoute.
Both routes ask a model through serve's tries as /responses does, so
they are keySlotLazy in keySlotRoutes and in readOnlyRefused (the guard
already refused them; only the test list was missing them).

Run on mote at this tree:
- go test ./internal/gateway -count=1 -timeout 45m at 6e6da86c8: FAIL,
  with TestKeySlotEveryRoute and TestReadOnlyKeyEveryRoute (the two
  fixed here) and TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes,
  which is red 3 of 3 on origin/main c2924c36d alone (#7117). Its log
  also has the recovered doneHold "close of closed channel" panic
  (#6505, #6690).
- -run 'TestKeySlotEveryRoute|TestReadOnlyKeyEveryRoute|
  TestResponsesCompact|TestBrowserKey' -count=1: ok.
- gofmt -l internal/gateway: clean.
Not run: the full gateway suite again at this head.
This commit is contained in:
yetone
2026-11-20 11:40:19 +08:00
parent 6d46859c48
commit 64ae6e206b
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -51,6 +51,8 @@ var keySlotRoutes = map[string]keySlotKind{
"POST /chat/completions": keySlotLazy,
"POST /v1/responses": keySlotLazy,
"POST /responses": keySlotLazy,
"POST /v1/responses/compact": keySlotLazy,
"POST /responses/compact": keySlotLazy,
"POST /v1/messages": keySlotLazy,
"POST /messages": keySlotLazy,
"POST /api/chat": keySlotLazy,
+1
View File
@@ -48,6 +48,7 @@ var readOnlyRefused = []string{
// models, a WebSocket's upgrade and count_tokens among them
"POST /v1/chat/completions", "POST /chat/completions",
"POST /v1/responses", "POST /responses", "GET /v1/responses", "GET /responses",
"POST /v1/responses/compact", "POST /responses/compact",
"POST /v1/messages", "POST /messages", "POST /v1/systemone",
"POST /v1" + AlphaSearchPath, "POST " + AlphaSearchPath, "POST /v1/messages/count_tokens",
"POST /v1/images/generations", "POST /images/generations", "POST /v1/images/edits", "POST /images/edits",