Skip to content

fix(agents): normalize bare model defaults with captured metadata - #144429

Merged
steipete merged 1 commit into
mainfrom
codex/providerless-model-owner-main-20260910-v1
Sep 10, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/providerless-model-owner-main-20260910-v1

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #130706. Prerequisite for the bare-default cases held in #144354 and CLI model validation.

What Problem This Solves

Fixes an issue where a simple completion falling back to a bare configured primary could reject the model or use the wrong metadata, despite already having the provider's normalization policy. For entry → middle → final, the fallback could retain raw entry while later preparation treated it as fully selected.

Why This Change Was Made

Captured bare defaults now continue through the existing model-reference parser. It reuses cached metadata, normalization flags, auth-profile parsing and configured API-owner handling. Callers without captured metadata keep the existing cheap raw path; already resolved branches return before this point. The production change is two added lines.

User Impact

Default fallback selection uses the provider's intended model without resolving an already-selected alias twice. No configuration, schema, persisted fields, imports, or public API options are added, and this change introduces no new metadata discovery.

Evidence

Validated 62675418c10dc22d7f1b673c3b20145543c3acf3 against main f9976d6de6a086c3b19edbfaeb7412db47b50bb7.

  • Unmodified-main source baseline: nine intended failures and 35 passing controls.
  • 265 focused tests across seven files passed, followed by the full pinned changed-file gate and fresh independent P2 review.
  • One normal full build passed with natural metadata bound to the candidate commit.
  • Five fresh public SDK processes made five real loopback HTTP requests. Invalid-override fallback, valid override, inherited default, raw next-hop and exact-ID cases verified selection, materialized context, response text and request model. Nine public model-config checks covered metadata/normalization modes.
  • All 14,636 build outputs and source stayed unchanged; 3,983 executed files were verified. Source-import rejection controls passed, all five processes exited naturally, and owned runtime state was removed.

Two earlier compiled fixture attempts remain failed and preserved: an explicit configured API mapping treated / as a literal ID, and a disabled canonical provider owner prevented the synthetic plugin from loading. The final fixture verifies the invalid-override precondition and enables its isolated synthetic provider replacement. Source and build were unchanged between attempts. This is compiled SDK/loopback proof, not external vendor inference; it does not borrow the unlanded TTS patch.

Let unresolved bare defaults with captured plugin metadata reach the existing
model-reference parser. Preserve the cheap raw return when metadata is absent,
reuse the cached context, and keep already selected refs off a second pass.

This repairs invalid simple-completion overrides falling back to an unnormalized
model ID marked selected. Cover one-pass aliases, metadata scope, normalization
flags, auth-profile parsing, configured API ownership, and agent acquisition.
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 10, 2026
@steipete
steipete marked this pull request as ready for review September 10, 2026 21:41
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 5:49 PM ET / 21:49 UTC.

ClawSweeper review

What this changes

The PR makes providerless default models use already-captured provider normalization rules and adds regression coverage for selection and completion acquisition.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main and v2026.9.3 retain the raw fallback that bypasses captured normalization. No actionable introduced defect was found, and the related TTS work explicitly depends on this correction.

Priority: P2
Reviewed head: 62675418c10dc22d7f1b673c3b20145543c3acf3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level correction with useful regression coverage and reported compiled-path validation; no blocking defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies this as a member-authored PR, so the ordinary contributor proof gate is exempt; no material authority change triggers an exception. Its body reports relevant compiled SDK loopback validation of fallback selection and request model, although raw traces were not supplied.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies this as a member-authored PR, so the ordinary contributor proof gate is exempt; no material authority change triggers an exception. Its body reports relevant compiled SDK loopback validation of fallback selection and request model, although raw traces were not supplied.
Evidence reviewed 9 items Current main still needs the correction: The fetched main revision retains the unconditional raw return; its production-file difference from the reviewed head is precisely the conditional guard around that return.
Existing owner and normalization controls: The changed branch reaches the existing parser with the cached metadata context and both normalization flags. Previously resolved aliases and inferred providers return earlier; the metadata-absent path remains unchanged.
Completion entrypoint: Agent completion acquisition captures metadata, resolves selection again with that snapshot, and passes modelIdSource='selected' into preparation. Returning an unnormalized fallback here therefore leaves preparation with the wrong model identity.
Findings None None.
Security None None.

How this fits together

Model selection converts configured names and provider metadata into the provider/model pair used by agent completions. Preparation then consumes that selected identity to obtain model metadata, credentials, and transport resources.

flowchart TD
  A[Configured default model] --> B[Alias and provider resolution]
  C[Captured provider metadata] --> B
  B --> D{Unresolved bare name}
  D -->|Metadata available| E[Existing model parser]
  D -->|Metadata absent| F[Preserved raw fallback]
  E --> G[Selected model preparation]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +212. Total +214 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 2 212 0 +212
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 215 1 +214

Review metrics

Metric Value Why it matters
Production versus regression coverage production +2 net lines; tests +212 lines The small production increase reuses the existing parser; coverage exercises normalization controls and completion acquisition.

Technical review

Best possible solution:

Keep normalization in the shared parser so captured defaults yield one selected identity without adding discovery, configuration, or a competing resolver.

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

Yes, from source: an unresolved bare primary with captured alias metadata returns raw on current main, and an invalid completion override can consume that fallback as already selected. No runtime reproduction was executed in this review.

Is this the best way to solve the issue?

Yes. Letting that branch reach the existing parser is a narrow repair that preserves cached metadata, normalization controls, and earlier resolved selections.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8e9e753e7b70.

Labels

Label changes:

  • add P2: This repairs a bounded model-default selection defect with concrete source evidence and no demonstrated widespread outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies this as a member-authored PR, so the ordinary contributor proof gate is exempt; no material authority change triggers an exception. Its body reports relevant compiled SDK loopback validation of fallback selection and request model, although raw traces were not supplied.

Label justifications:

  • P2: This repairs a bounded model-default selection defect with concrete source evidence and no demonstrated widespread outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies this as a member-authored PR, so the ordinary contributor proof gate is exempt; no material authority change triggers an exception. Its body reports relevant compiled SDK loopback validation of fallback selection and request model, although raw traces were not supplied.

Evidence

What I checked:

  • Current main still needs the correction: The fetched main revision retains the unconditional raw return; its production-file difference from the reviewed head is precisely the conditional guard around that return. (src/agents/model-selection-shared.ts:892, 8e9e753e7b70)
  • Existing owner and normalization controls: The changed branch reaches the existing parser with the cached metadata context and both normalization flags. Previously resolved aliases and inferred providers return earlier; the metadata-absent path remains unchanged. (src/agents/model-selection-shared.ts:892, 62675418c10d)
  • Completion entrypoint: Agent completion acquisition captures metadata, resolves selection again with that snapshot, and passes modelIdSource='selected' into preparation. Returning an unnormalized fallback here therefore leaves preparation with the wrong model identity. (src/agents/simple-completion-runtime.ts:98, 62675418c10d)
  • Regression coverage: The added cases cover snapshot and array inputs, one-pass aliases, absent and empty metadata, normalization flags, unsuccessful inference, configured API ownership, malformed inputs, and actual acquisition composition. These tests were inspected, not executed during this read-only review. (src/agents/model-selection-manifest-workspace.test.ts:414, 62675418c10d)
  • Released source comparison: The v2026.9.3 source also returns the raw model unconditionally at line 965. The local release-blob read failed, so the source was inspected through GitHub's contents endpoint. (src/agents/model-selection-shared.ts:965, 1391f7cd2d40)
  • Documented provider-owned normalization: The manifest contract defines cheap model-ID normalization before runtime loading, with alias values returned as written. The implementation uses OpenClaw's own parser and model-catalog package; no changed behavior or proof claim depends on the Codex implementation. Public docs: docs/plugins/manifest/models.md. (docs/plugins/manifest/models.md:178, 62675418c10d)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

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

@steipete
steipete merged commit cc74888 into main Sep 10, 2026
251 checks passed
@steipete
steipete deleted the codex/providerless-model-owner-main-20260910-v1 branch September 10, 2026 22:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 10, 2026
Capture provider metadata before selecting global TTS summary overrides and defaults, and share lightweight completion acquisition so selected aliases normalize once. Preserve the shipped injected callback and its caller-owned returned model.

Reject malformed slash references before exact default-provider lookup, keeping invalid summary overrides on the global default. Cover bare defaults without configured aliases or model rows on the landed captured-default owner repair.

Related: #130706
Prerequisite: #144429
steipete added a commit that referenced this pull request Sep 10, 2026
Capture provider metadata before selecting global TTS summary overrides and defaults, and share lightweight completion acquisition so selected aliases normalize once. Preserve the shipped injected callback and its caller-owned returned model.

Reject malformed slash references before exact default-provider lookup, keeping invalid summary overrides on the global default. Cover bare defaults without configured aliases or model rows on the landed captured-default owner repair.

Related: #130706
Prerequisite: #144429
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
Let unresolved bare defaults with captured plugin metadata reach the existing
model-reference parser. Preserve the cheap raw return when metadata is absent,
reuse the cached context, and keep already selected refs off a second pass.

This repairs invalid simple-completion overrides falling back to an unnormalized
model ID marked selected. Cover one-pass aliases, metadata scope, normalization
flags, auth-profile parsing, configured API ownership, and agent acquisition.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
Capture provider metadata before selecting global TTS summary overrides and defaults, and share lightweight completion acquisition so selected aliases normalize once. Preserve the shipped injected callback and its caller-owned returned model.

Reject malformed slash references before exact default-provider lookup, keeping invalid summary overrides on the global default. Cover bare defaults without configured aliases or model rows on the landed captured-default owner repair.

Related: openclaw#130706
Prerequisite: openclaw#144429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

1 participant