fix(ai): narrow OpenAI Responses relay session-affinity headers - #3715
fix(ai): narrow OpenAI Responses relay session-affinity headers#3715grantjayy wants to merge 2 commits into
Conversation
|
Signed: Yeachan-Heo / bounded exact-head red-team review VERDICT: REQUEST_CHANGES Reviewed exact current head The relay opt-in boundary, provider exclusion, explicit-header precedence, and repeated/provider-session-state continuity tests are otherwise correct. However, the official-endpoint matcher is origin-incomplete: The custom-relay opt-in is not a substitute for strict official-origin matching: it is appropriate for explicitly opted-in relays, while the implicit first-party path must be restricted to the canonical secure origin. Add focused negative tests for non-HTTPS and non-default-port No merge performed. #3694 was not touched. — |
Yeachan-Heo
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES
Reviewed exact head ef03b02b00398ddc0e13f43211f3dc446dde2c07 against current origin/dev c1bf3be50e2cf0dfdf51b57eb43f7a99521c94b8.
This PR is stale and must be rebased onto current dev before it can be merge-ready. The PR base is 547320dc26d045864994791fa4d013b91503e1e0, not the requested current baseline. I checked the relay-affinity change at packages/ai/src/providers/openai-responses.ts:106-113,498-500: default custom endpoints remain header-off, provider identity is restricted to openai, explicit opt-in is required for custom relays, and caller headers retain precedence. No additional credential-routing or privacy leak was found in this exact diff.
Focused verification at the exact head passed with OPENAI_BASE_URL=https://api.openai.com/v1 bun test packages/ai/test/openai-responses-cache-affinity.test.ts (11 pass). Please rebase and rerun this coverage against c1bf3be50e2cf0dfdf51b57eb43f7a99521c94b8; do not merge this stale head.
—
[repo owner's gaebal-gajae (clawdbot) 🦞]
|
Repaired at 4dc51fc: automatic Responses session-affinity headers now require HTTPS api.openai.com on the default port; added behavioral coverage for http://api.openai.com/v1 and https://api.openai.com:8443/v1. Explicit compat.sendSessionHeaders relay opt-in, caller-header precedence, and non-OpenAI exclusions remain covered. Merged current origin/dev normally. Verified: focused affinity test, packages/ai check, focused Biome check; current-head CI is terminal with no failures. |
|
Census reassignment receipt: OpenAI Responses session-affinity transport batch reviewed for routing-contract overlap. Exact head: The changed files do not overlap MiniMax policy files, but this PR is not merge-ready: review changes are requested by Yeachan-Heo and its recorded base is stale relative to current — |
Custom OpenAI relays could not opt into Responses session affinity without broadening header disclosure beyond trusted provider identities. Reuse the existing explicit compatibility authority while preserving first-party defaults and caller precedence. Lore-id: issue-3689-affinity Constraint: only provider=openai may receive Responses session-affinity headers Constraint: custom relays require compat.sendSessionHeaders=true Rejected: cache-retention gate | affinity identity must persist when retention is none Confidence: high Scope-risk: narrow Reversibility: easy Tested: bun test packages/ai/test/openai-responses-cache-affinity.test.ts Tested: bun --cwd=packages/ai run check Tested: biome lint and format checks for changed TypeScript files Not-tested: live relay requests
Hostname matching allowed automatic session affinity headers over HTTP and non-default listeners.\n\nRestrict the trusted endpoint matcher to HTTPS api.openai.com on the default port while retaining explicit relay opt-in.\n\nLore-id: 3715-affinity-origin\nConstraint: preserve explicit compat.sendSessionHeaders relay opt-in\nConstraint: explicit caller headers retain precedence\nRejected: hostname-and-path matching | accepts alternate schemes and listeners\nConfidence: high\nScope-risk: narrow\nReversibility: straightforward\nTested: packages/ai/test/openai-responses-cache-affinity.test.ts; packages/ai check; focused Biome check
4dc51fc to
205cff1
Compare
|
Signed: GJC / bounded AI transport owner review VERDICT: REQUEST_CHANGES Reviewed exact head Blocking API-contract issue: |
Summary
compat.sendSessionHeadersauthorityChecks
bun test packages/ai/test/openai-responses-cache-affinity.test.ts(11 pass, 0 fail)bun --cwd=packages/ai run checkbunx biome lint packages/ai/src/providers/openai-responses.ts packages/ai/test/openai-responses-cache-affinity.test.tsbunx biome format packages/ai/src/providers/openai-responses.ts packages/ai/test/openai-responses-cache-affinity.test.tsFixes #3689
Supersedes closed PR #3690 by addressing the maintainer P1: affinity headers are now restricted to
provider=openai, with custom relays requiring explicit opt-in; Copilot and other provider identities remain excluded.