Skip to content

fix(agents): detect bundled and legacy providers in model-not-found hint#100120

Merged
openclaw-clownfish[bot] merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/bundled-provider-auth-hint-100066
Jul 6, 2026
Merged

fix(agents): detect bundled and legacy providers in model-not-found hint#100120
openclaw-clownfish[bot] merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/bundled-provider-auth-hint-100066

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

When a legacy openai-codex provider reference (e.g. openai-codex/gpt-5.4) is found in agents.defaults.models, the runtime error prescribes a models.providers["openai-codex"] config entry that the config validator rejects without baseUrl, creating contradictory guidance and a gateway crash-loop.

  • Problem: buildMissingProviderModelRegistrationHint unconditionally suggests adding a models.providers[] entry for the legacy openai-codex alias. Since openai-codex is not in the built-in provider overlay allowlist, the config validator rejects the overlay, bricking the gateway.
  • Solution: Add an early-return check for the legacy openai-codex alias before the generic config-entry suggestion. The new hint points operators to openclaw doctor --fix to migrate to the current OpenAI provider format, or to check provider auth.
  • What changed: src/agents/embedded-agent-runner/model.ts (+9 lines — new check + comment), src/agents/embedded-agent-runner/model.test.ts (+42 lines — 2 new tests)
  • What did NOT change: Config validator behavior; BUILT_IN_MODEL_PROVIDER_OVERLAY_IDS set; bundled provider hint paths (unchanged); non-bundled/custom provider hint path (unchanged); agentRuntimeId hint path (unchanged); doctor migration code

Change Type

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Motivation

The issue reporter followed the runtime's error message verbatim and ended up with a gateway that would not boot. The root cause is that the hint function doesn't account for the legacy openai-codex alias, which has been folded into the openai provider. For this legacy alias, the correct fix is to run openclaw doctor --fix for config migration or to re-authenticate the provider — not to add a models.providers[] overlay that the validator will reject.

Evidence

  • Behavior addressed: Error message guidance for legacy openai-codex provider model-not-found errors
  • Real environment tested: Linux x64, Node 22.19+, branch fix/bundled-provider-auth-hint-100066, OpenClaw local checkout
  • Exact steps or command run after this patch:
$ npx tsx scripts/pr-100066-proof.ts
  • Evidence after fix:
$ node --import tsx scripts/pr-100066-proof.ts
Config warnings: ... (local openclaw.json, unrelated)
Unknown model: openai-codex/gpt-5.4. Found agents.defaults.models["openai-codex/gpt-5.4"], but "openai-codex" is a legacy provider ID. Run `openclaw doctor --fix` to migrate to the current OpenAI provider format. If the provider has no authenticated profile, run `openclaw models status` to check provider auth and re-authenticate if needed. See https://docs.openclaw.ai/concepts/model-providers.

The test suite also exercises this path via the production resolveModelAsync function:

$ pnpm test src/agents/embedded-agent-runner/model.test.ts

 Test Files  1 passed (1)
      Tests  122 passed (122)

Before/after matrix:

Input Before (main) After (this PR)
openai-codex/gpt-5.4 (legacy) "...no matching models.providers["openai-codex"].models[] entry. Add { "id": "gpt-5.4", "name": "gpt-5.4" }..." → validator rejects → crash-loop ""openai-codex" is a legacy provider ID. Run \openclaw doctor --fix`..."`
microsoft-foundry/Kimi-K2.6-1 (bundled) "...no matching models.providers["microsoft-foundry"].models[] entry..." Unchanged (bundled provider overlay path works correctly)
custom-provider/some-model (custom) "...no matching models.providers["custom-provider"].models[] entry..." Unchanged (custom providers need config entry)
  • Observed result after fix:
    1. Legacy openai-codex now shows doctor migration + auth guidance instead of misleading config-entry advice
    2. Bundled providers (e.g. microsoft-foundry) retain the existing config-entry guidance — overlays work correctly for them
    3. Custom/non-bundled providers retain the existing config-entry guidance (unchanged)
  • What was not tested: Full gateway Docker startup with openai-codex lacking auth (the error message change is the fix; the gateway no longer receives a contradictory config); existing real-world configs with openai-codex model refs are handled by openclaw doctor --fix migration

Root Cause

buildMissingProviderModelRegistrationHint (introduced in 1ee2733b2f, Vincent Koc, 2026-06-17) lacked awareness of the legacy openai-codex alias. The function always fell through to the generic models.providers[] config-entry suggestion, which the config validator rejects for openai-codex because it is not in BUILT_IN_MODEL_PROVIDER_OVERLAY_IDS.

User-visible / Behavior Changes

Operators encountering model-not-found errors for the legacy openai-codex provider will now see actionable guidance pointing to openclaw doctor --fix for migration or auth check, instead of misleading config instructions that crash the gateway.

Security Impact

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Compatibility / Migration

  • Backward compatible? Yes — only error message text for a single legacy alias path
  • Config/env changes? No
  • Migration needed? No

Best-fix Verdict

  • Best fix: Yes. The fix is at the shared hint function entry point, is narrowly scoped to only the legacy openai-codex alias, and doesn't affect bundled providers whose overlay path works correctly.
  • Refactor needed: No. The change is focused and minimal.
  • Alternative considered: Adding openai-codex to BUILT_IN_MODEL_PROVIDER_OVERLAY_IDS — rejected because repository policy treats openai-codex as legacy-only input, not a valid new provider overlay.

Risks and Mitigations

Highest risk area: None. The change only affects error message text for the legacy openai-codex alias. Bundled providers, custom providers, and the agentRuntimeId path are completely unchanged.

No compatibility risk — only error message text changes for a single legacy code path, no runtime behavior modification.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Jul 5, 2026
@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 2:10 AM ET / 06:10 UTC.

Summary
The branch adds a legacy openai-codex branch to embedded-agent missing-model hint generation and tests that legacy refs point to doctor/status guidance while custom-provider hints remain unchanged.

PR surface: Source +6, Tests +63. Total +69 across 2 files.

Reproducibility: yes. at source level: current main still emits the generic models.providers[...] hint for unresolved configured openai-codex refs, and current validation rejects that overlay without baseUrl. I did not run a live Docker crash-loop reproduction in this read-only review.

Review metrics: 1 noteworthy metric.

  • Open candidate fixes: 3 open, 1 closed unmerged. Multiple live branches target the same helper and linked crash-loop issue, so maintainers need one canonical implementation before merge.

Stored data model
Persistent data-model change detected: migration/backfill/repair: src/agents/embedded-agent-runner/model.test.ts, migration/backfill/repair: src/agents/embedded-agent-runner/model.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #100066
Summary: This PR is a candidate fix for the canonical contradictory legacy openai-codex model-not-found guidance bug; sibling PRs address the same root cause with slightly different wording or test scope.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Choose this PR or a sibling as the canonical fix before merging.

Risk before merge

  • [P1] Three proof-positive open PRs target the same linked crash-loop recovery bug, so maintainers should select one canonical branch before merge and close or supersede the siblings after landing.

Maintainer options:

  1. Decide the mitigation before merge
    Land one canonical narrow hint fix that keeps openai-codex legacy-only, preserves custom-provider guidance, points to doctor/status/OpenAI auth recovery, and then close sibling candidate PRs as duplicates.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No automated repair is needed; maintainers should choose the canonical fix among the overlapping PRs and let exact-head CI and merge review gate the selected branch.

Maintainer decision needed

  • Question: Should maintainers select this branch as the canonical fix for the legacy openai-codex model-not-found guidance bug, or prefer one of the sibling PRs?
  • Rationale: The code path is narrow and appears correct, but multiple open PRs change the same helper and tests for the same linked bug, so automation should not choose the canonical branch without maintainer intent.
  • Likely owner: vincentkoc — vincentkoc is assigned on the live PR and authored the latest head commit that extended the test coverage.
  • Options:

Security
Cleared: The diff only changes TypeScript error-message branching and focused tests; it adds no dependency, workflow, secret, permission, network, or package-execution surface.

Review details

Best possible solution:

Land one canonical narrow hint fix that keeps openai-codex legacy-only, preserves custom-provider guidance, points to doctor/status/OpenAI auth recovery, and then close sibling candidate PRs as duplicates.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: current main still emits the generic models.providers[...] hint for unresolved configured openai-codex refs, and current validation rejects that overlay without baseUrl. I did not run a live Docker crash-loop reproduction in this read-only review.

Is this the best way to solve the issue?

Yes, this is the right narrow fix shape: the shared missing-model hint helper owns the bad recovery text, and the PR keeps openai-codex legacy-only while preserving custom-provider guidance. The remaining question is branch selection among overlapping PRs.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 241c761d0036.

Label changes

Label justifications:

  • P0: The PR targets a linked recovery path where following OpenClaw's own hint can leave the gateway unable to boot after a provider config edit.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes terminal output from a production resolveModelAsync proof showing the corrected legacy openai-codex recovery hint, and the latest head adds focused test coverage for the added provider-config variant.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal output from a production resolveModelAsync proof showing the corrected legacy openai-codex recovery hint, and the latest head adds focused test coverage for the added provider-config variant.
Evidence reviewed

PR surface:

Source +6, Tests +63. Total +69 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 0 +6
Tests 1 63 0 +63
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 69 0 +69

What I checked:

Likely related people:

  • vincentkoc: Live PR metadata shows this PR assigned to vincentkoc, and the latest head commit adding provider-config coverage was authored by him. (role: likely follow-up owner; confidence: high; commits: 91c94e97badc; files: src/agents/embedded-agent-runner/model.ts, src/agents/embedded-agent-runner/model.test.ts)
  • sweetcornna: Commit 1532b46 changed the generic configured-model registration hint text that becomes misleading for legacy openai-codex users. (role: introduced current generic hint behavior; confidence: high; commits: 1532b46e2a63; files: src/agents/embedded-agent-runner/model.ts, src/agents/embedded-agent-runner/model.test.ts)
  • RomneyDa: Commit 9388550 added the nearby runtime-bound model hint branch and tests in the same missing-model recovery helper. (role: recent adjacent contributor; confidence: high; commits: 938855082ade; files: src/agents/embedded-agent-runner/model.ts, src/agents/embedded-agent-runner/model.test.ts)
  • openperf: Commit e06f6ff added recent doctor migration work for merging legacy openai-codex model/provider config into canonical openai, which this PR points operators toward. (role: legacy migration contributor; confidence: medium; commits: e06f6ffc3e87; files: src/commands/doctor/shared/legacy-config-core-normalizers.ts)
  • steipete: Current-main blame attributes the present helper and provider-overlay validator snapshot to commit bf04d04, giving a recent source-routing signal for this area. (role: current source owner signal; confidence: medium; commits: bf04d049fa36; files: src/agents/embedded-agent-runner/model.ts, src/config/zod-schema.core.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (8 earlier review cycles)
  • reviewed 2026-07-05T00:25:58.817Z sha 872aadc :: needs real behavior proof before merge. :: [P1] Preserve built-in provider registration guidance
  • reviewed 2026-07-05T00:32:19.209Z sha 872aadc :: needs real behavior proof before merge. :: [P1] Preserve built-in provider registration guidance
  • reviewed 2026-07-05T00:38:20.945Z sha 7b9ec53 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T00:44:08.392Z sha 7b9ec53 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T02:00:32.082Z sha 81ab7f6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T02:05:54.570Z sha 81ab7f6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T02:13:54.284Z sha 7b9ec53 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T02:19:29.036Z sha 7b9ec53 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 5, 2026
…und hint

In buildMissingProviderModelRegistrationHint, add an early-return check
for the legacy openai-codex alias (via normalizeProviderId). Instead
of suggesting a models.providers[] config entry that the config
validator rejects without baseUrl, the hint now points operators to
run openclaw doctor --fix for migration or check provider auth.

Fixes openclaw#100066

Co-Authored-By: Claude <[email protected]>
@SunnyShu0925
SunnyShu0925 force-pushed the fix/bundled-provider-auth-hint-100066 branch from 872aadc to 7b9ec53 Compare July 5, 2026 00:33
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Narrowed the fix to only the legacy openai-codex alias (removed the broad isBuiltInModelProviderOverlayId check). Added real behavior proof via tsx script running the production resolveModelAsync function.

@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 5, 2026
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI green now. Narrowed to only legacy openai-codex with real behavior proof.

@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-clownfish
openclaw-clownfish Bot merged commit d6dad9d into openclaw:main Jul 6, 2026
96 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 6, 2026
…int (openclaw#100120)

* [AI] fix(agents): detect legacy openai-codex provider in model-not-found hint

In buildMissingProviderModelRegistrationHint, add an early-return check
for the legacy openai-codex alias (via normalizeProviderId). Instead
of suggesting a models.providers[] config entry that the config
validator rejects without baseUrl, the hint now points operators to
run openclaw doctor --fix for migration or check provider auth.

Fixes openclaw#100066

Co-Authored-By: Claude <[email protected]>

* fix(agents): cover legacy Codex provider config hint

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
…int (openclaw#100120)

* [AI] fix(agents): detect legacy openai-codex provider in model-not-found hint

In buildMissingProviderModelRegistrationHint, add an early-return check
for the legacy openai-codex alias (via normalizeProviderId). Instead
of suggesting a models.providers[] config entry that the config
validator rejects without baseUrl, the hint now points operators to
run openclaw doctor --fix for migration or check provider auth.

Fixes openclaw#100066

Co-Authored-By: Claude <[email protected]>

* fix(agents): cover legacy Codex provider config hint

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Provider model registration error prescribes a config fix that the config validator rejects (contradictory guidance, gateway crash-loop)

2 participants