fix(agents): skip implicit provider discovery when models.mode is replace [AI-assisted]#73557
Conversation
Greptile SummaryThis PR fixes a bug where Confidence Score: 5/5This PR is safe to merge — the fix is minimal, targeted, and fully covered by new tests. Single-line guard added at the right callsite, default 'merge' behavior is unchanged, mergeProviders correctly handles an empty implicit map, and five tests cover replace/merge/default mode scenarios end-to-end. No files require special attention. Reviews (1): Last reviewed commit: "fix(agents): skip implicit provider disc..." | Re-trigger Greptile |
b9393f8 to
b1fb0cd
Compare
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. A high-confidence source-level path exists on current main: call Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land the narrow replace-mode discovery guard after adding the required changelog entry and contributor-supplied real startup/log proof; keep the separate pricing-fetch delay tracked in #74020. Do we have a high-confidence way to reproduce the issue? Yes. A high-confidence source-level path exists on current main: call Is this the best way to solve the issue? Yes in direction, but not ready to merge as submitted. The current PR head uses the narrow maintainable callsite guard and preserves merge/default behavior, but still needs a changelog entry and real behavior proof. Full review comments:
Overall correctness: patch is correct Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 70d92b5e59df. |
b1fb0cd to
41bc76c
Compare
41bc76c to
794faa9
Compare
…lace resolveProvidersForModelsJsonWithDeps unconditionally called resolveImplicitProviders regardless of mode. Per docs, replace mode should use only explicit providers. Guard the call with a mode check so replace mode skips the expensive implicit provider discovery. Closes openclaw#66957 AI-assisted (built with Claude Code via Hermes orchestration).
794faa9 to
da95a42
Compare
|
Closing: stale (2+ weeks), no maintainer review. Will re-submit if the fix is still needed. |
Summary
models.mode="replace"is documented to use only explicitly configured providers, butresolveProvidersForModelsJsonWithDepsunconditionally callsresolveImplicitProviders(), causing unnecessary provider discovery and 72+ second startup delays.models.mode="replace"to avoid implicit provider discovery still get the full discovery cost, defeating the purpose of the config.resolveImplicitProviderscall with amode !== "replace"check so replace mode skips implicit discovery entirely and uses only explicit providers.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause
resolveProvidersForModelsJsonWithDepscalledresolveImplicitProvidersunconditionally at line 58, before any mode-specific handling. The mode check only happened later inresolveProvidersForMode()which only affects merge behavior, not whether implicit discovery runs.replacemode skipping implicit provider discovery.resolveProvidersForModewas only designed for merge-vs-replace provider merging, not for gating discovery itself.Regression Test Plan
src/agents/models-config.replace-mode-skip-implicit-discovery.test.tsmodels.mode="replace",resolveImplicitProvidersis never called and only explicit providers are returned.resolveImplicitProvidersand verifies it is/isn't called based on the mode setting.User-visible / Behavior Changes
models.mode="replace"will see significantly faster startup (no implicit provider discovery delay).Diagram (if applicable)
N/A
Security Impact (required)