[proxy] Strip only a gateway's own namespace before matching a model

Three open review findings.

The discovery filter treated every slash in a listed id as a gateway prefix
and matched the tail against the policy. A self-hosted id carries slashes of
its own, and an upstream may scope ids per tenant, so "tenant-b/claude-sonnet-5"
matched a permitted "claude-sonnet-5" and reached the picker — a model the
policy never named, and one the guardrail denies on sight, since enforcement
compares the id as written. Strip only the namespaces a gateway is known to
prepend, taken from the first slash rather than the last.

The e2e retry loops slept between attempts without watching the context, so a
cancelled run kept retrying calls that fail instantly and spent its remaining
window sleeping between them. They now stop when the context is done.

The streamed provider's setup key outlived its test: deleting the group does
not delete the key that auto-joins it.
This commit is contained in:
mlsmaycon
2026-08-23 06:35:27 +00:00
parent a02aa16cae
commit acfad1a384
5 changed files with 80 additions and 11 deletions
+6 -1
View File
@@ -129,6 +129,9 @@ func provisionStreamingProvider(t *testing.T, ctx context.Context, catalogID str
Ephemeral: &ephemeral,
})
require.NoError(t, err, "mint setup key")
// Deleting the group does not delete the key it auto-joins, so the key
// needs a cleanup of its own.
t.Cleanup(func() { _ = srv.API().SetupKeys.Delete(context.Background(), sk.Id) })
require.NotEmpty(t, sk.Key, "setup key plaintext")
dummyKey := "sk-stream-e2e"
@@ -195,7 +198,9 @@ func chatStreamUntil(t *testing.T, ctx context.Context, env pricedEnv, kind, mod
break
}
}
time.Sleep(5 * time.Second)
if !waitBeforeRetry(ctx, 5*time.Second) {
break
}
}
if code != 200 {
t.Logf("=== proxy logs ===\n%s", env.proxy.Logs(context.Background()))