Repository navigation
fix(ui): stage every gateway-honored agent model shape instead of silently dropping input - #123995
Conversation
…ently dropping input
The agents-page fallback editor gated staging on a resolvable primary
model, but the gateway resolver honors { fallbacks } with no primary
(agent-scope.ts, including the explicit empty-array-disables-global
contract). With a fully implicit default model, typing a fallback chip
cleared the input and staged nothing — no chip, no error, no write.
Clearing the primary had the sibling bug: removeFormValue deleted the
whole model node including authored agent fallbacks.
One stageModelShape owner now writes the smallest representable shape
(bare string, { primary, fallbacks }, { fallbacks }, or removal), and
both entry points share existingModelParts instead of duplicating
existing-shape probing.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 15, 2026, 12:02 AM ET / 04:02 UTC. ClawSweeper reviewWhat this changesThis PR updates the Agents UI so it can stage fallback-only per-agent model settings and retain authored fallbacks when a primary model is cleared. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open: current main still silently drops fallback edits when no primary resolves, and this focused patch repairs that configuration-staging path. The remaining P3 item is the repository-required running Control UI proof. Priority: P2 Review scores
Verification
How this fits togetherThe Agents UI writes per-agent model choices into the editable configuration form. The gateway subsequently resolves those choices into a primary model and fallback chain for agent runs. flowchart LR
A[Agent settings form] --> B[Model staging helper]
B --> C[Configuration draft]
C --> D[Gateway model resolver]
D --> E[Agent model selection]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +10, Tests +63. Total +73 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one canonical model-shape writer, retain the targeted regressions, and land after a sanitized running-Control-UI demonstration confirms the edit and save flow. Do we have a high-confidence way to reproduce the issue? Yes—on current main, edit a fallback list for an agent with no authored or default primary model; the nonempty list reaches the null-target branch and produces no configuration write. Is this the best way to solve the issue? Yes—the shared writer is the narrowest owner-boundary fix because it represents every existing gateway-honored model shape without adding a setting or compatibility path. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 81e0cf0d1df2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…ently dropping input (openclaw#123995) The agents-page fallback editor gated staging on a resolvable primary model, but the gateway resolver honors { fallbacks } with no primary (agent-scope.ts, including the explicit empty-array-disables-global contract). With a fully implicit default model, typing a fallback chip cleared the input and staged nothing — no chip, no error, no write. Clearing the primary had the sibling bug: removeFormValue deleted the whole model node including authored agent fallbacks. One stageModelShape owner now writes the smallest representable shape (bare string, { primary, fallbacks }, { fallbacks }, or removal), and both entry points share existingModelParts instead of duplicating existing-shape probing.
What Problem This Solves
Found by the round-4 agents-page/model-switching investigation lane, verified against live code. The agents-page fallback editor (
stageAgentModelFallbacks) gated staging on a resolvable primary model. But the gateway resolver explicitly honors a model object withfallbacksand noprimary(src/agents/agent-scope.ts— including the documented "explicit empty array disables global fallbacks" contract). With a fully implicit default model (noagents.defaults.model, no per-agent model — a supported config-light setup), typing a fallback ref and pressing Enter cleared the input, staged nothing, showed no chip and no error. Doctrine-worst class: a user action with no visible outcome and no recorded reason.stageAgentPrimaryModelhad the sibling bug: clearing the primary calledremoveFormValueon the wholemodelnode, deleting authored agentfallbacksalong with it — "inherit the default primary, keep my fallbacks" was silently unexpressible.Why This Change Was Made
Both bugs come from staging code that could not represent every config shape the gateway honors. One
stageModelShapeowner now writes the smallest representable form — bare string,{ primary, fallbacks },{ fallbacks }, or node removal — and both entry points share oneexistingModelPartsprobe instead of duplicating existing-shape inspection. This deletes the duplicated primary-probing branches and the artificialprimary ? … : nullgate rather than patching around them.User Impact
Typing a fallback model on an agent with no authored primary now stages and saves it (the gateway already honored the shape; only the UI refused to write it). Clearing an agent's primary model keeps its authored fallbacks. Clearing a primary with no fallbacks still removes the model node cleanly.
Evidence
ui/src/pages/agentssuite: 171 passed | 1 skipped.pnpm tsgo:uiclean; oxlint/oxfmt clean.model-config.ts(net +10, of which 7 are the two invariant comments and the shared-shape doc). Justified: replaces two divergent partial-shape writers with one owner that can express the full gateway contract; the silent-drop gate and duplicated probing are deleted.