Repository navigation
fix(ui): stop config ensure loops from hanging settings pages - #185568
Conversation
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.
|
🦞👀 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. What this changesThis 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSettings-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
Technical reviewBest 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
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +37, Tests +93. Total +130 across 7 files. Added test files: 1. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 27, 2026, 2:49 AM ET / 06:49 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
…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
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:client.authcarries read access,startConfigLoadreturns no read andloadConfigresolvesfalseimmediately.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.config.getfails, 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
flushrunning back to back, with the writes coming frommodel-providers-controller.tssyncConfig→runtimeConfig.ensureLoaded()→runtime-config-editorrun()→publish().Fix
config-gateway-read.tsowns 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-editorensureLoaded()andruntime-config-capabilityensureDisplayLoaded()join a held load, or start one only when that check passes. Otherwise they return without publishing.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 throughensureLoaded(), so it now callsrefresh(); mounting the page still usesensureLoaded().Evidence
New regression tests in
runtime-config-load-retry.test.ts, for both the display and editor paths:config.getwith 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.getforced to fail for 10 s:config.getrequestsWithout forced failures, the page loads normally with one
config.getand all provider rows.pnpm tsgo:uiand oxlint pass.Unit tests:
src/lib/config,src/pages/model-providers,src/pages/configandsrc/pages/channelsall pass (1,117).src/app: all pass except 2plugin-distributions.node.test.tscases. 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-workshoppasses (20).