Repository navigation
fix(gateway): preserve chat metadata across UI prefs - #125636
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 1:50 AM ET / 05:50 UTC. ClawSweeper reviewWhat this changesThe PR changes Gateway chat metadata to retain the lifecycle-published model owner when only synchronized UI display preferences change. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessNo blocking findings. Current main still requires exact config equality for chat metadata’s owner lookup, so this maintainer-authored PR remains necessary to preserve model selection across display-only UI preference updates. Priority: P1 Review scores
Verification
How this fits togetherGateway chat startup metadata reads a lifecycle-published model catalog to provide selectable models to the Control UI. Config publications replace that catalog owner, while display preferences should not make an otherwise current owner disappear. flowchart LR
A[Control UI preference update] --> B[Gateway config state]
B --> C[Published model owner]
C --> D[Chat metadata lifecycle]
D --> E[Control UI model selection]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +51. Total +51 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep chat metadata on the published owner accessor and retain the existing replacement gate as the sole fence for real model or config turnover. Do we have a high-confidence way to reproduce the issue? Yes—source shows the exact-config lookup rejects the published owner after a UI-only config change, and the added integration scenario covers that state. Is this the best way to solve the issue? Yes—the published-owner accessor is the narrow lifecycle-owner fix, while existing publication invalidation still fences actual owner replacement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fc2529e22971. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready proof for Root cause: synchronized Architectural owner and canonical fix: the Gateway chat-metadata lifecycle now reads Local proof:
Sibling coverage: the focused suites cover early and late prepared-owner publication, chat-metadata/models-list availability convergence, auth publication and revocation, startup projection, and lifecycle refresh behavior around the repaired owner boundary. Observed behavior: in a real isolated Gateway + Control UI run, LOC: production +7/-7 (net 0); tests +55/-4 (net +51). Exact-head CI: Latest ClawSweeper review: no findings. Its only optional rank-up move was to wait for the remaining exact-head checks; satisfied by the green runs above. Known proof gap: one broad local |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where a display-only synchronized UI preference update could make chat metadata reject the still-current published model owner. New-session model selection then became unavailable even though direct model and command reads remained healthy.
Why This Change Was Made
Chat metadata now reads the lifecycle-published prepared model owner without requiring full-config equality. The existing replacement gate still fences real model/config owner turnover, so readers continue to fail closed while a genuine replacement is publishing. UI-side suppression and globally weakening prepared config matching were rejected because both would move or broaden the fix beyond the lifecycle owner boundary.
User Impact
Model selection remains available after changing synchronized display preferences. No Gateway restart or provider reconfiguration is required.
Evidence
node scripts/run-vitest.mjs src/gateway/server-chat-metadata-lifecycle.integration.test.ts src/gateway/server-methods/chat-metadata-runtime.test.ts— 30/30 tests passed on the rebased head.node scripts/check-changed.mjs -- src/gateway/server-chat-metadata-lifecycle.integration.test.ts src/gateway/server-methods/chat-metadata-runtime.tscompleted formatting, typechecks, lint, dead-code, dependency, and schema checks before the 10-minute outer harness limit. Its remaining runtime-sidecar-loader, import-cycle, webhook-auth body-order, pairing-store group-auth, and pairing account-scope guards were rerun individually and passed..claude/skills/autoreview/scripts/autoreview --mode branch --base origin/main— clean; no accepted/actionable findings.node --import tsx scripts/build-all.mts qaRuntimeandpnpm ui:buildpassed. A broader localpnpm buildattempt ended during declaration invocation 8/9 without a compiler diagnostic on a heavily loaded host; exact-head CI provides the authoritative full-build result.Proof Model Alphawas available before a realconfig.patchcommittedui.prefs.chatShowThinking=false; afterconfig.get, one config publication event, and a fresh chat metadata/startup read, the model remained available andModels unavailablenever appeared. The isolated state and processes were removed afterward.Initial model availability:
Final model availability after the synchronized preference commit:
interaction.webm