feat(sdk): support renewable model authentication - #720
Draft
gero-oai wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
注册 for free
to join this conversation on GitHub.
Already have an account?
登录 to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Findings embeddings currently require a static key and a fixed API endpoint. Reviews can also displace an explicitly configured command-auth provider with stored credentials, and an empty primary API-key variable masks the secondary key.
This adds provider-neutral embedding configuration and renewable credentials while preserving Codex's native command authentication for reviews.
Changes
OpenAiFindingEmbedderoptions overload withbaseUrl, additional headers, and a static key or async credential callback. Resolve the callback before every HTTP batch without caching or credential fallback; keep the original constructor, OpenAI defaults, model, dimensions, batching, and vector validation.@openai/codex-security/serverentrypoint with the embedder, server startup, SQLite store, and public interface types.CODEX_HOME, including profile selection. Remove static OpenAI keys from the review child environment and skip API-key login for that provider.Headershandling, and document an opt-in provider-auth smoke test using the actual pinned app-server.Testing
Validation used Bun 1.3.14; full-suite runs used a standard
022umask.bun test --timeout 30000 ./tests-ts, seed3661285786): 2,060 passed, 31 skipped, 0 failed.pnpm run test --seed 12345): 2,059 passed, 31 skipped, 1 failed. The unchanged patch UI test “edits instructions per finding and only returns selected guidance” failed once. Its isolated file rerun passed all 9 tests, and it passed in the randomized full suite. No unrelated UI code was changed.pnpm run types,pnpm run format,pnpm run build, andgit diff --check: passed.pnpm run check:package: passed, including the new public import, strict NodeNext consumer, installed CLI, bundled runtime, dashboard, and nested-worker checks.No live provider credentials were used. Local synthetic-provider validation does not establish compatibility with a live service. Platform-specific tests skipped on this host remain for CI.
Risk and rollout
The new SDK overload and server subpath are additive. No CLI commands, flags, or environment variables are added, and there are no database migrations, dependency upgrades, or model changes. Existing key variables now ignore empty or whitespace-only values; explicitly configured command authentication takes precedence for reviews.
Callers remain responsible for token acquisition, route/provider pinning, private-home lifecycle, and rejecting route changes during renewal. Review refresh remains owned by Codex. Preserve credential and review isolation, and do not persist tokens or expose helper/provider bodies in errors.
Release through the normal package process after review and CI. Validate the opt-in smoke against an authorized live provider before adoption; no release or deployment is part of this PR.
Public disclosure review