Repository navigation
fix(doctor): preserve model choices without retirement evidence - #178722
Conversation
Remove name-only generation substitutions from legacy model normalization and xAI search migrations. Leave retirement decisions with the existing provider catalog and route-aware repair owner, preserving selections and their settings when retirement is not established. Fixes #169473 Co-authored-by: Ted Li <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: blocked before merge. What this changesThis PR removes name-based model substitutions from Doctor while preserving spelling normalization and declared-retirement repair. Example: Doctor repairs a configuration selecting openai/gpt-4.1-mini@openai:work.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it addresses a current model-preservation defect, has maintainer-approved direction, and introduces no actionable code finding in this review. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor normalizes saved configuration before validation and persistence; the separate retirement owner consumes provider declarations and authentication-route evidence to validate replacements. flowchart TD
A[Saved configuration] --> B[Doctor legacy migrations]
B --> C[Spelling and identity normalization]
C --> D[Route-aware retirement owner]
E[Provider retirement declarations] --> D
D --> F[Validated saved configuration]
F --> G[Prepared model catalog]
Technical reviewBest possible solution: Keep spelling normalization separate from retirement decisions and finish compatibility validation through the installed updater. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically substitutes GPT-4.1 Mini without retirement evidence, and the supplied real Doctor comparison reports the corresponding persisted change; this review ran no target code. Is this the best way to solve the issue? Removing the competing policy is the smallest complete fix: preserve model identity during legacy normalization and leave genuine retirement decisions with the existing route-aware owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e2a44c21e27f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -234, Tests -117, Docs +2. Total -349 across 12 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 20, 2026, 4:24 PM ET / 20:24 UTC (Revision 2). |
Keep the still-served model in the OpenAI catalog instead of relying on Doctor to replace the operator's choice. Preserve its deprecated status and strengthen the unchanged operator corpus's identity assertions. Co-authored-by: Ted Li <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf533a529b
ℹ️ 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".
| "input": ["text", "image"], | ||
| "contextWindow": 1047576, | ||
| "maxTokens": 32768, | ||
| "cost": { "input": 2, "output": 8, "cacheRead": 0.5, "cacheWrite": 0 } |
There was a problem hiding this comment.
Reuse the GPT-4.1 catalog row for live accounts
When an OpenAI API-key account's /models discovery succeeds and lists gpt-4.1, projectOpenAIAccountModels drops it because every pre-GPT-5 ID is filtered, and resolveOpenAIGptForwardCompatModel then returns buildOpenAIUncataloguedModel before consulting this manifest row. A preserved openai/gpt-4.1 selection therefore runs with generic 128k-context, 16,384-output, text-only, zero-cost metadata instead of the newly declared 1,047,576 context, 32,768 output, image support, and pricing. Reuse this manifest row in the pre-GPT-5 dynamic path, or retain exact catalog rows returned by discovery.
AGENTS.md reference: AGENTS.md:L18-L20
Useful? React with 👍 / 👎.
Replace the stale name-only retirement expectation left by #178722 (76734c4). Preserve the configured model and assert that noncanonical spelling still reports the plugins path without an agents section. Check that diagnostics leave the authored model untouched. Reproduced the hourly 39524896041 failure locally. Native wrapper proof: 54 tests pass across config-misc and legacy-config-migrate.media-models, with one worker. Targeted typecheck, lint, formatting and P2 review pass.
Match the model-preservation contract from #178722. The July fixture explicitly selects Sonnet 4.5 and Opus 4.5; expect those same IDs in the migrated allowlist instead of the removed name-only upgrade targets. The complete composition file and related model-preservation tests pass with one worker, as do targeted types, lint, format, and P2 review.
) Fixes openclaw#169473. Doctor rewrote configured models the provider still serves via hard-coded name-only substitution tables. Those tables are removed (-234 net production lines); model retirement is decided only by the existing provider-catalog and route-aware owner. The OpenAI catalog gains the still-served, deprecated openai/gpt-4.1 row (shutdown 2027-01-14) that the old rewrite had concealed. Spelling normalization, web-tool credential migration and legacy openai-codex provider migrations are unchanged. Supersedes openclaw#170742, thanks @MonkeyLeeT. Co-authored-by: Ted Li <[email protected]>
Replace the stale name-only retirement expectation left by openclaw#178722 (8dfbfc7). Preserve the configured model and assert that noncanonical spelling still reports the plugins path without an agents section. Check that diagnostics leave the authored model untouched. Reproduced the hourly 39524896041 failure locally. Native wrapper proof: 54 tests pass across config-misc and legacy-config-migrate.media-models, with one worker. Targeted typecheck, lint, formatting and P2 review pass.
Match the model-preservation contract from openclaw#178722. The July fixture explicitly selects Sonnet 4.5 and Opus 4.5; expect those same IDs in the migrated allowlist instead of the removed name-only upgrade targets. The complete composition file and related model-preservation tests pass with one worker, as do targeted types, lint, format, and P2 review.
What Problem This Solves
Doctor's legacy migration rewrites explicitly selected models before the provider/route-aware retirement owner can inspect them. It even rewrites a configured catalog row that still lists the selected model:
openai/gpt-4.1-minibecomesopenai/gpt-5.4-mini.Fixes #169473. Supersedes #170742, thanks @MonkeyLeeT.
User Impact
Served models and selections with unknown retirement status retain their primary/fallback choices, profile suffixes, aliases, settings, and catalog IDs through Doctor and update-time config migration. This covers the old OpenAI, Claude, Copilot, Groq, and xAI name substitutions, including xAI web-search migration. Canonical spelling and provider-identity migrations remain supported.
Why This Change Was Made
Delete the competing name tables and Claude generation patterns. The existing provider catalog retirement declarations and route-aware repair owner remain responsible for genuine retirements and successor validation. The OpenAI manifest now also retains the served
gpt-4.1row so preserving that selection yields a usable prepared catalog. A model missing from the bundled catalog is insufficient evidence to replace it; undeclared retirements remain operator choices.The nearby xAI migration still moves configuration/authentication into the owning plugin, without changing its model. The obsolete generation-rewrite test is replaced by preservation regressions; collision and prototype-safety tests now use genuine spelling aliases.
Production (including provider metadata): +38 / -272 (net -234). Tests: +89 / -206 (net -117). Documentation: +2. This follow-up adds 11 production metadata lines and changes the corpus test by +2/-1.
Evidence
legacy-roster.jsonselectsopenai/gpt-4.1. The deleted name table used to rewrite it togpt-5.5, concealing thatgpt-4.1was missing from the bundled OpenAI catalog. Static preparation consults the manifest and the OpenAI static hook returns that same inventory; no row meant no prepared OpenAI entry. The operator fixture and its provider assertion are unchanged. The test additionally requires the original configured and catalog model IDs.git diff --check, and Madge (0 cycles) passed. Fresh independent Codex P0–P2 review of the repair found no actionable defects. Fullcheck:changedSQLite inventory remains omitted under the campaign time budget.Follow-up focused proof: 458 tests across 27 files passed (118 Doctor tests across eight files plus 340 OpenAI tests across 19 direct/one-hop consumer files), using the repository runner with isolated state and one worker. The known slow billing-route file used 171.435 seconds of test time; its deferred-retirement cases took 36.636s / 35.893s. No timeout, retry, or assertion was relaxed. The complete focused run finished in 313.60s. The installed-package upgrade gap noted by ClawSweeper remains unrun; this repair does not claim that proof or request a merge.
pnpm openclaw doctor --fix --non-interactiveran with isolatedHOME,OPENCLAW_STATE_DIR, andOPENCLAW_CONFIG_PATH, synthetic config/credentials, and an unused local port. Base1c4b27072712replaced the OpenAI primary, Claude/Groq fallbacks, alias key, and catalog row. The candidate exited 0 and preserved every one of those fields. Its backup retained the original model selections. No authenticated provider inference or installed-package upgrade was run.tsconfig.core.jsonand Doctor testtest/tsconfig/tsconfig.core.test.commands-doctor.jsontype checks passed. Targeted oxlint, oxfmt, docs MDX validation,git diff --check, and Madge (0 cycles) passed. Independent Codex P0–P2 review found no actionable defects.debugger;failed witheslint(no-debugger)and exit 1; all changed TypeScript files then passed. The interrupted wrapper's task-owned lock was released only after its owner and descendants were verified stopped. The initial combined E2E setup consequently failed before tests; the successful E2E run reused the rebuilt runtime.check:changedSQLite inventory was omitted because of its known long-running inventory step; broad CI is pending.Commands (all under isolated state; the first run exposed the obsolete diagnostic assertion, and the second reran the affected file plus the remaining suites):
Follow-up corpus commands, each with
HOMEandOPENCLAW_STATE_DIRunder this worktree's.artifacts/, and a runtime-specific module cache: