Repository navigation
perf(config): retain model catalogs across preference writes - #169253
Conversation
Keep prepared model projections and resolved secrets across UI-only config publications while retaining source provenance and credential revision checks. Use compact config.patch acknowledgments for preference synchronization, and preserve the existing full-response and config-storage contracts. Separate source comparison from secret state and hashless patch intent from the config RPC handler; retain the existing activation and write owners.
|
🦞👀 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 retains prepared model catalogs and resolved secrets across UI preference writes and adds optional compact config.patch acknowledgments. Example: Toggle chatShowToolCalls six times with two prepared fixture providers.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored optimization remains useful, the prior findings are resolved, and no new actionable defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherControl UI preference writes enter the Gateway config owner, which persists and activates configuration before model and secrets consumers decide whether their prepared state remains reusable. flowchart TD
A[Control UI preferences] --> B[Config RPC owner]
B --> C[Existing persistence and activation]
C --> D[Model generation facts]
C --> E[Secrets snapshot owner]
D --> F[Prepared model catalogs]
B --> G[Canonical draft acknowledgment]
Technical reviewBest possible solution: Retain the existing persistence, activation, and draft-coordination owners while reusing prepared state only when its relevant inputs remain unchanged. Do we have a high-confidence way to reproduce the issue? Current-main source shows preference publications invalidating model projections, and the PR reports a failing baseline Gateway regression; no target code was executed during this review. Is this the best way to solve the issue? The change addresses invalidation at the existing owners, preserves credential and generation checks, and restores the established canonical acknowledgment path for editable drafts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 072f977edd46. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +164, Tests +250, Docs +12, Other -1. Total +425 across 32 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel 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 (3 earlier review cycles)
Reviewed October 11, 2026, 4:58 PM ET / 20:58 UTC (Revision 4). |
Return only display-change eligibility from the source helper and retain snapshot cloning in the state owner. This removes the type-only import cycle reported by CI without changing credential checks or publication behavior.
Use the prepared catalog's scoped currentness contract for native rows too. A second raw config-identity check marked retained native models unavailable after an equivalent or display-only config publication. Align the model, startup, and schema cache assertions with display-only retention while preserving model/plugin invalidation and native revocation.
Preference writes share the Settings draft coordinator, which needs the canonical config and revision to replay edits made after dispatch. Restore that receipt while skipping the redundant post-write config.get. Keep summary replies opt-in for callers without an editable config draft. Cover the real preference writer and coordinator with an in-flight edit.
The preference writer intentionally stopped re-reading config after each acknowledged patch in #169253 (9310023). The contrast and offline reconnect proofs still awaited that removed request, leaving 26 appearance cases and one reconnect case red before their user-visible assertions could finish. Wait for the canonical config/hash receipt, verify offline intent retires, and retain every contrast, picker, selection, and reconnect assertion. Assert the write does not introduce another config.get. No production change. Record the synchronization lesson for the Solid migration. Proof: 27/27 theme and 8/8 reconnect E2E cases; directory unit 2/2; preference receipt owner regression 1/1; UI and UI E2E TypeScript, targeted lint/format and assertion safety pass; independent review has no findings. Original dark/accent and reconnect cases pass at 9310023^; current main reproduces all 26 contrast timeouts on Testbox and the reconnect timeout locally. Testbox lease tbx_01m4pmkzs0ds18awd1msf1yp6a stopped after proof. Both base and head build. Startup gzip is 422214 B / 422221 B, two CSS requests each. Strict performance has the identical inherited chat-boot request violation (36 > 35). Theme E2E wall time 45.62 s; reconnect 28.87 s.
…w#169253) * perf(config): retain model catalogs across preference writes Keep prepared model projections and resolved secrets across UI-only config publications while retaining source provenance and credential revision checks. Use compact config.patch acknowledgments for preference synchronization, and preserve the existing full-response and config-storage contracts. Separate source comparison from secret state and hashless patch intent from the config RPC handler; retain the existing activation and write owners. * fix(secrets): keep source contracts independent of runtime state Return only display-change eligibility from the source helper and retain snapshot cloning in the state owner. This removes the type-only import cycle reported by CI without changing credential checks or publication behavior. * fix(models): retain native availability across preference writes Use the prepared catalog's scoped currentness contract for native rows too. A second raw config-identity check marked retained native models unavailable after an equivalent or display-only config publication. Align the model, startup, and schema cache assertions with display-only retention while preserving model/plugin invalidation and native revocation. * fix(ui): retain preference acknowledgments for pending settings Preference writes share the Settings draft coordinator, which needs the canonical config and revision to replay edits made after dispatch. Restore that receipt while skipping the redundant post-write config.get. Keep summary replies opt-in for callers without an editable config draft. Cover the real preference writer and coordinator with an in-flight edit.
The preference writer intentionally stopped re-reading config after each acknowledged patch in openclaw#169253 (d997a96). The contrast and offline reconnect proofs still awaited that removed request, leaving 26 appearance cases and one reconnect case red before their user-visible assertions could finish. Wait for the canonical config/hash receipt, verify offline intent retires, and retain every contrast, picker, selection, and reconnect assertion. Assert the write does not introduce another config.get. No production change. Record the synchronization lesson for the Solid migration. Proof: 27/27 theme and 8/8 reconnect E2E cases; directory unit 2/2; preference receipt owner regression 1/1; UI and UI E2E TypeScript, targeted lint/format and assertion safety pass; independent review has no findings. Original dark/accent and reconnect cases pass at d997a96^; current main reproduces all 26 contrast timeouts on Testbox and the reconnect timeout locally. Testbox lease tbx_01m4pmkzs0ds18awd1msf1yp6a stopped after proof. Both base and head build. Startup gzip is 422214 B / 422221 B, two CSS requests each. Strict performance has the identical inherited chat-boot request violation (36 > 35). Theme E2E wall time 45.62 s; reconnect 28.87 s.
Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (#143372, #143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (#128222, #128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (#134943, #169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (#85645). The Phase E standalone session memory backend and its tests are untouched.
* refactor(gateway): consolidate reply and worker preparation paths Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (#143372, #143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (#128222, #128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (#134943, #169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (#85645). The Phase E standalone session memory backend and its tests are untouched. * refactor(gateway): consolidate dispatch and trusted result projections * refactor(workers): trust admitted preparation facts
…2342) * refactor(gateway): consolidate reply and worker preparation paths Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (openclaw#143372, openclaw#143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (openclaw#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (openclaw#128222, openclaw#128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (openclaw#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (openclaw#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (openclaw#134943, openclaw#169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (openclaw#85645). The Phase E standalone session memory backend and its tests are untouched. * refactor(gateway): consolidate dispatch and trusted result projections * refactor(workers): trust admitted preparation facts
What Problem This Solves
Toggling a Control UI preference rebuilt the prepared model-list projection for every client and re-resolved unrelated secrets.
User Impact
Preference writes keep model catalogs and resolved credentials ready. Clients without an editable config draft can request a compact acknowledgment. The Control UI keeps the canonical receipt needed to preserve concurrent Settings edits, without a redundant config.get. Preferences remain in
ui.prefs; ordinary config clients retain the existing full response, validation, and activation behavior.Why This Change Was Made
Model projections now compare a publication-prepared key excluding UI values and the writer's version stamp. It retains other runtime/source values and resolution provenance, including real model-policy migration markers. Config-stamped readers retain their existing model generation identity. Native availability uses the same scoped currentness check, so a second raw object-identity guard cannot mark retained rows unavailable.
Secret preparation reuses its current resolved snapshot only for UI-only changes with unchanged environment, credentials, auth snapshots, and provenance. Explicit secret refresh still resolves providers. Compact replies skip the restart sentinel for no-op reload plans, and those plans retain schema metadata. The existing persistence and activation owners are unchanged.
Source comparison and hashless-patch intent move into small sibling modules; the config handler and secret state owner shrink. The acknowledgment type moves to its existing shared contract owner, and a retired mock-baseline entry is removed through the generator. No compatibility exports remain at the old locations.
Non-test diff: 276 additions, 113 deletions (net +163, including one retired baseline entry). Growth preserves the public full-response contract alongside the opt-in summary and the credential/environment/provenance checks required for secret reuse. It adds no config option, storage format, or dependency. The two formerly growing oversized production owners now shrink by 8 and 15 lines respectively.
Evidence
Same-host AWS synthetic Gateway measurement, six preference toggles, two fixture providers with small catalogs, and canonical model migration markers already present:
models.listconfig.patchThe small-fixture patch latency did not improve materially: durable full-document persistence remains. Opt-in summary reply size fell 82%, and model projections stay prepared. The Control UI uses the full receipt because its shared Settings draft needs canonical config and revision together; it skips the redundant post-write read. These are synthetic measurements, not production p99 claims; no live deployment was changed.
cbx_9cc8148cd99f: old code fails the actual Gateway regression with six projection rebuilds; candidate passes. A broader focused run passed 398 tests across 17 files before the mechanical extraction.tbx_01m4nwtb7334ft46phnr8j9ww9: final extracted code passed 245 product tests across 14 files in 237.01 s, withnode scripts/run-vitest.mjs <focused files> --maxWorkers=1. This covers config RPCs, model-list reuse, source/credential ownership, startup/reload behavior, and UI acknowledgment consumers. The moved source-contract cases take 1 ms and 3 ms within the 7.56 s secrets shard and introduce no new Gateway boot.cbx_d3f9c0708d69run passed the corrected mock guard, 13 secret-method tests, formatting, strict line-count checks, and production type checking. The broader type gate stopped on seven inherited Activity/Usage JSX declaration errors; this branch was then rebased onto their existing fix,b5a9b9b41c34. Final exact-head PR CI validated the combined source.38161588818caught a type-only import cycle introduced by the extraction. The repair makes the helper a pure eligibility predicate and keeps cloning in the state owner. Blacksmith Testboxtbx_01m4p30241ms7jk7ben00hz411verified zero runtime and Madge cycles, production types, 62 focused tests (108.62 s wrapper wall), and 20 closure tests (19.24 s).38165402604exposed old schema/startup/model cache expectations. The updated cases verify retained catalogs and explicit model/plugin invalidation, and retain native disposal, registry, and generation-revocation coverage. Native availability had a second object-identity guard; it now shares the catalog currentness predicate.Validation recovered from one Testbox source-sync timeout by using the authorized AWS fallback. The first measured fixture also performed a real model-policy migration; the final fixture starts with canonical migration markers so it tests only display changes. A stale catalog-error mutation in the unit fixture was separated from the display-only assertion. The inherited subagent dead-export finding was resolved by rebasing onto its existing main fix, without copying its commit.
Final follow-up on AWS Crabbox
cbx_f91a706a39ee:node scripts/run-vitest.mjs <nine focused files> --maxWorkers=1passed 137 tests in 143.30 s.node scripts/check-changed.mjs --base 38317acdbe6a06cbb1ac9cb651455c4bdd23aac8 -- <four follow-up files>passed all guards, production/test types, lint and dead exports in 894.45 s. The explicit base matches the reviewed pre-repair head; the runner'sorigin/mainwas a different revision. An interrupted earlier AWS run was discarded.The UI follow-up restores canonical acknowledgment adoption through the existing coordinator. A Settings edit made during a pending preference write previously kept hash-1 instead of hash-2; the regression fails on the old writer and the repaired writer preserves both the preference and Settings edit without another config.get. Blacksmith Testbox
tbx_01m4pafexaz8bezfdze8jnxz1vpassed 202 tests across 12 UI files in 27.33 s. The focused tests plus five-file changed gate completed in 800.04 s; the separate documentation gate passed in 26.23 s.Final CI run 38173877153 passed on
eff8e704eaaea3dc6a53e29e14614944d386d620: 767 s elapsed and 14,935 s summed reported job durations (including setup/cleanup, not a CPU or billing estimate). Both required checks passed. ClawSweeper reviewed this same head with no actionable findings; all earlier findings are resolved. Merged as9310023551cd7c8987096e9936eee77db9e69d1c. Moving preferences away from full config persistence would be a separate storage-contract change.