Skip to content

fix: preserve runtime provider transport overrides for built-in providers#330

Merged
jalehman merged 4 commits into
Martian-Engineering:mainfrom
little-jax:fix/runtime-auth-transport-preservation
Apr 9, 2026
Merged

fix: preserve runtime provider transport overrides for built-in providers#330
jalehman merged 4 commits into
Martian-Engineering:mainfrom
little-jax:fix/runtime-auth-transport-preservation

Conversation

@little-jax

Copy link
Copy Markdown
Contributor

Summary

  • let models.providers.<id> transport fields override built-in pi-ai model defaults for matching provider ids
  • preserve custom baseUrl, api, and merged headers even when the provider id is a built-in one like openai
  • add a regression test covering an openai provider overridden to a custom proxy URL

Why

Lossless-claw was already resolving provider-level config for custom providers, but the known-model path only filled baseUrl and headers when the built-in model lacked them. That breaks OpenClaw configs which intentionally override a built-in provider id (for example openai) to point at a proxy/base URL, because the built-in pi-ai catalog model keeps https://api.openai.com/v1 and wins.

In practice that makes summarization drift back to the official OpenAI endpoint even when OpenClaw runtime config has a different models.providers.openai.baseUrl.

Testing

  • npm test -- --run test/index-complete-provider-config.test.ts test/index-complete-model-auth.test.ts

mozi1924 and others added 3 commits April 9, 2026 11:59
Remove the duplicate auth-handling tests left behind by the rebase conflict resolution so the summarize test file reflects one coherent post-review coverage set.

Regeneration-Prompt: |\n  Rebased PR 330 onto origin/main, then addressed review findings without changing the intended provider override feature. Preserve the fix that lets runtime provider config override built-in transport defaults, but keep custom OpenAI-compatible provider aliases eligible for the existing direct-credential retry when runtime.modelAuth returns a model.request scope failure. Also avoid tagging arbitrary provider/runtime exceptions as provider_config errors; only the explicit unresolved API-family case should surface that kind. After resolving the rebase conflict in test/summarize.test.ts, remove any duplicate tests introduced by conflict resolution and keep focused regression coverage for runtime-managed providers, custom-provider auth retries, and non-config provider failures. Include a patch changeset for the user-visible bug fix.
@jalehman jalehman force-pushed the fix/runtime-auth-transport-preservation branch from a60279e to 3a41a78 Compare April 9, 2026 20:29
Keep the SecretRef auth-profile tests focused on credential resolution by feeding the test harness the same runtime config object through api.runtime.config.loadConfig(), and by defaulting the synthetic provider to an explicit API family. This matches the new custom-provider guard added in the PR without weakening the guard itself.

Regeneration-Prompt: |\n  PR 330 now requires custom providers to have an explicit API family instead of silently defaulting to OpenAI. The SecretRef auth-profile tests use a synthetic provider and were failing before completeSimple because their harness only set api.config and never surfaced models.providers.<provider>.api through runtime.config.loadConfig(). Update that test harness so it passes the same config object through runtime loadConfig and injects a test-only default API family for the synthetic provider, keeping the tests focused on env/file SecretRef credential resolution rather than provider API resolution.
@jalehman jalehman merged commit acf1e02 into Martian-Engineering:main Apr 9, 2026
1 check passed
@jalehman

jalehman commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants