fix(openai): exclude user-owned alias overlays from canonical seed validation - #3121
Conversation
|
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. Hygiene✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughProvider management routes now treat ChangesProvider alias ownership
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: 🔵 Low · up to The PR separates alias updates from general provider edits while preserving stored aliases and transport validation. It is mergeable with owner awareness that persistence and recovery ordering for alias restoration is not fully evidenced and could affect alias retention during failure or recovery paths. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant ProviderClient
participant ProviderRoutes
participant AliasOwnershipCheck
participant TransportValidation
participant DNSValidation
participant PersistedProvider
ProviderClient->>ProviderRoutes: POST /api/providers
ProviderRoutes->>AliasOwnershipCheck: Check submitted alias overlays
ProviderRoutes->>TransportValidation: Validate provider without overlays
ProviderRoutes->>DNSValidation: Await DNS validation
DNSValidation-->>ProviderRoutes: Return validation result
ProviderRoutes->>PersistedProvider: Restore authoritative alias overlays
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Ingwannu
left a comment
There was a problem hiding this comment.
Requesting changes on exact head d72a3213dc10c7fc7e3f85a9250eed34e0d89621.
The reported validation deadlock is real: alias overlays already written by the dedicated alias APIs must not make an otherwise canonical OpenAI row fail transport-seed validation. Deleting the three fields from the comparison candidate is not sufficient at the management boundary, because it also makes the general provider write path an unvalidated alias writer.
PUT /api/providers/{name}/alias, /model-aliases, and /api/default-aliases enforce provider/combo/account namespace collisions, model-alias syntax and uniqueness, native OpenAI-family reservations, and boolean shape. A full /api/providers provider object can now carry arbitrary alias, modelAliases, or defaultAliases; once these fields are discarded before the seed comparison, those dedicated checks are bypassed. The current tests cover transport tampering but not alias tampering or collisions.
Keep alias ownership at the dedicated endpoints. Ordinary provider PATCH/POST should preserve already-persisted alias overlays while validating the transport object, but must not create or alter those overlays without running the same collision/shape rules. Add regressions for:
- a full provider edit preserving existing aliases;
- a general write being unable to introduce a provider alias collision;
- reserved/duplicate/invalid model aliases remaining rejected;
- non-boolean
defaultAliasesand malformed alias maps returning a bounded 4xx rather than reaching config persistence.
This remains Draft with hygiene/target red and no hosted CI. Resolve the ownership boundary and focused tests before requesting workflow approval or Ready review.
d72a321 to
f34aaa4
Compare
|
Thanks for the ownership-boundary review. I reworked the fix on head
Added the requested regressions for full-edit preservation, provider-alias collision attempts, reserved/duplicate/invalid model aliases, malformed/non-boolean payloads with no persistence, the original Tests run:
I also ran the full management-provider file: 88 passed and 5 unrelated destination-policy cases failed because this host's fake-IP DNS resolves |
Ingwannu
left a comment
There was a problem hiding this comment.
Incremental review completed on exact head f34aaa4. The previous ownership bypass is addressed in the current code: full provider POST can only omit alias overlays or round-trip values exactly equal to the stored row, general PATCH rejects all three alias-owned fields, canonical transport validation receives a candidate stripped only after ownership admission, and the latest live alias values are restored synchronously after the DNS await before persistence. The requested collision, reservation, malformed-shape, no-persistence, transport-tampering, and non-OpenAI regressions are present. I did not find a remaining static ownership/transport blocker in this revision.
I am not applying maintainer-sponsored or approving this draft yet. The PR body still has all four readiness boxes unchecked, reports five failures in the full management-provider diagnostic, and the branch is now four commits behind current dev. Please rebase onto current dev, resolve or baseline-classify the full focused-suite failures on that head, tick the checklist only after the stated validation is current, and request security review again. At that point the exact-head workflows can run and sponsorship can be decided from green evidence.
f34aaa4 to
dd60f05
Compare
|
@codex security review @Ingwannu — requesting the exact-head maintainer security review again on The ownership architecture from your incremental review is unchanged. The only follow-up code change restores the destination-policy spy in the canonical alias regression so it cannot mask later tests. Under the same Bun 1.4.0 / Node v23.11.0 / DNS environment:
|
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
The exact-head macOS failure is now traced to the current Job I opened #3143 with the minimal fixture correction. On exact head |
리뷰 · 우선순위 62 / 80설명 이 PR은 canonical OpenAI provider 검증이 사용자 alias 오버레이( baseUrl/adapter/authMode 등 transport identity 가드는 그대로입니다. 전용 alias API만 collision·문법·native-family·boolean shape를 적용합니다. 파일은 라인 PROVIDER_ALIAS_OVERLAY_FIELDS - alias/modelAliases/defaultAliases 소유권을 한상수로 모읍니다. PATCH 거절과 POST round-trip이 같은 목록을 쓰는지 보세요 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
|
The new Grok summary does not supersede the exact-head gate. Current head |
…lidation (rebase of #3121) (#3189) * fix(openai): exclude user-owned alias overlays from canonical seed validation * fix(openai): preserve alias API ownership on provider writes * test(openai): restore alias regression destination spy --------- Co-authored-by: Flowershangfromthebranches <152056395+Flowershangfromthebranches@users.noreply.github.com>
|
Landed via maintainer rebase #3189. All three commits cherry-picked onto current dev with author credit preserved, no conflicts. management-provider-validation reports 91 pass, 0 fail on the rebase head, most of it your own new coverage. Counting user-owned alias overlays as canonical seed entries was a subtle one — the symptom (unrelated provider writes start failing) points nowhere near the cause. Thanks for the fix and for the 265 lines of coverage that come with it. |
Summary
Canonical OpenAI provider validation compares the persisted provider row against the built-in transport seed.
OpenCodex's dedicated alias APIs can legally persist:
defaultAliasesaliasmodelAliasesAfter one of those overlays exists, an unrelated general provider edit such as a context-window PATCH could fail with:
provider openai must equal the canonical built-in provider seedThis validation deadlock is real, but the general provider write path must not become an unvalidated alias writer in order to resolve it.
The revised fix keeps alias ownership at the dedicated APIs:
alias,modelAliases, anddefaultAliases; callers must use the dedicated alias endpoints.Safety
The canonical transport guard remains unchanged and continues rejecting changes to:
baseUrladapterauthModeThe dedicated alias APIs remain the only writers that apply provider/combo/account collision checks, model-alias syntax and uniqueness rules, native-family reservations, and boolean shape validation.
Unrelated non-OpenAI provider edits retain their previous behavior and preserve stored aliases.
Regression coverage
Tests cover:
defaultAliasesand malformed alias maps returning bounded 4xx without persistence;modelContextWindows;baseUrl,adapter, andauthModetampering remaining rejected;Verification
Exact publication head:
dd60f05d73599991b12e11298f741d34ed84ccbfExact upstream baseline:
15b0f701eb69d37382880124be9010e412c20411Environment: Bun
1.4.0, Nodev23.11.0, identical local DNS/proxy/env.bun test tests/management-provider-validation.test.ts --test-name-pattern "full provider edit preserves aliases|general provider writes cannot introduce|general provider writes reject reserved|malformed alias overlays|canonical transport tampering|unrelated non-openai provider edits|canonical OpenAI with defaultAliases can still PATCH modelContextWindows"— 7 passed, 0 failedbun test tests/alias-management-api.test.ts tests/provider-model-aliases.test.ts— 9 passed, 0 failedbun test tests/routing-profile.test.ts --test-name-pattern "alias collision validation"— 1 passed, 0 failedbun run typecheck— passedbun run privacy:scan— passedgit diff --check upstream/dev...HEAD— passedFull focused diagnostic under the same environment:
dd60f05d715b0f701eThe PR adds seven passing regression tests. The 18 failures have the same test names and semantically identical destination-policy errors on both trees; there are no branch-only failures.
Identical baseline/environment failure set
provider PATCH sets, clears, and rejects annotateEmptyToolOutputsprovider POST overwrite preserves modelCosts when the payload omits itprovider POST overwrite preserves the account-failover opt-out when the payload omits it (#2568d)provider POST overwrite preserves an explicit annotateEmptyToolOutputs: falseprovider POST overwrite preserves hand-edited context windows (#1409) > an omitted modelContextWindows keeps the user's map, without registry seed keysprovider POST overwrite preserves hand-edited context windows (#1409) > a submitted modelContextWindows updates that key and keeps the othersprovider POST overwrite preserves hand-edited context windows (#1409) > an omitted contextWindow keeps the user's scalarprovider POST overwrite preserves hand-edited context windows (#1409) > a submitted contextWindow still winsprovider POST overwrite preserves hand-edited context windows (#1409) > a brand-new provider still receives the registry seedprovider POST overwrite preserves hand-edited context windows (#1409) > PATCH can still delete a key with an explicit nullprovider management rejects runtime metadata and accepts only canonical OpenAI option seedsprovider management does not persist registry-only static auth headers for opencode-freeprovider PATCH can enable allowPrivateNetwork and then change baseUrl to localhostprovider PATCH persists liveModels and provider metadata exposes the normalized stateprovider PATCH persists and clears structured-output model opt-outsprovider management rejects POST setDefault for a disabled providerprovider PATCH field-mask edits non-reserved providers and rejects unsafe fields (WP040)provider PATCH manages custom headers with merge and clear semanticsAll failures originate from this host's Clash/Mihomo fake-IP DNS mapping
.example/.example.testfixtures into198.18.0.0/15, after which the existing destination policy correctly returns 400 instead of the tests' expected 200. Evidence from the same shell:This is an exact upstream baseline condition, not a PR regression.
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Tests