Skip to content

fix: preserve provider defaults during config saves - #85903

Merged
steipete merged 1 commit into
mainfrom
fix-control-ui-provider-default-config-save
May 24, 2026
Merged

steipete merged 1 commit into
mainfrom
fix-control-ui-provider-default-config-save

Conversation

@steipete

@steipete steipete commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Harden gateway config.set/config.apply so runtime-shaped bundled provider defaults from a full config payload do not get persisted or rejected as authored values.
  • Strip default-only empty bundled provider fields before source validation/write, while keeping the validated runtime config for restart/secret checks.
  • Add a gateway regression for an OpenAI provider with only agentRuntime configured.

Verification

Behavior addressed: Gateway full-config writes now tolerate runtime-shaped bundled provider defaults, complementing the Control UI source-snapshot fix already merged in #85879.
Real environment tested: Local OpenClaw checkout plus Blacksmith Testbox changed gate.
Exact steps or command run after this patch: Wrote a source config with models.providers.openai.agentRuntime.id, loaded it through config.get, submitted the runtime-shaped config through config.set with baseUrl empty, and verified the save succeeds.
Evidence after fix: Added regression in src/gateway/server.config-patch.test.ts; focused test passed 23/23 and check:changed passed on Testbox.
Observed result after fix: config.set returns ok and persisted config contains the unrelated gateway port edit without persisting default-only baseUrl.
What was not tested: Live browser Control UI manual save; #85879 covers the UI submit path and this patch covers the gateway RPC path directly.

Refs #85831.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels May 24, 2026
@clawsweeper

clawsweeper Bot commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-24 03:06 UTC / May 23, 2026, 11:06 PM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

PR Surface
Source +90, Tests +63, Docs +1. Total +154 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 95 5 +90
Tests 1 63 0 +63
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 159 5 +154

Summary
The PR adds gateway config.set/apply handling that strips default-only empty bundled provider baseUrl/models before persistence, adds an RPC regression test, and adds a changelog entry.

Reproducibility: yes. for the gateway-level case from source: current main validates config.set payloads against baseUrl minLength while runtime snapshots can contain baseUrl: "". The original Control UI user path is already covered by current-main UI sourceConfig submission.

PR rating
Overall: 🦐 gold shrimp
Proof: 🐚 platinum hermit ✨ media proof bonus
Patch quality: 🦐 gold shrimp
Summary: Useful focused patch with adequate RPC/Testbox proof, but solution overlap with current main and config-write merge risk need maintainer direction.

Rank-up moves:

  • Decide whether gateway-side runtime-shaped config acceptance should be supported beyond the current UI fix.
  • Rebase on current main and reconcile the duplicate changelog entry before merge.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Sufficient (linked_artifact): The PR body documents an after-fix gateway RPC scenario with observed config.set success and links Testbox/GitHub Actions changed-gate proof; live browser save was explicitly not tested.

Risk before merge

  • Current main already fixes the linked Control UI path and has a changelog entry, so merging this PR adds a second gateway-side compatibility path that maintainers should explicitly want.
  • The PR changes full config.set/config.apply persistence around provider defaults, which is config/provider compatibility-sensitive even though the focused diff looks reasonable.
  • The PR is reported mergeable=false against current main, and its changelog entry overlaps the existing current-main entry for the linked bug.

Maintainer options:

  1. Rebase and land server hardening
    If maintainers want config.set/config.apply to accept runtime-shaped provider defaults from non-UI clients, rebase this PR on current main and reconcile the duplicate changelog entry before merge.
  2. Keep the UI-only fix
    If the supported path is only the Control UI form editor, current main already submits sourceConfig and this PR can close as superseded.
  3. Accept the compatibility expansion
    Maintainers can intentionally accept the broader gateway behavior, but should own the config-write compatibility surface and provider-default semantics as part of that decision.

Next step before merge
Manual review is appropriate because the protected maintainer label and current-main overlap require deciding whether to carry gateway-side compatibility in addition to the existing UI fix.

Security
Cleared: No concrete security or supply-chain issue found; the diff touches config validation/persistence only and adds no dependencies, workflows, downloads, or secret sources.

Review details

Best possible solution:

Maintain one canonical fix: rebase and land the gateway-side hardening only if server API compatibility for runtime-shaped config payloads is desired; otherwise close it as superseded by the current UI sourceConfig fix.

Do we have a high-confidence way to reproduce the issue?

Yes for the gateway-level case from source: current main validates config.set payloads against baseUrl minLength while runtime snapshots can contain baseUrl: "". The original Control UI user path is already covered by current-main UI sourceConfig submission.

Is this the best way to solve the issue?

Unclear: the PR is a narrow gateway hardening and its test matches the RPC path, but current main already solves the reported Control UI save failure. Maintainers should decide whether the server should also accept runtime-shaped default-only fields.

Label changes:

  • add P2: This is a focused config-save/provider-default bug fix with limited gateway and Control UI blast radius.
  • add merge-risk: 🚨 compatibility: The PR changes full config.set/config.apply write shaping and must be reconciled with the existing current-main UI fix before merge.
  • add merge-risk: 🚨 auth-provider: The changed behavior is specifically about bundled model provider baseUrl/models defaults, which affect provider routing and auth/provider configuration semantics.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body documents an after-fix gateway RPC scenario with observed config.set success and links Testbox/GitHub Actions changed-gate proof; live browser save was explicitly not tested.
  • add rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🐚 platinum hermit, patch quality is 🦐 gold shrimp, and Useful focused patch with adequate RPC/Testbox proof, but solution overlap with current main and config-write merge risk need maintainer direction.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body documents an after-fix gateway RPC scenario with observed config.set success and links Testbox/GitHub Actions changed-gate proof; live browser save was explicitly not tested.

Label justifications:

  • P2: This is a focused config-save/provider-default bug fix with limited gateway and Control UI blast radius.
  • merge-risk: 🚨 compatibility: The PR changes full config.set/config.apply write shaping and must be reconciled with the existing current-main UI fix before merge.
  • merge-risk: 🚨 auth-provider: The changed behavior is specifically about bundled model provider baseUrl/models defaults, which affect provider routing and auth/provider configuration semantics.
  • rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🐚 platinum hermit, patch quality is 🦐 gold shrimp, and Useful focused patch with adequate RPC/Testbox proof, but solution overlap with current main and config-write merge risk need maintainer direction.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body documents an after-fix gateway RPC scenario with observed config.set success and links Testbox/GitHub Actions changed-gate proof; live browser save was explicitly not tested.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body documents an after-fix gateway RPC scenario with observed config.set success and links Testbox/GitHub Actions changed-gate proof; live browser save was explicitly not tested.

What I checked:

  • Current main Control UI fix: Current main builds the editable form from snapshot.sourceConfig before resolved/runtime config, so form-mode saves no longer start from runtime-materialized provider defaults. (ui/src/ui/controllers/config.ts:97, 841cb121fb70)
  • Current main regression coverage: Current main has a UI controller regression asserting form saves submit source config and omit runtime-only openai.baseUrl while preserving an unrelated edit. (ui/src/ui/controllers/config.test.ts:842, 841cb121fb70)
  • PR gateway implementation: The PR adds stripBundledProviderRuntimeDefaults and uses a source-shaped writeConfig so default-only empty built-in provider fields are not persisted while runtime validation still runs. (src/gateway/server-methods/config.ts:203, ec2dccb75523)
  • PR regression coverage: The PR adds a gateway RPC test that writes an openai provider with only agentRuntime, submits runtime-shaped baseUrl/models defaults through config.set, and verifies the persisted file omits baseUrl. (src/gateway/server.config-patch.test.ts:203, ec2dccb75523)
  • Validation contract: Current schema rejects source model provider baseUrl values shorter than one character, while raw validation materializes bundled provider overlays with default baseUrl/models, explaining why runtime-shaped payloads are compatibility-sensitive. (src/config/zod-schema.core.ts:453, 841cb121fb70)
  • History provenance: Blame ties the current main sourceConfig UI behavior and regression to 12f8227; the PR branch is a later gateway-side variant rather than the only fix for the user-visible Control UI path. (ui/src/ui/controllers/config.ts:97, 12f82270cf07)

Likely related people:

  • steipete: Blame ties the current main Control UI sourceConfig fix and gateway config method snapshot in this checkout to Peter Steinberger, and this PR also carries the gateway-side follow-up commit. (role: recent area contributor; confidence: high; commits: 12f82270cf07, ec2dccb75523; files: ui/src/ui/controllers/config.ts, ui/src/ui/controllers/config.test.ts, src/gateway/server-methods/config.ts)
  • Efe Baran Durmaz: Recent history on src/config/io.write-prepare.ts added preservation behavior in the same config write-shaping layer that this PR reuses. (role: adjacent config write helper contributor; confidence: medium; commits: a2eb8fa48f41; files: src/config/io.write-prepare.ts, src/config/io.write-prepare.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 841cb121fb70.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec2dccb755

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

: restored.result;
const validationCandidate = stripBundledProviderRuntimeDefaults({
candidate: projectedValidationCandidate,
sourceConfig: snapshot.parsed,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check authored provider keys against resolved source config

The default-stripping step is using snapshot.parsed as the authored-source reference, but parsed is the root file before $include expansion. For configs that define models.providers in an included file, this makes stripBundledProviderRuntimeDefaults treat included provider fields as "not authored" and remove built-in models: [] entries during config.set/config.apply. That can create unintended diffs under include-owned paths and cause unrelated saves to fail with include-flattening write guards; the source-of-truth for authored-key presence here should be the resolved source snapshot instead.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels May 24, 2026
@clawsweeper

clawsweeper Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Gilded Test Hopper

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: collects tiny proofs.
Image traits: location proof lagoon; accessory commit compass; palette cobalt, lime, and pearl; mood celebratory; pose curling around a status light; shell matte ceramic shell; lighting tiny status-light glow; background miniature CI buoys.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Gilded Test Hopper in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@steipete
steipete force-pushed the fix-control-ui-provider-default-config-save branch from ec2dccb to 29f5a89 Compare May 24, 2026 03:16
@steipete
steipete merged commit 6e994ad into main May 24, 2026
104 of 105 checks passed
@steipete
steipete deleted the fix-control-ui-provider-default-config-save branch May 24, 2026 03:22
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant