Skip to content

feat(sdk): support renewable model authentication - #720

Draft
gero-oai wants to merge 1 commit into
openai:mainfrom
gero-oai:codex/renewable-model-auth
Draft

feat(sdk): support renewable model authentication#720
gero-oai wants to merge 1 commit into
openai:mainfrom
gero-oai:codex/renewable-model-auth

Conversation

@gero-oai

Copy link
Copy Markdown

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

  • Add an OpenAiFindingEmbedder options overload with baseUrl, 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.
  • Export a side-effect-free @openai/codex-security/server entrypoint with the embedder, server startup, SQLite store, and public interface types.
  • Preserve an explicitly selected command-auth provider in CODEX_HOME, including profile selection. Remove static OpenAI keys from the review child environment and skip API-key login for that provider.
  • Select the first nonempty OpenAI API key in the server and review runner, including Windows environment-name casing.
  • Add regression and installed-package coverage, update the container mock for standard Headers handling, 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 022 umask.

  • Focused embedding, authentication, review, and comparison tests: 63 passed, 5 skipped.
  • Full randomized suite (bun test --timeout 30000 ./tests-ts, seed 3661285786): 2,060 passed, 31 skipped, 0 failed.
  • Seeded suite (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, and git diff --check: passed.
  • Package build and pnpm run check:package: passed, including the new public import, strict NodeNext consumer, installed CLI, bundled runtime, dashboard, and nested-worker checks.
  • Existing container embedding fixture exercised with the built SDK: passed.
  • Opt-in authentication smoke with Codex 0.149.1 and a local synthetic provider: passed renewed embeddings, both review models, native helper refresh, authentication failure, and credential-persistence 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

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant