Skip to content

fix(models): apply new-model policy before discovery, sync and export publication - #6331

Merged
lidge-jun merged 1 commit into
devfrom
codex/carry-6260-new-model-policy
Sep 30, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/carry-6260-new-model-policy

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Carries #6260 by @colthreepv with a maintainer fix. With the new-model policy set to off, discovery, startup/explicit sync and client exports could publish newly arrived models before the policy ran. The policy now applies before each of those publication points, and the localized arrival-policy docs match the English source.

Review found one config-integrity defect in the original: src/providers/new-model-policy-runtime.ts treated a stale file-backed config as a synthetic one and mutated it in memory. If another writer had recorded a model as known and enabled, stale discovery could disable it in memory, and a later unrelated save would persist that over the operator's choice. A file-loaded config now keeps its file provenance after inventory drift (src/config/rebase-provenance.ts), and stale discovery is refused under the existing mutation coordinator without touching live visibility.

Supersedes #6260.

Co-authored-by: colthreepv 2657230+colthreepv@users.noreply.github.com

Verification

  • Stale-writer regressions: with the old runtime restored, 9 pass / 5 fail, including the persisted overwrite; with the fix, all pass.
  • On current dev: bun test over the five new-model-policy suites, config-rebase-provenance-writers, test-layout and file-size ratchet guards: 76 pass / 0 fail; bun x tsc --noEmit passes. The fix lane also ran config-load-degrade (55 pass across its set), privacy:scan and structure:check.
  • The docs-site build was not run locally.
  • Full local suite not run by maintainer instruction; Cross-platform CI runs once on the final dev tip after this landing batch.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

… publication

Carries #6260 with a maintainer fix: a file-loaded config keeps its file provenance after discovery inventory drift, so stale discovery is refused under the mutation coordinator instead of disabling a model in memory that a later unrelated save would persist over the operator's choice.

Co-authored-by: colthreepv <2657230+colthreepv@users.noreply.github.com>
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 30, 2026 15:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T15:12:32.534904Z 104f29d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 30, 2026
@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 8c1674d5-5fc9-47fd-a0a7-34bf3e2d8f3d

📥 Commits

Reviewing files that changed from the base of the PR and between 87e182f and 104f29d.

📒 Files selected for processing (26)
  • docs-site/src/content/docs/guides/model-routing.md
  • docs-site/src/content/docs/ja/guides/model-routing.md
  • docs-site/src/content/docs/ko/guides/model-routing.md
  • docs-site/src/content/docs/ru/guides/model-routing.md
  • docs-site/src/content/docs/zh-cn/guides/model-routing.md
  • scripts/test-layout/layout.json
  • src/codex/catalog/retained-sync.ts
  • src/config.ts
  • src/config/live-reconcile.ts
  • src/config/rebase-provenance.ts
  • src/providers/new-model-policy-runtime.ts
  • src/providers/new-model-policy.ts
  • src/server/management/model-rows.ts
  • src/server/management/shared.ts
  • structure/catalog.md
  • structure/clients/integrations.md
  • structure/config.md
  • structure/gui-and-management-api.md
  • structure/providers-and-adapters.md
  • structure/runtime.md
  • tests/codex-integration/codex-sync-new-model-policy.test.ts
  • tests/fixtures/test-layout-expected.json
  • tests/providers/new-model-policy-runtime.test.ts
  • tests/providers/new-model-policy.test.ts
  • tests/server/model-export-new-model-policy.test.ts
  • tests/server/server-new-model-policy-arrival.test.ts
 _____________________________________________________________
< Jurassic Park would have been a lot shorter with me around. >
 -------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration into dev (MAINTAINERS.md, dev-only exception) by @lidge-jun. Carries #6260 with a config-integrity fix and a Co-authored-by trailer; evidence is in the description. The config-write path was reviewed: persistence stays under the existing mutation coordinator, and stale discovery is refused without mutating live state. Cross-platform CI for this head was cancelled per the maintainer's single-final-run instruction and runs once on the final dev tip. scripts/ci/assert-mergeable-review.sh --maintainer-integration OK at this head.

@lidge-jun
lidge-jun merged commit f9bfca0 into dev Sep 30, 2026
13 of 28 checks passed
@lidge-jun
lidge-jun deleted the codex/carry-6260-new-model-policy branch September 30, 2026 15:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 104f29de65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment on lines +48 to +50
if (!baseline.persisted && filePath === undefined) {
// Standalone/synthetic callers may project their own config, never overwrite another home.
reconcile(config);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve file provenance across startup clones

Treating every unmarked object as synthetic reintroduces the stale-config overwrite in the actual server path: startServer passes the result of loadConfig() through runOpenAiTierStartupMigration, whose projector always structuredClones the config even on a no-op, so the long-lived config loses the new WeakMap provenance. If the file changes before a later discovery begins, baseline.persisted is false and this branch mutates the stale live object instead of refusing it; an operator's persisted enable can therefore become disabled in memory and be written back by an unrelated save. Preserve/transfer provenance through startup transformations, or require explicit synthetic provenance rather than inferring it from filePath === undefined.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant