Repository navigation
refactor(agents): split embedded model resolution - #113785
Merged
Merged
Conversation
steipete
force-pushed
the
codex/h7-eamodel
branch
from
July 25, 2026 18:04
d6cd5fa to
202097a
Compare
Contributor
Author
|
Land-ready verification complete for head
Known proof gap: no live provider call was run because this is a deterministic, behavior-neutral module split; focused resolver tests, full build, dead-code checks, changed gates, and hosted CI cover the changed contract. |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 26, 2026
* refactor(agents): split embedded model resolution * refactor(agents): keep model helpers private
This was referenced Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
src/agents/embedded-agent-runner/model.tshad grown to 2,091 lines and mixed provider-hook normalization, configured metadata overlays, fallback synthesis, registry/dynamic selection, and public discovery orchestration. That made the model-resolution owner difficult to audit and kept the file on the max-lines grandfather list.Why This Change Was Made
This maintainer-commissioned, AI-assisted refactor keeps
model.tsas the public facade and moves the existing mechanics into four concern-owned modules, all below the repository's max-lines budget. Provider/model normalization remains with the canonical owners established by #112772, and the intentionally divergent auth-preparation and runner behavior documented in #113240 is unchanged.User Impact
No user-visible behavior changes. Embedded model selection keeps the same configured, registry, dynamic-runtime, static-catalog, suppression, auth-profile, transport, and unknown-model behavior through smaller auditable modules.
Beyond the split
requestTimeoutMsspread from a branch that is entered only whenrequestTimeoutMs === undefined.Audit findings
Bugs found
model.configured-fallback.ts:153can combine a configured lowercontextWindowwith a larger static-catalogmaxTokens, unlike the discovered-model overlay path which clamps the output cap. A dedicated behavior PR should centralize that normalization and add a configured-fallback regression test.Placement findings
Baseline
src/agents/embedded-agent-runner/model.tsfromconfig/max-lines-baseline.txt; the resulting files are 217–602 lines.Evidence
+1588/-1592(net-4); tests+0/-0; max-lines baseline+0/-1; total+1588/-1593(net-5).node scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.test.ts src/agents/embedded-agent-runner/model.forward-compat.test.ts src/agents/embedded-agent-runner/model.forward-compat.errors-and-overrides.test.ts src/agents/embedded-agent-runner/model.startup-retry.test.ts src/agents/embedded-agent-runner/model.skip-agent-discovery-hooks.test.ts— 5 files / 185 tests passed.node scripts/check-changed.mjs -- config/max-lines-baseline.txt src/agents/embedded-agent-runner/model.ts src/agents/embedded-agent-runner/model.configured-fallback.ts src/agents/embedded-agent-runner/model.configured-overrides.ts src/agents/embedded-agent-runner/model.provider-hooks.ts src/agents/embedded-agent-runner/model.registry-resolution.ts— passed formatting, max-lines ratchet, production/test typechecks, core lint, boundary guards, and runtime import-cycle checks on Blacksmith Testboxtbx_01kyd4jw73arb8yp9h6tvzebtq(run).node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json -- env CI=1 OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 corepack pnpm build— passed on Blacksmith Testboxtbx_01kyd5t4wjqwv956s6y3rh36kv, with no ineffective dynamic-import warning (run).node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json --shell -- "pnpm deadcode:dependencies && pnpm deadcode:unused-files && pnpm deadcode:exports"— all Knip production/full-tree dependency, unused-file, and unused-export scans passed on Testboxtbx_01kyd6bnsxa7rgsw9n1tvmc98y(run)..agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output— clean; no accepted/actionable findings, overall correctness 0.97.git diff --check— passed.