Repository navigation
refactor(ui): split runtime config into layered modules - #122117
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 12:59 PM ET / 16:59 UTC. ClawSweeper reviewWhat this changesThe PR separates the Control UI runtime-configuration capability into state, draft, Gateway-operation, write-coordination, and public-capability modules, then updates direct consumers and tests. Merge readinessNo blocking correctness findings in the runtime-config split. This maintainer-labeled PR should remain open for exact-head CI and maintainer review; likely related people: Vincent Koc (current-main implementation history). Priority: P3 Review scores
Verification
How this fits togetherControl UI settings read and write OpenClaw configuration through the Gateway. Pages and components consume the public runtime-config capability, which coordinates draft state, ordered writes, and Gateway refreshes. flowchart LR
A[Control UI pages] --> B[Runtime config capability]
B --> C[State and draft models]
B --> D[Write coordinator]
D --> E[Gateway operations]
E --> F[Gateway config API]
C --> G[Rendered settings state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +340, Tests +81, Other -2. Total +419 across 47 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one public runtime-config capability while keeping draft ownership, Gateway requests, and ordered writes in their extracted modules. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reorganizes an existing client-side capability rather than reporting a new user-visible failure. Is this the best way to solve the issue? Yes: keeping one public capability while separating state, draft, Gateway, and write-lifecycle owners is a cleaner boundary than retaining the oversized monolith or adding a replacement barrel. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 82ba647673f9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
b237e7d to
293874d
Compare
|
Merged via squash.
|
What Problem This Solves
The Control UI runtime-config owner and its tests had grown into 2,374-line and 3,629-line files, respectively. That made state, draft hydration, Gateway effects, write coordination, and public capability composition difficult to review independently, while both files required grandfathered max-lines suppressions.
Why This Change Was Made
This splits runtime config into five direct-import layers with no replacement barrel: state model, draft model, Gateway operations, write coordinator, and public runtime capability. Snapshot adoption plus draft/original hydration stays wholly in the draft model; debounce, flights, explicit FIFO ordering, suspension, reconnect reconciliation, and teardown flushing stay together in the write coordinator. All internal consumers now import their owning module directly, and the tests are split along the same behavior boundaries with a shared Gateway fixture harness.
The JSON5 lazy boundary is unchanged: draft code statically imports
parseJson5TextandwarmJson5fromjson5-runtime.ts; it never importsjson5directly. Hashless acknowledgements, snapshot fallback, and reconnect reconciliation remain intact.User Impact
There is no intended user-visible behavior change. Developers get smaller, ownership-focused modules and test files, with the two stale max-lines baseline entries removed. Startup chunk composition remains within the existing Control UI budget.
Evidence
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui.config.ts ui/src/lib/config/*.test.ts: 5 files passed, 115 tests passed.pnpm build: passed on the exact head.node --import tsx scripts/check-control-ui-performance.mts: 13 startup JS requests; 325,824 B gzip versus the 327,680 B ceiling (318.2 KiB versus 320.0 KiB).pnpm lint: passed. The final local run used the documented worktree-local heavy-check lock because another worktree held the shared lock.node scripts/check-changed.mjs: passed locally after Crabbox reported no ready remote provider; UI/core typechecks, lint lanes, dead-export checks, formatting, and selected guards passed.pnpm check:import-cycles: 0 runtime value cycles.pnpm check:max-lines-ratchet: passed with 958 remaining grandfathered suppressions.pnpm lint:tmp:dynamic-import-warts: exited successfully; 114 repository advisories remain, none in the new config modules.pnpm lint:tmp:export-name-collisions,pnpm check:wrapper-shadowing, andpnpm plugin-sdk:surface:check: passed.git diff --numstat origin/main...HEAD: production +2603/-2400 (net +203), tests/support +3857/-3639 (net +218), tooling +0/-2 (net -2). Production growth is module-boundary imports and typed contracts for the split, not capability growth; all five production files pass the max-lines limit.