sync: merge upstream/main and eliminate hardcoded model assumptions
Context
Upstream openai/codex has diverged since our last sync (2026-03-20, commit 18371f44e8). This issue tracks merging the latest upstream changes and addressing the hardcoded model catalog problem raised in upstream#17.
Problem
The system relies on a static bundled model catalog (models.json) and hardcoded model slugs scattered across production code. For custom providers (QAIMH), the hub's /v1/models endpoint should be the sole source of truth — zero bundled models, zero fabricated fallback metadata, zero hardcoded OpenAI model slugs leaking into custom provider flows.
Tasks
1. Upstream sync
- [ ]
git fetch upstream && git merge upstream/main - [ ] Resolve conflicts per CLAUDE.md Conflict Resolution Guide
- [ ] Build and test:
cd codex-rs && cargo build && cargo test - [ ] Run drift check:
bash scripts/check-upstream-drift.sh
2. Eliminate hardcoded model assumptions for custom providers
| Gap | Severity | Description |
|-----|----------|-------------|
| Fallback model metadata | HIGH | model_info_from_slug() fabricates a ModelInfo with OpenAI-specific values (272k context, prompt.md instructions) when slug isn't in catalog |
| Memories default models | HIGH | Phase 1 hardcodes "gpt-5.1-codex-mini", phase 2 hardcodes "gpt-5.3-codex" — custom providers will try calling non-existent models |
| Guardian preferred model | LOW | Hardcodes "gpt-5.4" search (already degrades gracefully, but search is wasteful) |
Approach (additive, via ModelProviderInfo branching)
- Add
allows_fallback_model_metadata()andsubsidiary_model_default()toprovider_strategy.rs - Add
model_info_from_slug_minimal()for custom providers (no OpenAI prompt, no fabricated context window) - Wire provider-aware fallback into
manager.rs,memories/phase1.rs,memories/phase2.rs,guardian/review.rs - All changes preserve upstream behavior bit-for-bit when using OpenAI provider
References
- Upstream issue: openai/codex#17 ("O3 is missing")
- Fork rules: CLAUDE.md § Core Fork Rules
- Conflict resolution: CLAUDE.md § Conflict Resolution Guide
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗