Skip to content

fix: preserve primary inheritance when editing agent fallbacks - #141967

Merged
shakkernerd merged 1 commit into
mainfrom
fix/fallback-inheritance
Sep 8, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
fix/fallback-inheritance

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Related: #137410

What Problem This Solves

Fixes an issue where users editing an agent’s fallback models in Settings → Agents → Overview would also pin its inherited primary. Removing the last fallback could restore shared fallbacks when no primary was explicitly configured.

Why This Change Was Made

Fallback edits now preserve the agent’s existing primary choice and save an explicit array, including an empty chain. The change uses the existing fallback-only model shape and leaves shared defaults and other agents intact.

User Impact

Agents keep following changes to their shared primary after fallback edits. Clearing every fallback disables the chain, including for agents that use an implicit primary.

Evidence

  • All 11 focused writer tests pass. The original owner fails the inherited-primary and explicit-empty regression cases.
  • Built Control UI at 609ca7ae74533c537145af01af37e10648d60e72 with the maintained stateful mock Gateway: adding B saves only [A, B] and follows shared Q after a page reload; clearing the final fallback saves [] and stays empty after config reload. Each edit sends one config.set, with defaults and unrelated agent metadata preserved.
  • Remote formatting, lint, UI types, assertion/line ratchets, and MDX pass. CI and required aggregate pass on the same head.

Visual evidence

View Before After
Inherited primary survives fallback edits Original behavior after the same edit and reload Corrected writer behavior after the same edit and reload
Explicit empty fallback list survives reload Original behavior after the same edit and reload Corrected writer behavior after the same edit and reload

Exact-head fallback inheritance and explicit-empty interactions

proof.webm

Visual verification

  • Baseline: f310ecc
  • Exact head: 609ca7ae74533c537145af01af37e10648d60e72
  • Scenario: Add B to an inherited P+A chain, change the shared primary to Q and reload the page; then clear the last fallback with no authored primary and reload config.
  • Runtime/build: Node v24.19.0; Chromium 144.0.7559.0; UI index SHA256 686e8b37e7a50565ad0d12ff70730ab9cc12f670bad52e3c87a15bd91caeb82c
  • Writer primary ownership: Before: edits pin P. After: saved model has only fallbacks, then full page reload visibly inherits Q.
  • Clearing final fallback: Before: inherited A returns. After: saved fallbacks [] remains empty after reload.
  • Config writes: One config.set for each edit; unchanged defaults and unrelated agent metadata verified.
  • Clean exact-head source and unchanged reused UI bundle hashes verified
  • Equivalent baseline and fixed fixtures at 1440x1000, dark theme, en-US
  • Actual stateful mock config.set payload plus config/raw readback asserted
  • Source recordings retained; input cues do not cover controls
  • In-place WaSelect label caching reproduced without edits on both base and fixed; full page reload verified with Q retained in mock config/raw
  • Lead inspected all four original-resolution screenshots and the complete 27.16-second decoded recording sequence; synthetic fixtures only, with readable controls and input cues.

@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Sep 8, 2026
@shakkernerd shakkernerd self-assigned this Sep 8, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 8, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 4:17 AM ET / 08:17 UTC.

ClawSweeper review

What this changes

Preserves inherited primary models when editing agent fallback chips, saves explicitly empty fallback chains, and adds regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main and v2026.9.2 retain the defective writer logic. No introduced correctness or security defect was found, and the supplied browser comparison supports the intended behavior.

Priority: P2
Reviewed head: 609ca7ae74533c537145af01af37e10648d60e72

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression cases and inspected before/after UI evidence; no blocking defect was found.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The built Control UI comparison exercises the changed writer through fallback-chip edits against a stateful mock Gateway. Inspected before/after screenshots show inherited custom/Q and an empty chain; the captured body reports save/reload and payload readback checks at the reviewed head. This is bounded browser proof, not live Gateway/provider validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The built Control UI comparison exercises the changed writer through fallback-chip edits against a stateful mock Gateway. Inspected before/after screenshots show inherited custom/Q and an empty chain; the captured body reports save/reload and payload readback checks at the reviewed head. This is bounded browser proof, not live Gateway/provider validation.
Evidence reviewed 9 items Verified introduced repair: The pinned merge-base-to-head diff changes the fallback writer to retain the authored primary and pass an explicit array, including an empty array, through the existing model-shape writer.
Current main still needs the repair: The fetched main writer still copies the effective shared primary into the agent entry and converts an empty fallback selection to null.
Latest release retains the old behavior: The same defective fallback writer exists in the supplied latest release, v2026.9.2.
Findings None None.
Security None None.

How this fits together

The Control UI’s agent settings turn model selections into per-agent configuration. The Gateway combines that configuration with shared defaults to choose the primary model and permitted fallbacks.

flowchart LR
  A[Fallback chip edits] --> B[Agent configuration writer]
  C[Authored primary choice] --> B
  B --> D[Saved agent configuration]
  D --> E[Gateway model resolution]
  F[Shared model defaults] --> E
  E --> G[Primary and fallback chain]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -16, Tests +78, Docs +6. Total +68 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 25 -16
Tests 1 101 23 +78
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 116 48 +68

Review metrics

None.

Technical review

Best possible solution:

Keep fallback editing at the existing configuration writer, preserving authored primary choices and expressing an intentional empty chain with the already-supported array shape.

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

Yes: current-main source shows that editing fallbacks copies the shared primary, while clearing an implicit-primary chain removes the override. Supplied baseline screenshots corroborate both outcomes; this review did not execute the application.

Is this the best way to solve the issue?

Yes: the patch repairs the writer using existing runtime semantics, preserves explicit primary choices, and avoids a competing configuration path or migration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4250f25e7004.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The built Control UI comparison exercises the changed writer through fallback-chip edits against a stateful mock Gateway. Inspected before/after screenshots show inherited custom/Q and an empty chain; the captured body reports save/reload and payload readback checks at the reviewed head. This is bounded browser proof, not live Gateway/provider validation.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The built Control UI comparison exercises the changed writer through fallback-chip edits against a stateful mock Gateway. Inspected before/after screenshots show inherited custom/Q and an empty chain; the captured body reports save/reload and payload readback checks at the reviewed head. This is bounded browser proof, not live Gateway/provider validation.

Label justifications:

  • P2: This fixes a bounded agent-settings defect that unexpectedly pins the primary or restores cleared fallbacks.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The built Control UI comparison exercises the changed writer through fallback-chip edits against a stateful mock Gateway. Inspected before/after screenshots show inherited custom/Q and an empty chain; the captured body reports save/reload and payload readback checks at the reviewed head. This is bounded browser proof, not live Gateway/provider validation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The built Control UI comparison exercises the changed writer through fallback-chip edits against a stateful mock Gateway. Inspected before/after screenshots show inherited custom/Q and an empty chain; the captured body reports save/reload and payload readback checks at the reviewed head. This is bounded browser proof, not live Gateway/provider validation.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The built Control UI comparison exercises the changed writer through fallback-chip edits against a stateful mock Gateway. Inspected before/after screenshots show inherited custom/Q and an empty chain; the captured body reports save/reload and payload readback checks at the reviewed head. This is bounded browser proof, not live Gateway/provider validation.

Evidence

What I checked:

  • Verified introduced repair: The pinned merge-base-to-head diff changes the fallback writer to retain the authored primary and pass an explicit array, including an empty array, through the existing model-shape writer. (ui/src/pages/agents/model-config.ts:71, 609ca7ae7453)
  • Current main still needs the repair: The fetched main writer still copies the effective shared primary into the agent entry and converts an empty fallback selection to null. (ui/src/pages/agents/model-config.ts:79, 4250f25e7004)
  • Latest release retains the old behavior: The same defective fallback writer exists in the supplied latest release, v2026.9.2. (ui/src/pages/agents/model-config.ts:79, 3928bad9badf)
  • Existing runtime contract: Primary resolution inherits the shared primary when the agent has none; fallback resolution explicitly treats an empty array as disabling shared fallbacks. This is an existing OpenClaw configuration contract, with no dependency on a Codex implementation. (src/agents/agent-scope.ts:501, 609ca7ae7453)
  • Caller and configuration isolation: The overview invokes this writer for explicit fallback edits behind the existing config.set operator.admin capability check. Agent entry targeting retains the authored entry path; the patch introduces no new authorization or persistence mechanism. (ui/src/pages/agents/agents-page.ts:1185, 609ca7ae7453)
  • Focused regression coverage: Read all writer tests: cases cover implicit and shared primaries, authored primaries, explicit empty chains, unrelated agent metadata, and clearing a primary without deleting authored fallbacks. The body reports 11 passing cases and baseline failures; no tests were executed during this read-only review. (ui/src/pages/agents/model-config.test.ts:64, 609ca7ae7453)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-08T07:23:38.807Z sha 609ca7a :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 8, 2026
@shakkernerd
shakkernerd merged commit 5ff4c74 into main Sep 8, 2026
146 checks passed
@shakkernerd
shakkernerd deleted the fix/fallback-inheritance branch September 8, 2026 08:18
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: editing agent fallbacks preserves primary inheritance and keeps explicitly cleared chains empty.

obviyus added a commit that referenced this pull request Sep 8, 2026
Saved model controls lost a catalog row's unavailable state, so an unavailable saved fallback could become a new default choice. Preserve that state in Agents and Models settings, reject disabled additions at the existing multi-select boundary, and skip disabled rows during keyboard navigation. Saved choices stay visible and removable. Missing runtime metadata displays as unknown instead of guessing an engine.

All 82 affected control and consumer checks pass. The real built UI/Gateway at CI merge `5c82ef64e954844c89160fec0e68e643d7355857` displayed `retired/not-offered`, then selecting Auto removed the utility override and showed “Defaults saved.” Primary, fallbacks and the selected agent's explicit empty fallback list stayed unchanged. Browser and Gateway stopped normally. Earlier retained lifecycle proof verifies inherited-primary edits, explicit-empty save/readback, later global-default changes and sibling preservation; the already-landed writer from #141967 remains unchanged.

The same build also ignored a normal click on the unavailable row, preserving the complete config readback. Separate keyboard captures show Down/Up movement, Escape/Tab focus and End skipping the unavailable row. Enter then saved `fixture/global-two`, preserving the saved utility, fallback chain and agent settings. A final optional focus query failed after that successful save/readback; the raw failure, final accessibility snapshot and clean consumer stops are retained.

The shared picker from #141894 has landed and its exercised implementation matches this candidate. That PR owns the control and caller migrations. This change adds the unavailable-setting regression, saved-label assertion and Auto removal callback check.

Required CI run [34215662198](https://github.com/openclaw/openclaw/actions/runs/34215662198) passed on the prior combined head. GitHub then refused the merge. A check against authoritative main confirmed one test-helper import conflict. The resolution keeps both helpers, and all 38 tests in the affected file pass. The exercised product owners are unchanged; the built proof above retains its original identity. Fresh review and required CI are pending on this conflict-resolution head. Earlier failed checks and fixture attempts remain preserved.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
…law#141967)

Fallback edits preserve primary inheritance and explicitly empty fallback chains.

Refs openclaw#137410.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
…aw#142048)

Saved model controls lost a catalog row's unavailable state, so an unavailable saved fallback could become a new default choice. Preserve that state in Agents and Models settings, reject disabled additions at the existing multi-select boundary, and skip disabled rows during keyboard navigation. Saved choices stay visible and removable. Missing runtime metadata displays as unknown instead of guessing an engine.

All 82 affected control and consumer checks pass. The real built UI/Gateway at CI merge `5c82ef64e954844c89160fec0e68e643d7355857` displayed `retired/not-offered`, then selecting Auto removed the utility override and showed “Defaults saved.” Primary, fallbacks and the selected agent's explicit empty fallback list stayed unchanged. Browser and Gateway stopped normally. Earlier retained lifecycle proof verifies inherited-primary edits, explicit-empty save/readback, later global-default changes and sibling preservation; the already-landed writer from openclaw#141967 remains unchanged.

The same build also ignored a normal click on the unavailable row, preserving the complete config readback. Separate keyboard captures show Down/Up movement, Escape/Tab focus and End skipping the unavailable row. Enter then saved `fixture/global-two`, preserving the saved utility, fallback chain and agent settings. A final optional focus query failed after that successful save/readback; the raw failure, final accessibility snapshot and clean consumer stops are retained.

The shared picker from openclaw#141894 has landed and its exercised implementation matches this candidate. That PR owns the control and caller migrations. This change adds the unavailable-setting regression, saved-label assertion and Auto removal callback check.

Required CI run [34215662198](https://github.com/openclaw/openclaw/actions/runs/34215662198) passed on the prior combined head. GitHub then refused the merge. A check against authoritative main confirmed one test-helper import conflict. The resolution keeps both helpers, and all 38 tests in the affected file pass. The exercised product owners are unchanged; the built proof above retains its original identity. Fresh review and required CI are pending on this conflict-resolution head. Earlier failed checks and fixture attempts remain preserved.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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