Skip to content

[Bug]: models.mode="replace" still triggers implicit provider discovery and causes large startup delays #66957

Description

@wangzhengshu

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

With models.mode="replace" and only one explicit provider configured, OpenClaw still invokes implicit provider discovery before mode-specific handling, contrary to the documented semantics, and minimal legacy embedded-agent startup is delayed by roughly 72 seconds on 2026.4.14.

Steps to reproduce

  1. Check out OpenClaw 2026.4.14 (a14f7c5c6d) or current main.
  2. Configure models.mode="replace" with a minimal explicit provider set.
  3. Compare the documented semantics in src/config/schema.help.ts:739-740 with the implementation in src/agents/models-config.plan.ts:47-58.
  4. Observe that resolveProvidersForModelsJsonWithDeps(...) still calls resolveImplicitProviders(...) before any mode-specific handling.
  5. Start a minimal legacy embedded-agent run with that config and observe that meaningful lifecycle start is heavily delayed.

Expected behavior

When models.mode="replace" is configured, OpenClaw should use only explicitly configured providers, should not run implicit provider discovery, and should start legacy embedded-agent execution promptly under a minimal explicit-provider setup.

Actual behavior

OpenClaw still appears to invoke implicit provider discovery in replace mode. In observed runs on 2026.4.14, meaningful lifecycle start was delayed by about 72 seconds before the embedded agent run proceeded.

OpenClaw version

2026.4.14 (a14f7c5)

Operating system

Ubuntu 24.04

Install method

source checkout / pnpm tsx

Model

mock-openai/gpt-5.2 (deterministic local test mock)

Provider / routing chain

OpenClaw -> single explicit OpenAI-responses-compatible mock provider

Additional provider/model setup details

The tested setup uses models.mode="replace" with a single explicit OpenAI-responses-compatible provider to keep provider behavior deterministic. This report concerns provider-planning semantics rather than any specific upstream model capability.

Logs, screenshots, and evidence

[debug +0ms] mode=no-abort timeoutMs=20000 rootDir=/home/wzs_ubuntu/projects/agent-policy-fuzz/.tmp/openclaw-core-debug-allowed-timeout/run-2026-04-15T02-15-03-459Z-seed-1337
[event +72868ms] lifecycle {"phase":"start","startedAt":1776219376327}
10:16:36 [agent/embedded] embedded run timeout: runId=debug-allowed-timeout-no-abort sessionId=abc6e832-e415-4a4a-b292-485b27ff0d71 timeoutMs=20000
10:16:36 [agent/embedded] embedded run failover decision: runId=debug-allowed-timeout-no-abort stage=assistant decision=surface_error reason=timeout from=mock-openai/gpt-5.2 profile=-
[event +92877ms] lifecycle {"phase":"end","startedAt":1776219353263,"endedAt":1776219396336,"aborted":true}
[runtime +92903ms] Request timed out before a response was generated. Please try again, or increase `agents.defaults.timeoutSeconds` in your config.

Impact and severity

Affected: users or operators relying on models.mode="replace" with minimal explicit provider configurations
Severity: Medium for correctness/reliability; not a confirmed security issue
Frequency: reproduced on 2026.3.22 and again on 2026.4.14
Consequence: documented config semantics are violated, startup becomes severely delayed, and legacy embedded-agent execution becomes much less reliable under minimal explicit-provider setups

Additional information

I first observed this on OpenClaw 2026.3.22 and rechecked it on 2026.4.14 (a14f7c5c6d), where it still appears present. A local workaround is to short-circuit implicit discovery when cfg.models.mode === "replace" and return only explicit providers in that branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions