Skip to content

refactor(webui): drop gateway-version fallbacks per version-lock decision - #124971

Merged
steipete merged 5 commits into
mainfrom
steipete/webui-drop-gateway-version-fallbacks
Aug 17, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/webui-drop-gateway-version-fallbacks

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The chat pane carried a fallback stack for gateways that predate chat.metadata: when the method was un-advertised or failed, it silently substituted models.list {preparedOnly} and commands.list round-trips. That machinery dated from before the Control UI's deployment model was settled and imposed a permanent tax: every metadata-path change had to reason about a second execution path, and failures were masked by silent substitution instead of surfacing.

Why This Change Was Made

Product decision (owner, 2026-08-16), now recorded in ui/AGENTS.md ("Gateway Coupling", included in this PR): the Control UI ships from and with its Gateway — one install, one version. UI code never carries gateway-version compatibility; method-advertisement checks remain only as feature gates for config/plugin-dependent surfaces. Skew paths (ui:dev against a different install, custom gateway.controlUi.root, dialing another gateway via connection settings) are unsupported for version mismatch.

For the record, the fallback did protect a formerly-reachable window — v2026.5.12 gateways speak protocol 4 but lack chat.metadata — and that topology is what this decision declares unsupported.

Deleted: the chat.metadata/chat.startup advertisement branches in refreshChatMetadata/refreshPageChat, refreshMissingChatMetadata, refreshCompatibilityModelCatalog, refreshCompatibilityCommands, and their fallback-only test coverage. Failure semantics are now visible instead of silent: a chat.metadata rejection sets chatModelCatalogError (rendering the picker's existing error/retry affordance) while retaining any seeded catalog. A metadata result without commands keeps the built-in slash commands — commands.list runs the same server-side builder, so retrying it against the same failure is futile (inline-commented).

Verified live, not guessed: the commands.list lane in chat-commands.ts stays because it has a real non-compat caller (palette refresh via chat-pane-render.ts:514 → refreshChatCommands); models.ts stays untouched (live-discovery callers in chat picker-open, model-providers, config).

User Impact

None on the supported path — same-install UI/gateway pairs never entered the fallback. On the now-unsupported skew path, a missing method surfaces as a visible catalog error instead of silently degrading. Silent-failure elimination is the doctrine-preferred direction.

Evidence

Two regressions, each verified failing pre-change: chat.metadata rejection → chatModelCatalogError set, seeded catalog retained, and no models.list request issued; metadata without commands → no commands.list request, built-in slash commands active. Suites: focused 349 passed, broad UI 4,023 passed, composer e2e 24 passed; tsgo:ui + check:test-types clean (run on AWS Crabbox — Blacksmith CLI unavailable on the host); format/oxlint/assertion-ratchet/diff-check clean. Autoreview (Codex gpt-5.6-sol, high): clean, no actionable findings.

Production LOC +17/−90 (net −73); tests +28/−245; guidance +6.

No screenshots: the change deletes an invisible substitution path; the observable contract (no fallback requests, visible error state) is pinned by the request-count regressions.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete steipete self-assigned this Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 01:56
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 17, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 2:00 AM ET / 06:00 UTC.

ClawSweeper review

What this changes

The PR removes Control UI fallbacks to older Gateway chat methods and stops retrying a rejected browser build identity without its build ID.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The cleanup is coherent under the newly documented one-install policy, but it deliberately changes behavior for admission-exempt version-skew deployments. Keep this maintainer-owned PR open for an explicit product decision rather than treating the fallback removal as routine cleanup.

Priority: P1
Reviewed head: ec586942320d032d3b770030e8af5a59d23fd0fa
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and regression-tested; the remaining blocker is the deliberate compatibility-policy choice, not a code defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is outside the external-contributor proof gate; its focused tests provide supplemental behavior evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is outside the external-contributor proof gate; its focused tests provide supplemental behavior evidence.
Evidence reviewed 6 items Current main still has the removed compatibility behavior: Current main retries a rejected build identity without buildId and selects chat.history when chat.startup is unadvertised, so the PR remains necessary and is not implemented on main.
PR policy defines the compatibility boundary: The PR explicitly limits admission enforcement to bundled same-origin UI and declares dev, configured-root, and cross-origin skew unsupported without compatibility code.
Admission implementation has intentional exemptions: The Gateway returns no build mismatch for configured roots, dev builds, missing build IDs, and non-same-origin requests; its tests enumerate those cases.
Findings None None.
Security None None.

How this fits together

The Control UI browser connects to a Gateway, then loads startup history and metadata for the chat pane. This change makes incompatible Gateway behavior surface through the connection or chat error states instead of using older RPC paths.

flowchart LR
  A[Control UI browser] --> B[Gateway connection]
  B --> C[Build admission]
  C --> D[Chat startup]
  D --> E[Chat metadata]
  E --> F[Model picker and chat errors]
Loading

Decision needed

Question Recommendation
Should configured-root, development, and cross-origin Control UI deployments remain unsupported for Gateway version skew, with visible first-method failure rather than connect-time rejection or compatibility fallback? Accept the documented skew policy: Land the fallback removal and treat version-skew failures on exempt paths as unsupported, visible operator errors.

Why: Current Gateway admission intentionally exempts those paths, while this PR deletes their last client compatibility behavior; choosing connect-time enforcement would expand the product contract beyond this UI refactor.

Before merge

  • Resolve merge risk (P1) - Configured-root, development, and cross-origin connections can still be admitted to an older Gateway; after this PR they fail at the first missing method rather than using the removed compatibility path.
  • Complete next step (P2) - A maintainer must confirm the intentional compatibility boundary; there is no narrow mechanical repair to dispatch.
Agent review details

Security

None.

PR surface

Source -112, Tests -199, Docs +6. Total -305 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 5 22 134 -112
Tests 7 86 285 -199
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 114 419 -305

Review metrics

Metric Value Why it matters
Production versus test LOC production +21/-133; tests and test support +87/-286; guidance +6 The refactor is materially net-negative; compatibility policy, not code growth, is the merge-critical surface.
Compatibility paths 1 build-identity downgrade and 2 chat fallback families removed Existing skewed deployments lose recovery behavior even though the supported bundled path is unchanged.

Stored data model

Persistent data-model change detected: vector/embedding metadata: ui/src/e2e/chat-composer-catalog.e2e.test.ts, vector/embedding metadata: ui/src/pages/chat/chat-send.test.ts, vector/embedding metadata: ui/src/pages/chat/chat-state.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the documented coupling boundary (recommended)
    Merge with the explicit understanding that exempt skew deployments no longer receive compatibility behavior and may fail at their first unavailable RPC.
  2. Broaden admission before removal
    Pause this refactor and add server-side build admission for the currently exempt topologies if maintaining their compatibility is the desired product contract.

Technical review

Best possible solution:

Confirm the documented unsupported-skew policy, then retain one fallback-free Control UI path and keep any broader server-side admission expansion as a separately scoped product change.

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

Not applicable as a defect report: this is a policy-driven refactor, while the branch's focused request-count tests make the removed fallback behavior and replacement error states observable.

Is this the best way to solve the issue?

Unclear pending product confirmation: the implementation is the cleanest path if exempt version skew is intentionally unsupported, but connect-time enforcement is a separate valid product direction.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e84a45e28ecf.

Labels

Label justifications:

  • P1: This changes connection and chat-startup behavior for Control UI deployments that currently rely on older Gateway behavior.
  • merge-risk: 🚨 compatibility: The branch intentionally removes older-Gateway fallbacks and changes what existing skewed deployments observe.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is outside the external-contributor proof gate; its focused tests provide supplemental behavior evidence.

Evidence

What I checked:

  • Current main still has the removed compatibility behavior: Current main retries a rejected build identity without buildId and selects chat.history when chat.startup is unadvertised, so the PR remains necessary and is not implemented on main. (ui/src/api/gateway.ts:589, e84a45e28ecf)
  • PR policy defines the compatibility boundary: The PR explicitly limits admission enforcement to bundled same-origin UI and declares dev, configured-root, and cross-origin skew unsupported without compatibility code. (ui/AGENTS.md:40, ec586942320d)
  • Admission implementation has intentional exemptions: The Gateway returns no build mismatch for configured roots, dev builds, missing build IDs, and non-same-origin requests; its tests enumerate those cases. (src/gateway/server/ws-connection/control-ui-build-admission.ts:23, e84a45e28ecf)
  • Visible failure paths are covered: The PR's focused regressions require an unknown chat.startup method to set chat errors without chat.history, a metadata rejection to preserve the catalog and avoid models.list, and a build-ID rejection to avoid a downgrade retry. (ui/src/pages/chat/chat-gateway.test.ts:2884, ec586942320d)
  • Feature-history provenance: The current admission boundary and Control UI connection store date to the same recent Gateway refactor by Peter Steinberger. (src/gateway/server/ws-connection/control-ui-build-admission.ts:13, 81c203ade0e8)
  • Diff hygiene: The reviewed PR diff has no whitespace errors and is not contained by the checked-out main branch. (ec586942320d)

Likely related people:

  • steipete: Peter Steinberger authored the current build-admission and Gateway-store work and the reviewed branch's five commits. (role: introduced the current admission boundary and recent area contributor; confidence: high; commits: 81c203ade0e8, ec586942320d; files: src/gateway/server/ws-connection/control-ui-build-admission.ts, ui/src/app/gateway-store.ts, ui/src/api/gateway.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the documented treatment of configured-root, dev, and cross-origin version skew before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-08-17T02:03:08.761Z sha 063a996 :: found issues before merge. :: [P2] Remove the remaining chat.startup compatibility fallback
  • reviewed 2026-08-17T03:08:03.704Z sha 990a268144cd8f001a400a8613f32b426a221855 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T04:07:46.265Z sha 6011708f89f1d033622df18aa2e61632c34a407d :: needs changes before merge. :: [P2] Surface rejected branch-list requests
  • reviewed 2026-08-17T05:03:21.317Z sha 85a81a1 :: needs changes before merge. :: [P2] Make the handshake enforce the version lock
  • reviewed 2026-08-17T05:45:30.842Z sha abd3d80 :: found issues before merge. :: [P1] Enforce the version lock before deleting admitted-path fallbacks

@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the ClawSweeper P2 in 990a268144c.

  • loadChatHistory(..., { startup: true }) now always requests chat.startup; method advertisement no longer selects chat.history.
  • An unknown chat.startup method now follows the existing visible error path, with no silent chat.history retry. The retryable UNAVAILABLE startup-warming path remains unchanged because it is same-version startup resilience.
  • The sessions.branches.list advertisement check is also removed. It is unconditional core: src/gateway/methods/core-descriptors.ts:232, and :574-578 advertises all core descriptors unless advertise: false is explicit.
  • isUnknownGatewayMethodError lost its final consumer and was deleted.

The regression failed before the fix because the unknown-method case issued two requests; it now proves one chat.startup request, no chat.history request, and a surfaced error. Follow-up production delta is +1/-29; tests are +13/-20.

Proof: 9,368 tests passed across the requested UI/chat/composer targets; pnpm tsgo:ui, pnpm check:test-types, assertion-safety ratchet, touched-file format/oxlint, and autoreview are clean.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 17, 2026
@steipete
steipete force-pushed the steipete/webui-drop-gateway-version-fallbacks branch from 6011708 to 85a81a1 Compare August 17, 2026 04:57
@steipete

Copy link
Copy Markdown
Contributor Author

Stating the skip on the branch-list finding, with reasoning rather than a patch:

The proposed fix — routing an unsupported-method rejection through the chat-error path — would reintroduce exactly the version-conditional handling this PR removes under the ui/AGENTS.md "Gateway Coupling" rule. An older Gateway rejecting sessions.branches.list is the unsupported-skew topology by definition; there is no supported deployment where that rejection occurs.

On a supported same-version Gateway, sessions.branches.list failures are transient-class (startup warm-up, connectivity), and the existing catch is not a silent latch: it deliberately leaves chatBranchesSessionKey unset so the next history load retries — the inline comment at the catch documents that this exists precisely to avoid latching a transient failure into a permanently hidden branch dropdown. Escalating every transient branch-list failure into the chat error banner would demote a self-healing background refinement into a user-facing error for a surface (the branch picker) whose absence-in-the-moment is the designed degraded state with a recorded reason and a retry path.

If the concern is observability on the unsupported path, the connect-time protocol/build handshake is the designated gate for skew, not per-method error routing.

@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the ClawSweeper build-identity P2 in abd3d8085a6.

The browser-only clientBuildIdCompatibilityDisabled state and the retry-without-buildId branch are deleted. A configured build identity is now always sent, so a Gateway that rejects it surfaces through the visible connect failed path; the connect handshake now enforces the version lock required by the Control UI Gateway Coupling rule.

The inverted regression failed before the fix on connect retry. It now proves that the rejection surfaces as connect failed, no 250 ms downgrade retry occurs, and any normal reconnect still carries buildId. Follow-up production delta is +3/-14 (net -11); tests are +20/-13. The shared packages/gateway-client path is untouched because CLI clients legitimately dial older remote Gateways.

Proof: pnpm test ui/src/api passed 9,189 tests; pnpm tsgo:ui, pnpm check:test-types, touched-file format/oxlint, and autoreview are clean.

@clawsweeper clawsweeper Bot added the P1 High-priority user-facing bug, regression, or broken workflow. label Aug 17, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 17, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Stating the skip on the P1 with owner authority, plus one guidance fix it earned:

The finding reads "unsupported" as "must be enforced away at connect", but that is not the product decision this PR implements. The owner's explicit call (2026-08-16, this session's direction: "this is a product decision and simplifies everything") is the third option the finding's either/or omits: the exempted pairings (dev builds, configured controlUi.root, cross-origin dialing) are unsupported without enforcement — they carry no compat code, and a skewed pairing fails visibly at the first missing method (surfaced catalog error with retry, not silent substitution — the silent paths are exactly what this PR deleted). Retaining the compat behavior would revert the decision; adding connect-time rejection for those pairings is a server-side product change with real blast radius (reverse proxies and tunnel hostnames serve the same install under a different origin; ui:dev is a deliberate workflow) and is now tracked as a named follow-up for owner consideration rather than a rider on this UI deletion PR.

The finding did catch an over-claim in the new guidance wording — "the connect handshake is the only gate" implied the handshake catches every pairing. Fixed in this PR: ui/AGENTS.md now states precisely that the handshake rejects gateway-served same-origin skew, and that the admission-exempt paths fail visibly at first missing method by design, with connect-time tightening owned separately.

@steipete
steipete merged commit 84f342a into main Aug 17, 2026
265 of 267 checks passed
@steipete
steipete deleted the steipete/webui-drop-gateway-version-fallbacks branch August 17, 2026 06:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
…sion (openclaw#124971)

* refactor(webui): drop gateway-version fallbacks per version-lock decision

* refactor(webui): drop chat.startup history fallbacks

* test(webui): advertise full method catalog in terminal e2e scenarios

* refactor(webui): enforce the build-identity handshake at connect

* docs(webui): state exempted skew paths fail visibly by design
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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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