Repository navigation
fix: preserve primary inheritance when editing agent fallbacks - #141967
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. |
|
Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 4:17 AM ET / 08:17 UTC. ClawSweeper reviewWhat this changesPreserves 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -16, Tests +78, Docs +6. Total +68 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Fixed: editing agent fallbacks preserves primary inheritance and keeps explicitly cleared chains empty. |
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]>
…law#141967) Fallback edits preserve primary inheritance and explicitly empty fallback chains. Refs openclaw#137410.
…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]>
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
609ca7ae74533c537145af01af37e10648d60e72with 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 oneconfig.set, with defaults and unrelated agent metadata preserved.Visual evidence
Exact-head fallback inheritance and explicit-empty interactions
proof.webm
Visual verification
609ca7ae74533c537145af01af37e10648d60e72