Repository navigation
refactor(providers): deslop model-provider plugins second pass - #160038
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
07f4258 to
9619d29
Compare
34ad765 to
5e0af12
Compare
5e0af12 to
29434d2
Compare
|
@clawsweeper re-review Both requested proof gaps are now addressed in the PR body's Evidence section at unchanged head Fresh DeepInfra registration-to-auth proof passed for prompt and flag input, returned profile/default/alias, sensitive prompting, and noninteractive flag admission, with zero network attempts. This is explicitly a source auth-boundary result, not a packaged-install or live API claim. Both published The raw legacy Bedrock field is rejected by the immutable old driver before staging, so that negative observation is retained explicitly. Successful update cells use admitted plugin-local settings; legacy-field migration is proven through recovery. The five additive SDK exports and the unchanged embedding/storage contracts remain documented. The lease is stopped. Please refresh the compatibility checklist against this evidence; no source changes were made for these proof updates. Compatibility review is complete for this exact head. The refreshed review accepted the behavior evidence and found no correctness or security defect; its remaining generic config-compatibility confirmation is now explicitly recorded under "Configuration and stored data" in the PR body. Existing migration mappings, precedence, config keys, schemas, storage formats, retention, recovery policy, and credential-storage contracts are preserved. The five additive SDK exports and matching-host requirement are the disclosed public surface change. |
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
…law#160038) * refactor(providers): deslop model-provider plugins second pass * chore(providers): align cleanup guards with shared owners
What Problem This Solves
Provider plugins still duplicated shared stream, catalog, normalization, and setup logic after the earlier provider cleanup passes.
User Impact
Provider behavior is preserved; five additive Plugin SDK export bindings are described below. Request bodies, stream event order, model IDs/catalogs, credentials, usage/cost, retries, error classification, manifests, and configuration keys stay unchanged. The Codex plugin is outside this change.
Why This Change Was Made
This second pass uses existing SDK and plugin owners:
Additive public Plugin SDK exports
This PR intentionally promotes the following supported provider-data helpers on existing SDK subpaths. These are five additive export bindings; the earlier statement that the API was unchanged was incorrect. No existing public export or package subpath is removed or renamed.
openclaw/plugin-sdk/model-ref-parsenormalizeGooglePreviewModelId,normalizeAntigravityPreviewModelId: apply the canonical catalog alias rules without loading replay or transport policy.openclaw/plugin-sdk/provider-stream-sharedtransformProviderStreamMessages: synchronous, in-place transformation of partial, terminal, andresult()messages; callbacks tolerate absent fields and repeated visits, while stream/event identity and iterator ordering remain intact.stripTrailingAssistantPrefillMessages: remove trailing assistant prefills in place, return the removed count, and retain OpenAItool_callsandtool_use/toolCallblocks. Thinking and route selection remain with the caller.openclaw/plugin-sdk/provider-transport-runtimebuildAssistantMessage: construct the assistant envelope from caller-supplied model, content, stop reason, and usage; use the supplied timestamp or the current time. It introduces no token accounting or pricing policy.These functions are intentionally supported SDK contracts, not new authority or persistence capabilities. Their owners already serve core plus bundled consumers; the cutover moves Google, Kimi, OpenRouter, Ollama, and Apple Foundation Models onto those owners. The existing provider hook/catalog docs describe the helpers. Independently published consumers must require a host release containing the exports through the existing
openclaw.compat.pluginApicontract; bundled plugins and their host ship together. Release tooling owns the paired version floors. This PR does not change manifests or add older-host fallbacks.Configuration and stored data
Compatibility review completed at
29434d2abd6c55ace666518a67a4d22ac34b973f: the Bedrock/Tencent edits preserve existing migration mappings and precedence; DeepInfra preserves its setup flag, environment selector, sensitive prompt, profile, and default; embedding edits preserve the normalization algorithm and stored shape. No configuration key, schema, retention, recovery policy, or credential-storage contract changes. The additive SDK bindings and their host-version requirement are intentionally documented above. The published update/recovery and registered-auth observations below complete the config/default compatibility check.Bedrock keeps its existing legacy-to-plugin discovery migration and destination-value precedence; only the nullable-record adapter and shallow-copy wrappers change. Tencent keeps the existing managed aliases and legacy-primary repair, with local predicates and forwarding types inlined. Neither registration nor migration policy changes. The published
2026.9.6driver rejects retired root-levelmodels.bedrockDiscoverybefore staging any candidate. The supported replay below uses authored plugin-local Bedrock settings and a saved Tencent preview primary; the untouched legacy backup is reserved for a separate candidate Doctor recovery test.The embedding-related data-model flags do not identify a stored-data change: LM Studio only derives an erased service type from its SDK owner. Ollama retains dimensional slicing and non-number rejection, then calls the identical finite-value, magnitude, and near-zero normalization algorithm in
packages/memory-host-sdk/src/host/embedding-vectors.ts. Its secret reader delegates to the existing identical owner. No schema, serialized vector shape, model/cache identity, dimensions, retention, or storage writer changes. The complete source diff contains 88 files; the review's truncated-file-list heuristic does not establish another migration.Measured production diff: 347 added, 1,020 deleted; 673 net lines removed. One existing import-closure case follows its removed wrapper to the canonical SDK owner; its assertions and count remain intact. This is below the 1,000-line target after a complete source sweep. The size-sorted coverage below records every production file over 200 lines. Distinct OAuth rules, catalog fallback policies, payloads, stream queues, and retry/timeout behavior remain where sharing would change a contract. The Google JSON wire-roundtrip helper and Mantle's cross-package SDK cast retain their existing contracts.
Evidence
Managed independent reviews are scoped-clean through P2 for the production refactor and follow-up. Current head is
29434d2abd6c55ace666518a67a4d22ac34b973f, based on main20021ebe9b7a96539c98b8dd3a578fb46534ee05.git range-diffconfirms both provider commits remain patch-identical. The three touched SDK owners and dependency lockfile are unchanged from the previous provider base; incorporated fixture and CI-owner repairs are described below. Exact-head CI 36458607178 passed, includingopenclaw/ci-gate. Published-updater recovery and fresh DeepInfra auth proof have now passed at that exact head. BELOW-THRESHOLD-PR-READY: 673 net production lines removed.Coverage was audited again: three baseline omissions (Novita, Z.AI, and Kie video implementations) were read and added, giving 205 production files over 200 lines across 61 provider directories. The already-landed video code uses existing SDK owners and retains distinct wire contracts; it was not rewritten. The two changed manifests were reread, and the final-base delta only added Kie artwork. The complete corrected log is embedded below.
Blacksmith Testbox
tbx_01m3khbkk3wff7b31bs9c7xwc2verified tested head07f4258ac295224ebeb86b47449bf43c2544e481, tree38bd681eb276934b98741820e8c78e870f75c299. The complete command exited 0; the lease is stopped. The provider proof is reused for the patch-identical rebase and reported at its actual tested revision. CI results below remain separate from that Testbox proof. Discarded duplicate fixture changes are absent from this PR.copilot-proxyhas no own test files and uses the documented--allow-no-testsoption.fs-safe-import-boundaryand import-boundary siblingscheck-changedpnpm build{}through the registered source method, prompt and flag paths, sensitive prompt, profile/default/alias, and noninteractive flag admission; zero network attempts. This is source auth-boundary proof, not packaged install, host credential persistence, or live API proof.2026.9.6driver → exact candidate payload; saved Bedrock preservation, Tencent migration, bundled plugin origins, byte-exact automatic snapshots, published backup restore, and candidate repair of restored legacy config.Changed-test cost:
pnpm test extensions/openai/model-construction.imports.test.ts --maxWorkers=1passed five cases in 14.62s wall, with approximately 0.64s of test execution. No tests were added, removed, or weakened. The assertion ratchet contains seven exact generated decreases, excluding unrelated increases.Published updater compatibility replay
Blacksmith Testbox
tbx_01m3ms60xtjf1b2gt34gf3cyd7(hydration run 36475188543) executed the two-cell replay at exact head29434d2abd6c55ace666518a67a4d22ac34b973f, treee8f38e215f5450e44cb317825fee2fb7273e1ac4. The wrapper and all child phases exited 0; the final remote command took 362.2s. The lease is stopped. Fresh DeepInfra prompt/flag auth proof also passed on this lease, through the registered source method, with zero network attempts.The source-pinned composed tarball explicitly includes Bedrock and Tencent and passed the canonical package integrity check. Its SHA-256 is
bf947d453f899249e46786a26813854cb8afcc60a68e2295bf1eea9bbecf5fab. The published driver was integrity-verified[email protected]fromhttps://registry.npmjs.org/openclaw/-/openclaw-2026.9.6.tgz, withsha512-Ie0kyQSCVfFqixsgVg39vevUDq01Ch5u3+7Yu5Y3qARczmdAe+lzp8bVnO9925rHiW/+CFp70zfORCyPmCH31g==. Candidate and driver version strings match, so proof compares the full immutable installed application payload and candidate build-info commit, not version strings alone.Both cases preserve custom provider URL/header/env-reference bytes, aliases, model parameters, guardrail settings, and unrelated model settings. The string-primary case and the object-primary/fallback case completed the published update in 89.2s and 73.2s. Before any standalone Doctor, saved values matched independent expectations and both plugin origins resolved to the candidate's bundled directories. The update preserved Bedrock's false/zero values and Tencent's explicit fallback. Updater-created
.pre-updateand.bakfiles matched the authored supported input byte-for-byte at mode0600.Each published
backup create --only-config --verifyarchive retained the separate untouched legacy specimen. The retained published runtime restored it into a fresh directory with exact original bytes; candidate Doctor then repaired the legacy Bedrock field and Tencent primary, preserving explicit Bedrock destination precedence, and candidate validation passed. Recovery left the updated installation's config untouched. Standalone Doctor preserved completemodels,plugins,agents, andgatewayobjects. Its only other top-level writes werewizardandskills: explicit Doctor repair disables unavailable skills and refreshes its timestamp, whereas update-time Doctor deliberately does not disable optional skills (src/commands/doctor-skills.ts). An initial full-file idempotence assertion was corrected to that actual owner contract; all byte-exact backup/recovery assertions remain.The first raw-legacy replay is retained as a limitation: the immutable published driver rejected retired
models.bedrockDiscoverywithinvalid-configbefore staging any candidate. Candidate bytes cannot change that earlier admission decision; the later candidate-owned admission architecture already landed separately in #155632. The successful update cells use authored, published-driver-valid plugin-local Bedrock settings; legacy-field migration is proven through recovery afterward. The baseline has saved settings but no external companion installation. This proves a composed distribution and root-config recovery, not external plugin registry convergence, automatic failed-update package rollback, SQLite recovery, live provider API behavior, or Gateway restart.Commands ran serially through the repository wrapper with
--provider blacksmith-testbox --id tbx_01m3ms60xtjf1b2gt34gf3cyd7 --timing-jsonandOPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1. The task-only harness executes these supported operations in isolated prefixes/state paths:An earlier 30-minute-idle lease expired during slow local source preparation before the next remote command started. The successful replacement used a two-hour idle window to cover the observed preparation delay. The external runner portal's final sync reported a timeout, but the actual wrapper receipt, command exit, source binding, all phases, and assertions succeeded; the portal warning is not presented as test evidence.
Fixes found along the way
The original CLI recovery-output flake mixed simulated polling ticks with real inspection time. A separate fixture repair passed 20 full-file repetitions and three original-shard repetitions, then was closed unmerged as duplicate #160235 when main landed #160319 (
ae3c05addca). The temporary private-helper import repair #160263 was also closed unmerged after main restored its export inda2efd83b8a. Both duplicate patches are absent here. Main's Node-selection fixture repair8b549de1e0cis included; its 19 cases and the 18 process-output cases passed during refreshed Testbox proof.The native update-custody fixture read SQLite before its child binding was committed. Separate #160545 is now merged as
4aac6a64210: the fixture waits for the existing EOF admission barrier and preserves every assertion. Its real-process lock control, 20 complete file runs (340 cases), three original-shard runs, and refreshed-head file/shard/changed checks passed. It landed under the explicit inherited-CI exception after the only failing source-contract gate was independently matched and its owner repair385ac2893544was confirmed on main.Main also contains the requester-clock repair #160407 (
88e3331026a), so duplicate #160411 was closed unmerged. The recovery-admission timer repair9fe93a204e3and heartbeat delivery-boundary repaird9569745764landed independently; our unpublished alternatives were discarded. Earlier provider CI 36432968621 failed the updater receipt, heartbeat fixture, and planner census; those first two owners are now repaired in this base. The planner's repeated source-scan timeout is tracked by existing #159279. The current PR CI passed; that result is not claimed as a repair of the earlier timing failure.Previous CI 36396360577 failed two extension jobs before tests loaded because the compiler rejected different
OPENCLAW_TEST_PROJECTS_PARALLELscheduling values. The identical error appeared in unrelated PR #137092 at matching head54d26d0d0e797222938275a2335205ac9673b2cc, job 108843032105. Its job failed; its aggregate run was later cancelled. The owning repair #160290 (7510c4bd528) is now included in this base.security-fastpassed in the earlier run; the cancelled build's missing-proof upload was cancellation aftermath, not a build failure. Fresh CI replaces that failed integration result rather than treating it as green.Testbox commands
Commands ran serially through
node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --id tbx_01m3khbkk3wff7b31bs9c7xwc2 --timing-json -- OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 ...after exact source-tree verification.This refactor makes no external API behavior change; no live API behavior claim is made.
Complete production coverage: 205 files over 200 lines
Provider second-pass coverage
Coverage refreshed against main
4902e4ae49a669702b92a1df3aeb01b167ec6715and rechecked against final base20021ebe9b7a96539c98b8dd3a578fb46534ee05(only Kie artwork was added in the latter interval): 205 production files over 200 lines across 61 provider directories. Three baseline omissions (Novita, Z.AI, and Kie video implementations) were read and added; the two changed manifests were reread. All were already on the earlier base. Newly read code already uses SDK owners; vendor-specific wire and lifecycle contracts remain. Supplemental reads include Kie’s exactly-200-line model descriptors and X.AI’s compiler-only tsconfig (947 lines), excluded from this production count. Original sizes remain the lane-baseline measurements; refreshed rows use this pinned snapshot.Every production source file over 200 lines was read, largest first within each independent provider group. Sizes are from the lane baseline; manifests and the Apple Foundation Models Swift source are included. Test files and test fixtures are excluded. Smaller production modules, public barrels, dynamic entrypoints and manifests were also read. Codex was excluded.
extensions/amazon-bedrock/stream.runtime.tsextensions/google/realtime-voice-provider.tsextensions/ollama/src/stream.runtime.tsextensions/openai/openai-provider.tsextensions/google/transport-stream.tsextensions/ollama/index.tsextensions/lmstudio/src/setup.tsextensions/google/openclaw.plugin.jsonextensions/comfy/workflow-runtime.tsextensions/fal/image-generation-provider.tsextensions/openai/image-generation-provider.tsextensions/openai/realtime-quicksilver-bridge.tsextensions/openai/realtime-quicksilver-session.tsextensions/openai/provider-policy-api.tsextensions/microsoft-foundry/shared.tsextensions/github-copilot/index.tsextensions/xai/xai-oauth.tsextensions/openai/realtime-voice-bridge.tsextensions/google/cli-backend-auth.runtime.tsextensions/openai/realtime-quicksilver-gateway-bridge.tshandleSidebandFrame; both buffered and live frame consumers now call the delegation owner directly. Preserved separate relay admission, peer adoption, and retirement paths.extensions/ollama/src/setup.runtime.tsextensions/anthropic/register.runtime.tsextensions/fal/video-generation-provider.tsextensions/amazon-bedrock/discovery.tsextensions/amazon-bedrock/register.sync.runtime.tsextensions/microsoft-foundry/onboard.tsextensions/openai/realtime-voice-provider-factory.tsRealtimeVoiceProviderConfiguredContext; retained distinct browser/GA/GPT-Live payload construction because their fields and defaults differ.extensions/openai/realtime-quicksilver-wire.tsextensions/llama-cpp/src/managed-server.tsextensions/openai/realtime-quicksilver-delegation-controller.tsextensions/google/video-generation-provider.tsextensions/openai/realtime-voice-session-policy.tsextensions/ollama/src/provider-models.tsextensions/openai/realtime-transcription-provider-factory.tsextensions/openai/openai-chatgpt-provider.tsextensions/opencode/session-catalog.tsextensions/lmstudio/src/models.tsextensions/xai/realtime-voice-bridge.tsextensions/qwen/openclaw.plugin.jsonextensions/google/speech-provider.tsextensions/openai/realtime-quicksilver-media.runtime.tsextensions/anthropic/session-catalog-discovery.tsextensions/llama-cpp/src/external-server/setup.tsextensions/ollama/src/node-inference.tsextensions/amazon-bedrock-mantle/discovery.tsextensions/google/embedding-provider.tsextensions/anthropic/session-catalog-listing.tsextensions/openrouter/video-generation-provider.tsextensions/xai/realtime-voice-events.tsextensions/amazon-bedrock/embedding-provider.tsextensions/moonshot/src/kimi-web-search-provider.runtime.tsextensions/anthropic/openclaw.plugin.jsonextensions/openai/token-sharing-oauth.runtime.tsextensions/ollama/src/embedding-provider.runtime.tsextensions/google/src/gemini-web-search-provider.runtime.tsextensions/google/embedding-batch.tsextensions/anthropic/cli-shared.tsextensions/llama-cpp/src/setup.tsextensions/openai/realtime-voice-protocol.tsextensions/anthropic/cli.runtime.tsextensions/opencode/session-upstream-activity.tsextensions/minimax/video-generation-provider.tsextensions/xai/tts.tsextensions/ollama/openclaw.plugin.jsonextensions/openai/openai-chatgpt-device-code.tsextensions/kimi-coding/stream.tsextensions/perplexity/src/perplexity-web-search-provider.runtime.tsextensions/xai/src/web-search-provider.runtime.tsextensions/openai/realtime-voice-events.tsextensions/anthropic/session-catalog-scan.tsextensions/deepinfra/provider-models.tsextensions/clawrouter/provider-catalog.tsextensions/vydra/shared.tsextensions/llama-cpp/src/llama-server-install.tsextensions/openai/openclaw.plugin.jsonextensions/xai/openclaw.plugin.jsonextensions/qwen/stream.tsextensions/xai/video-generation-provider.tsextensions/openrouter/music-generation-provider.tsextensions/openrouter/oauth.tsextensions/lmstudio/src/embedding-provider.tsextensions/openrouter/index.tsextensions/novita/video-generation-provider.tsextensions/minimax/music-generation-provider.tsextensions/apple-fm/assets/AppleFoundationModels.swiftextensions/github-copilot/login.tsextensions/google/vertex-adc.tsextensions/minimax/oauth.tsextensions/volcengine/openclaw.plugin.jsonextensions/minimax/provider-registration.tsextensions/microsoft-foundry/image-generation-provider.tsextensions/ollama/src/web-search-provider.runtime.tsextensions/lmstudio/src/models.fetch.tsextensions/github-copilot/models.tsextensions/opencode/session-catalog-plugin.tsextensions/openrouter/video-model-catalog.tsextensions/mistral/realtime-transcription-provider-factory.tsextensions/zai/index.tsextensions/github-copilot/embeddings.tsextensions/openrouter/image-generation-provider.tsextensions/venice/openclaw.plugin.jsonextensions/google/cli-backend-isolated-auth.runtime.tsextensions/comfy/openclaw.plugin.jsonextensions/chutes/oauth.tsextensions/xai/realtime-voice-protocol.tsextensions/anthropic/claude-desktop-groups.tsextensions/xiaomi/index.tsextensions/lmstudio/src/stream.tsextensions/anthropic/stream-wrappers.tsextensions/radius/stream.tsextensions/ollama/src/discovery-shared.tsextensions/deepinfra/video-generation-provider.tsextensions/xai/index.tsextensions/xiaomi/speech-provider.tsextensions/minimax/speech-provider-factory.tsextensions/xai/capability-provider-metadata-factory.tsextensions/openai/openai-chatgpt-oauth-flow.runtime.tsextensions/deepinfra/openclaw.plugin.jsonextensions/anthropic/config-defaults.tsextensions/github-copilot/openclaw.plugin.jsonextensions/anthropic/session-catalog.tsextensions/anthropic/usage.tsextensions/byteplus/video-generation-provider.tsextensions/openai/realtime-quicksilver-socket.runtime.tsextensions/openai/realtime-quicksilver-socket.tsextensions/anthropic/cli-backend.tsextensions/openai/openai-chatgpt-oauth-token.runtime.tsextensions/openai/speech-provider.tsextensions/anthropic/auth.runtime.tsextensions/openai/realtime-quicksilver-peer.runtime.tsextensions/nvidia/openclaw.plugin.jsonextensions/llama-cpp/src/model-catalog.tsextensions/openrouter/stream.tsextensions/qwen/index.tsextensions/google/provider-models.tsextensions/volcengine/tts.tsextensions/together/video-generation-provider.tsextensions/kie/video-generation-provider.tsextensions/nvidia/provider-catalog.tsextensions/minimax/src/minimax-web-search-provider.runtime.tsextensions/openrouter/provider-catalog.tsextensions/anthropic/cli-transport.tsextensions/zai/detect.tsextensions/opencode/stream.tsextensions/openrouter/usage.tsextensions/xai/realtime-voice-lazy.tsextensions/xai/stream.tsextensions/anthropic/session-catalog-parsing.tsextensions/baseten/openclaw.plugin.jsonextensions/clawrouter/index.tsextensions/openai/usage.tsextensions/zai/openclaw.plugin.json09bea762930restores categories to["models"]; model IDs, costs, auth choices, endpoints, and config keys are unchanged by that correction.extensions/meta/openclaw.plugin.jsonextensions/xai/src/responses-tool-shared.tsextensions/anthropic/session-catalog-desktop.tsextensions/opencode-go/stream-termination.tsextensions/lmstudio/src/runtime.tsextensions/zai/video-generation-provider.tsextensions/microsoft-foundry/auth.tsextensions/openai/embedding-batch.tsextensions/ollama/src/stream-compat.tsextensions/moonshot/openclaw.plugin.jsonextensions/xai/lazy-capability-provider-factories.tsextensions/openai/openai-chatgpt-oauth.runtime.tsextensions/xai/usage.tsextensions/opencode/openclaw.plugin.jsonextensions/xiaomi/openclaw.plugin.jsonextensions/xai/doctor-contract-api.tsextensions/ollama/src/setup-model-selection.tsextensions/radius/oauth.tsextensions/stepfun/openclaw.plugin.jsonextensions/anthropic/claude-model-refs.tsextensions/openai/realtime-quicksilver-sideband.tsextensions/llama-cpp/src/hardware.tsextensions/anthropic-vertex/stream-runtime.tsextensions/google/image-generation-provider.tsextensions/microsoft-foundry/provider.tsextensions/minimax/image-generation-provider.tsextensions/xai/speech-provider-metadata-factory.tsextensions/anthropic/session-upstream-activity.tsextensions/anthropic/cli-output.tsextensions/xai/realtime-transcription-provider-factory.tsextensions/amazon-bedrock-mantle/mantle-anthropic.runtime.tsextensions/apple-fm/native.tsextensions/vercel-ai-gateway/models.tsextensions/novita/openclaw.plugin.json09bea762930restores the single["models"]category; catalogs, pricing, aliases, and auth fields remain intact.extensions/xai/realtime-voice-config.tsextensions/anthropic-vertex/provider-catalog.tsextensions/gmi/openclaw.plugin.jsonextensions/kilocode/provider-models.tsextensions/openai/image-generation-codex-response.tsextensions/volcengine/speech-provider.tsextensions/llama-cpp/src/llama-server-assets.tsextensions/opencode-go/openclaw.plugin.jsonextensions/google/realtime-voice-lazy.tsextensions/openai/realtime-quicksilver-protocol.tsextensions/venice/stream.tsextensions/xai/model-definitions.tsextensions/tencent/openclaw.plugin.jsonextensions/chutes/index.tsextensions/cloudflare-ai-gateway/index.tsextensions/baseten/models.tsextensions/google/music-generation-provider.tsextensions/ollama/src/setup-pull.tsextensions/xai/x-search.ts