Skip to content

fix(ui): stage every gateway-honored agent model shape instead of silently dropping input - #123995

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-agent-model-staging
Aug 15, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-agent-model-staging

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 with fallbacks and no primary (src/agents/agent-scope.ts — including the documented "explicit empty array disables global fallbacks" contract). With a fully implicit default model (no agents.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.

stageAgentPrimaryModel had the sibling bug: clearing the primary called removeFormValue on the whole model node, deleting authored agent fallbacks along 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 stageModelShape owner now writes the smallest representable form — bare string, { primary, fallbacks }, { fallbacks }, or node removal — and both entry points share one existingModelParts probe instead of duplicating existing-shape inspection. This deletes the duplicated primary-probing branches and the artificial primary ? … : null gate 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

  • 2 new regression tests fail pre-fix: "stages fallbacks without a primary when no model is authored anywhere" (form stayed empty) and "keeps authored fallbacks when the primary model is cleared" (fallbacks deleted). Both pass post-fix; a third new test locks the still-correct removal path, and the existing keyed-entry write test passes unchanged (4/4).
  • Full ui/src/pages/agents suite: 171 passed | 1 skipped. pnpm tsgo:ui clean; oxlint/oxfmt clean.
  • Autoreview (Codex, high): clean, no accepted findings, "patch is correct (0.98)".
  • Production LOC: +51 −41 in 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.

…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.
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Aug 15, 2026
@steipete
steipete marked this pull request as ready for review August 15, 2026 03:55
@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 Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 15, 2026, 12:02 AM ET / 04:02 UTC.

ClawSweeper review

What this changes

This 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 provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep 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
Reviewed head: e60d91bd56a7c819263a0910018ff0a6e590a2e2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch matches the gateway contract and has valuable targeted regressions; a real Control UI demonstration remains the only material rank-up move.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer PR, although repository policy still requires sanitized running-Control-UI evidence before landing.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer PR, although repository policy still requires sanitized running-Control-UI evidence before landing.
Evidence reviewed 4 items Current-main failure: The fallback editor only creates a target for a nonempty fallback list when a primary resolves; without an authored primary at either scope it returns without staging a form value.
Gateway and config contract: The shared model configuration type permits an object with optional primary and fallbacks, while the gateway treats an explicitly present fallback array as an override, including an empty array.
Patch and regression coverage: The branch centralizes the four representable write shapes and adds regressions for fallback-only staging, primary clearing with authored fallbacks, and full node removal.
Findings 1 actionable finding [P3] Add running Control UI proof for the changed edit path
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Add running Control UI proof for the changed edit path (P3) - This changes visible configuration editing, but the submitted evidence is limited to mocked configuration-capability tests and static checks. Attach sanitized before/after screenshots or a short recording of adding a fallback with no primary and saving it, as required for Control UI changes.
  • Complete next step (P2) - This protected maintainer PR needs its required visual evidence and ordinary maintainer landing review; no automated source repair is indicated.

Findings

  • [P3] Add running Control UI proof for the changed edit path — ui/src/pages/agents/model-config.ts:102
Agent review details

Security

None.

PR surface

Source +10, Tests +63. Total +73 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 51 41 +10
Tests 1 63 0 +63
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 114 41 +73

Review metrics

Metric Value Why it matters
Production vs test LOC production +10; tests +63 The small production increase consolidates formerly divergent shape writers; test growth covers the two silent state-loss cases and the retained removal behavior.

Technical review

Best 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:

  • [P3] Add running Control UI proof for the changed edit path — ui/src/pages/agents/model-config.ts:102
    This changes visible configuration editing, but the submitted evidence is limited to mocked configuration-capability tests and static checks. Attach sanitized before/after screenshots or a short recording of adding a fallback with no primary and saving it, as required for Control UI changes.
    Confidence: 0.99

Overall correctness: patch is correct
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 81e0cf0d1df2.

Labels

Label changes:

  • add P2: This repairs a bounded but silent failure in the per-agent model settings workflow.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer PR, although repository policy still requires sanitized running-Control-UI evidence before landing.

Label justifications:

  • P2: This repairs a bounded but silent failure in the per-agent model settings workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer PR, although repository policy still requires sanitized running-Control-UI evidence before landing.

Evidence

What I checked:

  • Current-main failure: The fallback editor only creates a target for a nonempty fallback list when a primary resolves; without an authored primary at either scope it returns without staging a form value. (ui/src/pages/agents/model-config.ts:63, 103e1a4cc9de)
  • Gateway and config contract: The shared model configuration type permits an object with optional primary and fallbacks, while the gateway treats an explicitly present fallback array as an override, including an empty array. (src/config/types.agents-shared.ts:10, 103e1a4cc9de)
  • Patch and regression coverage: The branch centralizes the four representable write shapes and adds regressions for fallback-only staging, primary clearing with authored fallbacks, and full node removal. (ui/src/pages/agents/model-config.test.ts:64, e60d91bd56a7)
  • Current-main and provenance check: The local checkout confirms the current-main successor does not modify either touched UI file; blame ties the original fallback gate to the model-config extraction commit for the candidate predecessor PR. (ui/src/pages/agents/model-config.ts:63, 0982ee57292d)

Likely related people:

  • Peter Steinberger: Introduced the extracted model-staging module containing the fallback gate on current main; the branch continues the same owner boundary. (role: introduced current UI staging path and recent area contributor; confidence: high; commits: 0982ee57292d, e60d91bd56a7; files: ui/src/pages/agents/model-config.ts, ui/src/pages/agents/model-config.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach sanitized before/after Control UI screenshots or a short recording of the fallback-only edit and save flow.

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.

@steipete
steipete merged commit 622eec9 into main Aug 15, 2026
219 checks passed
@steipete
steipete deleted the codex/autoqa-agent-model-staging branch August 15, 2026 04:14
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…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.
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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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