Skip to content

fix(ui): stop config ensure loops from hanging settings pages - #185568

Merged
obviyus merged 2 commits into
mainfrom
fix-config-load-retry-storm
Oct 27, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix-config-load-retry-storm

Conversation

@obviyus

@obviyus obviyus commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Settings pages could freeze the browser tab. The Models page was the reported case: after a fresh load the tab pegged a CPU core, grew to several GB and showed the browser's "page unresponsive" warning.

Pages re-ensure runtime config from effects that track config publications (runtimeConfig.revision()), and every config read publishes when it starts and when it settles. When a read failed, the next publication re-ran the effect, which started another read, and so on:

  • Hard hang: when the page is connected before client.auth carries read access, startConfigLoad returns no read and loadConfig resolves false immediately. run() still publishes twice and drops the load, so the effect spins in microtasks without yielding. The tab can never process the hello that would grant access. This depends on startup timing, so it was intermittent and showed up on paired-device sessions.
  • Request storm: when config.get fails, the same cycle sends about 120 requests a second and re-renders the shell each round.

A CPU profile of the frozen tab showed Solid's scheduler flush running back to back, with the writes coming from model-providers-controller.ts syncConfig → runtimeConfig.ensureLoaded() → runtime-config-editor run() → publish().

Fix

config-gateway-read.ts owns whether a config read may start. It now also decides admission for ensure-style callers:

  • canEnsureConfigRead(state) is true only when a read can actually start, and the last foreground read on the same connection did not fail within the past 5 seconds.
  • runtime-config-editor ensureLoaded() and runtime-config-capability ensureDisplayLoaded() join a held load, or start one only when that check passes. Otherwise they return without publishing.
  • Explicit refresh() / refreshDisplay() and reconnects (a new connection epoch) still read immediately, so a user's Retry always reads.

This fixes the loop at the owner for every page that re-ensures config from an effect (Models, Config, Channels, chat composer and others), not only Models.

A user's Retry must always reread, so it uses refresh(). The Config page and Search's config Retry already did. Skill Workshop's Retry went through ensureLoaded(), so it now calls refresh(); mounting the page still uses ensureLoaded().

Evidence

  • New regression tests in runtime-config-load-retry.test.ts, for both the display and editor paths:

    • A load that cannot start before read access, with an observer that re-ensures on every publication: main republishes 50 times, the fix 0–1 times.
    • A failing config.get with the same observer: main sends 25–26 requests, the fix sends 1, retries after the cooldown, and an explicit refresh retries straight away.
  • Two existing tests now retry through an explicit refresh or after the cooldown, instead of an immediate re-ensure.

  • Live Models page against a real Gateway, with config.get forced to fail for 10 s:

    Build config.get requests DOM nodes Script time
    main 1,267 41,392 5.9 s
    this PR 1 2,163 0.1 s

    Without forced failures, the page loads normally with one config.get and all provider rows.

  • pnpm tsgo:ui and oxlint pass.

  • Unit tests: src/lib/config, src/pages/model-providers, src/pages/config and src/pages/channels all pass (1,117).

  • src/app: all pass except 2 plugin-distributions.node.test.ts cases. They fail on a missing module in a temporary plugin build folder and don't touch config code.

  • E2E: all 16 config, Models and Channels files pass (62 tests).

  • First CI run caught Skill Workshop "retries config only on request" (its Retry used ensureLoaded()). Fixed in the second commit; src/pages/skill-workshop passes (20).

Pages re-ensure runtime config from effects that track config publications,
and every config read publishes. A read that cannot start (connected before
read access lands) resolved at once and republished, so the Models page spun
in microtasks and froze the tab; a failing config.get instead sent about 120
requests a second.

Ensure-style reads now start only when a read can run and the last
foreground read on the same connection did not just fail. A failure waits
5 seconds before an ensure repeats it; explicit refreshes and reconnects
still read immediately.
@clawsweeper

clawsweeper Bot commented Oct 27, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR prevents automatic config reads from republishing when unavailable or recently failed while preserving explicit Retry and reconnect reads.

Example: The Models page opens while config.get repeatedly fails.

  • Before: The reported real-Gateway run issued 1,267 config.get requests during a 10-second failure window.
  • After: The reported patched run issued one request, while explicit refresh remains immediate.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported fix with useful regression coverage and reported live measurements; runtime evidence is summarized and broad current-head validation is unfinished.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor-proof gate; its body reports the real Models page against a Gateway with forced config.get failures and normal-load success, while inspectable raw runtime artifacts are not attached.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Opening settings can freeze the browser or repeatedly send failing config requests.
Reason: The maintainer-authored direction addresses a concrete usability and availability failure with bounded changes to existing owners.

Merge readiness

✅ Ready for maintainer review

This PR addresses a current config-read feedback loop with a focused shared-owner fix; no actionable introduced defect was found, and current-head CI remains pending.

Priority: P1
Reviewed head: 615838cf8d5c5004041424a4e621fc47655b075b

Before merge

None.

Findings

None.

Agent review details

How this fits together

Settings-page observers call the runtime config capability, which admits shared Gateway config reads and publishes their results back to reactive views.

flowchart TD
  A[Settings page observers] --> B[Runtime config capability]
  B --> C[Editor or display reader]
  C --> D[Shared read admission]
  D --> E[Gateway config.get]
  E --> F[Config state publications]
  F --> A
Loading

Technical review

Best possible solution:

Keep shared ensure admission in the config-read owner and retain explicit refresh as the immediate user recovery path.

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

Current source connects revision-tracking page effects to reads that publish before and after an unavailable or failed load; the PR reports matching observer regressions and real-Gateway measurements, but this read-only review executed no target code.

Is this the best way to solve the issue?

The patch repairs admission at the existing shared owner, reuses connection epochs, preserves held-load joining, and updates the affected explicit Retry caller without adding a competing read path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 851c6a697886.

Provenance checked

  • Shared config display/editor reads keeps the original intent (9794c6a: Separate eager display facts from deferred editing while preserving synchronous admission, schema receipts, subscriptions, and config ownership.)
  • Skill Workshop load and Retry keeps the original intent (refactor(ui): use Solid async reads and actions in Skill Workshop #180535: Present owner-held read receipts through Solid async boundaries while retaining existing retry controls and scope checks.)
  • Existing retry regression tests keeps the original intent (test(plugins,core,ui): remove low-value tests (batch d376) #179341: Consolidate overlapping test setup while retaining distinct behavior contracts; the modified tests continue checking draft recovery and observer-error cleanup under the new retry policy.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +37, Tests +93. Total +130 across 7 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 45 8 +37
Tests 3 95 2 +93
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 140 10 +130

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported settings-page loop can freeze a browser tab and drive sustained CPU, memory, and Gateway request growth.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-27T06:41:01.930Z sha 3b129cb :: needs maintainer review before merge. :: none

Reviewed October 27, 2026, 2:49 AM ET / 06:49 UTC (Revision 2).

@obviyus

obviyus commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@obviyus
obviyus enabled auto-merge (squash) October 27, 2026 06:51
@obviyus
obviyus merged commit 02d8fa7 into main Oct 27, 2026
98 of 99 checks passed
@obviyus
obviyus deleted the fix-config-load-retry-storm branch October 27, 2026 06:55
@obviyus

obviyus commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…aw#185568)

* fix(ui): stop config ensure loops from hanging settings pages

Pages re-ensure runtime config from effects that track config publications,
and every config read publishes. A read that cannot start (connected before
read access lands) resolved at once and republished, so the Models page spun
in microtasks and froze the tab; a failing config.get instead sent about 120
requests a second.

Ensure-style reads now start only when a read can run and the last
foreground read on the same connection did not just fail. A failure waits
5 seconds before an ensure repeats it; explicit refreshes and reconnects
still read immediately.

* fix(ui): skill workshop Retry rereads config explicitly
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 P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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