Skip to content

fix(ui): render model provider controls progressively - #130546

Merged
obviyus merged 3 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-130111
Aug 29, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-130111

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #130111.

What Problem This Solves

The Model Providers page waited for provider quota and local session-cost requests before it showed auth, catalog, and config controls. A slow supplemental request left the whole provider section on Loading….

Root cause

The route loader put auth, catalog, config, provider usage, and session cost in one Promise.all. The page could not adopt the required provider data until every supplemental request settled.

Fix

  • Load auth, catalog, and config first so provider controls render as soon as their required data is ready.
  • Load provider usage and local cost independently through one supplemental lifecycle owner so each result appears as soon as it is ready.
  • Pass abort signals through both supplemental Gateway requests and reject stale client or Gateway-epoch completions.
  • Cancel the active supplemental generation when a core refresh starts, then replace it after core data returns.
  • Retry incomplete provider usage without restarting an independent local-cost request.
  • Keep existing usage failures visible and show Loading… while supplemental data is pending.

Evidence

  • Current main de969147e7f3ba404e20d8f9966b97f1981e5f17: Chromium held usage.status and sessions.usage; provider controls did not appear within 1 second.
  • Head ee7154a5f6feaa45aafb1dab620b63f0f53091c2: the same browser flow showed provider controls while both calls remained pending, showed the Pro plan while cost remained pending, then showed $1.25 after cost release.
  • The browser observed exactly one usage.status request and one sessions.usage request.
  • Pre-correction head 3c917fb890551dd2f827c4833103a9bc946ee50e left an old supplemental request active while a held core refresh ran.
  • Head ee7154a5f6feaa45aafb1dab620b63f0f53091c2 aborts both old supplemental requests before the held core refresh can finish or stale data can publish.
  • Pre-correction head f9f8b32ffd19d8dbd08eea30861bb91287488037 restarted a held local-cost request during automatic usage recovery; the new head retries only usage and lets that cost request publish.
  • 81 focused load, page, refresh, reconnect, and view tests pass.
  • Focused Control UI end-to-end test passes.

Before / After browser evidence

Scenario Current main Repair head
Both supplemental requests held Provider controls stayed absent after 1 second Credentials configured and Loading… appeared while both requests stayed pending
Only provider usage released Not observable because the provider card was still blocked Pro appeared while $1.25 stayed absent
Local cost released Provider card appeared only after both requests finished $1.25 appeared on the already-visible provider card

The isolated Chromium run observed one usage.status request and one sessions.usage request. It used a mocked Gateway WebSocket with held responses and no private account or provider data.

Change size

  • Production: +194 lines net. The growth is the supplemental task owner, including independent publication, cancellation, stale-result fencing, refresh coalescing, and pending state.
  • Tests: +244 lines net. Coverage proves current-main red behavior, exact browser traffic, independent publication, usage-only recovery, cancellation, reconnect replacement, and stale-write rejection.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 29, 2026, 8:33 AM ET / 12:33 UTC.

ClawSweeper review

What this changes

The PR renders Model Providers controls from authentication, catalog, and configuration data first, then loads provider usage and local session cost afterward.

Merge readiness

⚠️ Needs maintainer review before merge - 4 items remain

Keep open: the PR unblocks the core controls, but one slow supplemental RPC still prevents the other supplemental result from appearing, leaving the linked behavior only partially fixed.

Priority: P2
Reviewed head: 3c917fb890551dd2f827c4833103a9bc946ee50e

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused browser evidence supports the main responsiveness improvement, but the introduced combined supplemental completion leaves a concrete P2 behavior gap.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied PR body describes an after-fix Chromium run of the changed Model Providers entrypoint: core controls appeared while both Gateway metric calls were held, then plan and cost rendered after release. That sufficiently proves the core-first behavior, although it does not cover the independent supplemental settlement required to resolve the functional finding.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied PR body describes an after-fix Chromium run of the changed Model Providers entrypoint: core controls appeared while both Gateway metric calls were held, then plan and cost rendered after release. That sufficiently proves the core-first behavior, although it does not cover the independent supplemental settlement required to resolve the functional finding.
Evidence reviewed 6 items Introduced supplemental gate: The introduced helper awaits provider usage and session cost in one Promise.all, so neither value is returned until both requests settle.
Only combined data is published: The loader merges supplemental data into page state only from the combined task completion; the view therefore continues to render Loading while a settled usage result is withheld.
Regression coverage misses one-sided settlement: The new browser test holds both RPCs and resolves both before asserting the plan and cost, so it cannot detect a fast quota result being blocked by a slow local-cost request.
Findings 1 actionable finding [P2] Publish each supplemental result without waiting for the other
Security None None.

How this fits together

The Control UI asks the Gateway for provider configuration and for secondary quota and local-cost metrics. The page uses the core data to render editable provider controls, then enriches provider cards as metric results arrive.

flowchart LR
A[Gateway connection] --> B[Core provider reads]
A --> C[Provider usage request]
A --> D[Session cost request]
B --> E[Editable provider controls]
C --> F[Quota and plan details]
D --> G[Local cost details]
E --> H[Model Providers page]
F --> H
G --> H
Loading

Before merge

  • Publish each supplemental result without waiting for the other (P2) - Promise.all holds a completed usage.status result until sessions.usage finishes (and vice versa), while the only state write occurs after that combined promise resolves. The linked bug explicitly requires quota and local cost to settle independently, so a slow local aggregation still leaves the plan/quota as Loading. Publish each result through the same stale-result fence independently and cover both settlement orders.
  • Resolve merge risk (P1) - A slow local session-cost aggregation still keeps a completed provider quota/plan result in Loading, and the reverse also holds; the requested progressive metric behavior remains unavailable.
  • Resolve merge risk (P1) - Production code grows by 141 net lines for the supplemental lifecycle owner; that growth is only justified if it publishes each independent result without losing its cancellation and stale-write fencing.
  • Complete next step (P2) - The remaining defect has a narrow, source-proven repair boundary: publish each completed supplemental request through the existing fenced owner rather than its shared completion.

Findings

  • [P2] Publish each supplemental result without waiting for the other — ui/src/pages/model-providers/load.ts:135-154
Agent review details

Security

None.

PR surface

Source +141, Tests +184. Total +325 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 173 32 +141
Tests 4 199 15 +184
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 372 47 +325

Review metrics

Metric Value Why it matters
Production vs test LOC production +141, tests +184 The added lifecycle owner is substantial for a bug fix and should earn its size by completing independent supplemental publication.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #130111
Summary: This PR is the linked candidate fix for the canonical Model Providers loading issue, but it leaves part of that issue unresolved.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Publish supplemental results independently (recommended)
    Refactor the supplemental owner so either settled RPC updates its own card data while the other remains pending, and prove both settlement orders.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Publish provider usage and local cost independently while retaining the existing abort, client, and Gateway-epoch fences; add one-sided-settlement tests.

Technical review

Best possible solution:

Keep the core-first split, but have the supplemental owner publish provider usage and local cost independently with the same client/epoch fence, then add one-sided-settlement coverage.

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

Yes—source reproducible: resolve the core reads and only one of usage.status or sessions.usage; the introduced Promise.all cannot publish that settled result while the other remains pending.

Is this the best way to solve the issue?

No—the core-versus-supplemental split is the right boundary, but combining the two supplemental calls still violates the linked issue's independent-settlement requirement.

Full review comments:

  • [P2] Publish each supplemental result without waiting for the other — ui/src/pages/model-providers/load.ts:135-154
    Promise.all holds a completed usage.status result until sessions.usage finishes (and vice versa), while the only state write occurs after that combined promise resolves. The linked bug explicitly requires quota and local cost to settle independently, so a slow local aggregation still leaves the plan/quota as Loading. Publish each result through the same stale-result fence independently and cover both settlement orders.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The supplied PR body describes an after-fix Chromium run of the changed Model Providers entrypoint: core controls appeared while both Gateway metric calls were held, then plan and cost rendered after release. That sufficiently proves the core-first behavior, although it does not cover the independent supplemental settlement required to resolve the functional finding.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: The remaining defect delays secondary provider quota or cost information but no longer blocks the core settings controls.
  • merge-risk: 🚨 availability: The introduced combined supplemental task can leave a completed metric unavailable until an unrelated slow request finishes.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The supplied PR body describes an after-fix Chromium run of the changed Model Providers entrypoint: core controls appeared while both Gateway metric calls were held, then plan and cost rendered after release. That sufficiently proves the core-first behavior, although it does not cover the independent supplemental settlement required to resolve the functional finding.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied PR body describes an after-fix Chromium run of the changed Model Providers entrypoint: core controls appeared while both Gateway metric calls were held, then plan and cost rendered after release. That sufficiently proves the core-first behavior, although it does not cover the independent supplemental settlement required to resolve the functional finding.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs ui/src/pages/model-providers/load.test.ts ui/src/pages/model-providers/model-providers-page.usage.test.ts.
  • [P1] node scripts/run-vitest.mjs ui/src/e2e/model-providers-progressive.e2e.test.ts.

What I checked:

  • Introduced supplemental gate: The introduced helper awaits provider usage and session cost in one Promise.all, so neither value is returned until both requests settle. (ui/src/pages/model-providers/load.ts:135, 3c917fb89055)
  • Only combined data is published: The loader merges supplemental data into page state only from the combined task completion; the view therefore continues to render Loading while a settled usage result is withheld. (ui/src/pages/model-providers/supplemental-load.ts:48, 3c917fb89055)
  • Regression coverage misses one-sided settlement: The new browser test holds both RPCs and resolves both before asserting the plan and cost, so it cannot detect a fast quota result being blocked by a slow local-cost request. (ui/src/e2e/model-providers-progressive.e2e.test.ts:109, 3c917fb89055)
  • Current main still has the original gate: Fetched main awaits the two supplemental RPCs alongside core reads, confirming the linked issue remains necessary and this PR is the candidate repair. (ui/src/pages/model-providers/load.ts:100, da1f6dd43e43)
  • Feature-history owner: Blame attributes the current main loader and page lifecycle lines to the source-install migration that introduced the central files. (ui/src/pages/model-providers/load.ts:100, b85a049da5e8)
  • Supplied behavior proof: The PR body reports a Chromium before/after run where controls appeared while both metric calls were held, then the plan and cost appeared after release; it proves the core-control split but not independent supplemental settlement. (3c917fb89055)

Likely related people:

  • Peter Steinberger: Current main blame and feature history attribute the relevant loader and page lifecycle to this commit. (role: current feature-source author; confidence: high; commits: b85a049da5e8; files: ui/src/pages/model-providers/load.ts, ui/src/pages/model-providers/model-providers-page.ts, ui/src/pages/model-providers/view.ts)

Rank-up moves

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

  • Publish each supplemental result independently and add tests that release one RPC while the other remains pending.

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 (4 earlier review cycles)
  • reviewed 2026-08-27T00:55:58.187Z sha 6c5ee38c482cb7ef66510fa0ab76ae2a1dabb91e :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-27T23:05:15.965Z sha f222850e4c0567b580b115598f15d345da58dc72 :: needs changes before merge. :: [P2] Reset interrupted usage state before the replacement request
  • reviewed 2026-08-28T01:31:47.870Z sha d85d1303e1f95f42e5260416b190172d370cceb3 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-28T10:27:46.503Z sha 9441b41b3d0d2b21a0f17a9a3d59507e6fd11eda :: needs maintainer review before merge. :: none

@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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 27, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-130111 branch from d85d130 to 9441b41 Compare August 28, 2026 10:20
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 28, 2026
@obviyus
obviyus force-pushed the sunlit/fix/issue-130111 branch from 9441b41 to 3c917fb Compare August 29, 2026 12:26
@openclaw-barnacle openclaw-barnacle Bot added size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed size: L labels Aug 29, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: L and removed size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 29, 2026
@obviyus

obviyus commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks @sunlit-deng!

Proof: An isolated Chromium run held provider quota and local cost responses. Provider controls appeared immediately, quota appeared before cost, Refresh rejected stale results, and quota retries left the pending cost request active. Exact-head CI and immutable ClawSweeper passed.

  • Bug: Slow supplemental requests blocked provider controls, and refresh or quota recovery could replace the wrong pending work.
  • Fix: The page now publishes usage and cost independently under one refresh lifecycle that cancels stale generations.

Example

Before After
Provider controls waited for quota and cost; quota retry restarted pending cost. Provider controls render first; quota and cost publish independently; stale work cannot publish.

@obviyus
obviyus merged commit 55f127f into openclaw:main Aug 29, 2026
189 of 191 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 30, 2026
Render Model Providers controls as soon as authentication, catalog, and configuration data are ready.

Load provider usage and local cost independently. Cancel stale supplemental generations when core refresh starts, and keep quota retries from restarting pending cost work.

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 merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Model Providers waits for quota and cost before rendering controls

2 participants