Skip to content

fix(ui): reject blank required strings in Control UI update readers - #124264

Merged
vyctorbrzezowski merged 2 commits into
mainfrom
brzezowski/update-dto-canonical
Aug 15, 2026
Merged

vyctorbrzezowski merged 2 commits into
mainfrom
brzezowski/update-dto-canonical

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Aug 15, 2026 •

Copy link
Copy Markdown
Member

Fixes #124232

Reworked after review. The first revision of this PR hand-rolled a closed-key-set decoder that mirrored the canonical schema. Review rejected that approach, and the review was right: it was a second contract, and it had already drifted in two ways of its own. This revision deletes it. See "What changed after review" below.

What Problem This Solves

The Control UI update readers accept "" for fields the canonical protocol declares as NonEmptyString. UpdateAvailableSchema requires non-empty currentVersion, latestVersion, and channel (packages/gateway-protocol/src/schema/config.ts:72-76, via NonEmptyString at packages/gateway-protocol/src/schema/primitives.ts:24), but ui/src/app/update-schedule-dto.ts only checked typeof x === "string". An operator could be shown an update banner with blank version text built from a payload the protocol itself considers invalid.

The same gap repeated on the schedule root, the package/git schedule targets, and the campaign id, and the file was inconsistent with itself: readGitInstallMetadata enforced non-emptiness while readScheduleTarget did not.

Why This Change Was Made

The fix is at the boundary that owns the invariant, using the protocol's own dependency-free primitive:

  • Required NonEmptyString fields now reject the payload when blank, via isNonEmptyProtocolString (packages/gateway-protocol/src/protocol-value-normalization.ts). That module has zero imports, so it is safe for the Control UI startup graph.
  • Optional NonEmptyString fields are now dropped when blank rather than discarding the whole payload. A missing currentSha renders fine; a blanked overlay does not.
  • Repeated Number.isInteger(x) && Number(x) >= n chains collapse into one isBoundedInteger helper, which also removes the Number(...) re-casts.

Deliberately not done: re-deriving the canonical schema in the browser. Three independent reasons, each verified against source rather than assumed:

1. Closed-object checking is a producer-side contract, and enforcing it client-side breaks additive tolerance. closedObject sets additionalProperties: false, and the only place that runs against these schemas at runtime is the Gateway validating its own outbound result (src/gateway/server-methods/update.ts:203-207). The hello.snapshot path the UI actually reads has no compiled validator at all — HelloOkSchema is exported but never compiled. Meanwhile the protocol is additive-first (AGENTS.md; docs/gateway/clients.md:237-243), its own guards "intentionally allow additive payload fields" (packages/gateway-protocol/README.md:78-80), and an additive field does not move PROTOCOL_VERSION, so the 4..4 handshake cannot catch it. The Control UI is service-worker cached, so an already-open document keeps an older bundle across a Gateway upgrade (ui/src/app/sw-refresh.runtime.ts:18-21) — older-UI/newer-Gateway is a routine transient state, not a hypothetical. A client-side closed check would turn every additive field into a silently blank update overlay. Every other snapshot/event decoder in the Control UI does tolerant field extraction; GatewayHelloOk even re-types snapshot as unknown on purpose (ui/src/api/gateway.ts:102-106).

2. The canonical maxLength cannot be hand-copied. typebox 1.3.6 measures minLength/maxLength in grapheme clusters (node_modules/typebox/build/guard/string.mjs, IsMaxLength over NextGraphemeClusterIndex), while String#length counts UTF-16 code units. So the previous subject.length <= 120 check rejected commit subjects the canonical schema accepts:

100 emoji     | .length = 200 | Value.Check = true | .length <= 120 = false
20 family ZWJ | .length = 220 | Value.Check = true | .length <= 120 = false

That bound is producer-side hygiene, so it is now gone rather than approximated. This is the concrete reason a hand-written mirror of the schema is not viable at all: it silently diverges on the rules that are hardest to notice.

3. typebox cannot enter this module. update-schedule-dto.ts is statically reachable from the entry point (main.ts → app-host.ts → sidebar-update-card.ts → update-overlay-helpers.ts → here), so it is inside the measured startup graph. The UI's existing Value.Check callers (ui/src/lib/tasks/data.ts, task-summary.ts) sit behind route-level dynamic imports and are not measured — the constraint comments say "startup bundle" precisely, and they are correct.

User Impact

Operators no longer see an update banner or schedule state with blank version text. Payloads from a newer Gateway carrying additive fields keep rendering instead of silently disappearing, and commit subjects containing emoji are no longer dropped.

Evidence

Regression proof (fails before, passes after). New boundary cases were run against three trees:

Tree Result
main (8f807ae912d) 6 failed, 15 passed — includes all three blank-required-string cases, the Unicode subject case, and blank-optional handling
first revision of this PR (400183a4a59) 4 failed, 17 passed — additive-field tolerance, Unicode subject, blank-optional, per-entry commit filtering
this revision 21 passed
  • LC_ALL=en_US.UTF-8 node scripts/run-vitest.mjs ui/src/app/update-overlay-helpers.test.ts — 21 passed.
  • LC_ALL=en_US.UTF-8 node scripts/run-vitest.mjs ui/src/app/overlays.test.ts ui/src/app/overlays-update-campaign.test.ts ui/src/app/overlays-update-race.test.ts ui/src/app/update-confirmation.runtime.test.ts ui/src/app/update-success-notice.test.ts ui/src/pages/config/updates.test.ts — 92 passed across the consuming surfaces.
  • node scripts/check-changed.mjs -- ui/src/app/update-schedule-dto.ts ui/src/app/update-overlay-helpers.test.ts — exit 0: UI typecheck, core test typecheck, lint, i18n catalog, dead-export scan, formatting.
  • .claude/skills/autoreview/scripts/autoreview --mode uncommitted — clean, no accepted/actionable findings.

Bundle budget. The startup gate is scripts/check-control-ui-performance.mts, ratcheted against config/control-ui-startup-budget-baseline.json (startupJsGzipBytes: 334391, cap 350 KiB, tolerance 1056 B → effective limit 335,447 B). This change adds no import to the startup graph: isNonEmptyProtocolString comes from an already-reachable zero-dependency module, and ui/package.json / packages/gateway-protocol/package.json are untouched.

For the record, importing typebox here was measured rather than asserted. Bundling Value.Check(UpdateAvailableSchema, …) with esbuild (--bundle --minify --format=esm --platform=browser) produces 38,697 B gzip — about 37x the 1,056 B of headroom, and well past the 4,096 B-per-step ratchet. That matches the precedent in packages/gateway-protocol/src/schema/session-placement-state.ts, whose comment records a prior incident where pulling the protocol barrel into startup took the bundle to 395 KiB against a 370 KiB budget.

Drift protection. Production no longer carries a copy of the schema to drift, so drift is pinned where it costs nothing: update-overlay-helpers.test.ts imports the canonical schemas and asserts the one direction that matters — every canonical-valid fixture must satisfy Value.Check and round-trip through the reader unchanged. If a schema change outgrows the reader, that fails in CI.

What changed after review

Review finding Disposition
+159 production LOC duplicating the canonical schema Fixed by deletion. isClosedRecord and all eight KeySet constants are gone. Production is now net −7 lines against main (+91 / −98), down from +159.
Rejects valid Unicode Fixed. Traced to subject.length <= 120 vs typebox's grapheme-cluster maxLength; verified in typebox source and reproduced. The producer-side bound is removed, with a regression test using a 100-emoji subject.
Accepts prototype-named keys (key in keys) Moot — the closed check is gone. A test still pins that __proto__ / constructor / toString wire keys neither reach the result nor pollute Object.prototype.
Breaks additive protocol tolerance Fixed. Verified the protocol's additive contract; closed-object rejection was wrong for a client decoder. A regression test asserts an unknown future field still renders.
Merge risk: stricter payload handling lacks upgrade-path proof Largely withdrawn. The only payloads now rejected are ones with blank required strings, which could not render meaningfully anyway. Additive and unknown-key payloads that the first revision would have rejected now render.

One follow-up spotted while reading and not fixed here, since it belongs to a different owner: scripts/check-control-ui-performance.mts:386-394 — --update-baseline without --startup-js-bytes writes the locally measured value and skips validateExplicitStartupJsBytes, so the 4096 B ratchet only guards the CI-measured path.

Second round: restored commit cap, CI diagnosis

ClawSweeper P2 — five-entry commit bound. The rework above switched
readUpdateAvailableValue's commit handling from all-or-nothing rejection to
per-entry filter().map(), and that dropped the existing rawCommits.length <= 5 bound along with it. The canonical schema still caps commits at 5
entries (commits: Type.Array(UpdateCommitSchema, { maxItems: 5 }),
packages/gateway-protocol/src/schema/config.ts:80), and the Updates page
renders every entry this reader returns, so an out-of-contract payload past
the cap could grow into an unbounded rendered list. Fixed by slicing to a
named MAX_COMMITS = 5 after filtering, so a malformed entry still doesn't
hide the rest of the list (unchanged tolerant behavior) but the render bound
holds regardless of how many valid-looking entries a producer sends. Added
caps commits at five entries even when every entry is valid in
update-overlay-helpers.test.ts (8-entry payload, asserts .slice(0, 5)).

CI: checks-ui-e2e (2/12) failure was unrelated CI flake, not this diff.
The run at push time failed
ui/src/e2e/session-management.sidebar.e2e.test.ts > "retains the selected
session and one observer while reconnecting across route changes"
(expect.poll timeout waiting for sidebar row text to read "Selected
session recovered";
https://github.com/openclaw/openclaw/actions/runs/31908289886/job/95069436970).

Checked whether this diff could plausibly affect it: this PR only touches
ui/src/app/update-schedule-dto.ts and its test. The only importers of
update-schedule-dto.ts are update-overlay-helpers.ts (and its test) and
overlays.ts; the failing test never references sessions/update overlays and
its mocked sessions.list/sessions.subscribe fixtures carry no
updateAvailable/updateSchedule snapshot data, so the changed code path
cannot execute in that test. Confirmed via git diff --stat $(git merge-base origin/main HEAD) HEAD that the PR touches exactly those
two files.

Checked for a same-window CI flake pattern instead: this happened during the
same evening CI window as
#124290, an open P1 documenting
ui/src/e2e/agent-file-lifecycle.e2e.test.ts failing with the identical
"Matcher did not succeed in time." shape across three unrelated PRs
(#124253, #124256, #124257) that don't touch the failing path either. One of
those occurrences (PR #124257, shard 10/12,
https://github.com/openclaw/openclaw/actions/runs/31908362789) ran in the
same CI run as another unrelated checks-ui-e2e shard failure
(config-safe-write.e2e.test.ts, shard 6/12, same run), and a fourth
unrelated PR in the same window
(https://github.com/openclaw/openclaw/actions/runs/31908722207, shard
11/12) failed a new-session-page.prompt-attachments.e2e.test.ts assertion.
Four different checks-ui-e2e test files failed across four unrelated PRs
in the same short CI window, none of them importing or exercising this PR's
diff — consistent with shared-runner timing flakiness in the mocked-Gateway
E2E matrix that evening rather than a regression from this change.

Reran the failed job: gh run rerun 31908289886 --failed.

Gates (this round)

  • LC_ALL=en_US.UTF-8 node scripts/run-vitest.mjs ui/src/app/update-overlay-helpers.test.ts — 22 passed (was 21; +1 new cap test).
  • node scripts/check-changed.mjs -- ui/src/app/update-schedule-dto.ts ui/src/app/update-overlay-helpers.test.ts — exit 0: UI/core typecheck, lint, i18n catalog, dead-export scan, formatting.
  • oxfmt — no changes needed on either file.
  • .claude/skills/autoreview/scripts/autoreview --mode uncommitted — clean, no accepted/actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 15, 2026
@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review August 15, 2026 19:44
@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 15, 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 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 15, 2026, 5:09 PM ET / 21:09 UTC.

ClawSweeper review

What this changes

The PR changes Control UI update-state readers to reject blank required protocol strings, tolerate additive fields, and add protocol-parity regression coverage.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked by patch quality or review findings - 4 items remain

This PR remains necessary: current main still accepts blank required update fields. The revised approach fixes that boundary, but it newly removes the five-commit UI bound, allowing an out-of-contract payload to render an unbounded list; keep it open for that focused repair and UI proof.

Priority: P2
Reviewed head: d76b08e73fb59122f8aa4f3c2e8ab70fd0f403f4

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 6 items Current-main defect remains: The checked-out PR base accepts empty currentVersion, latestVersion, and channel values; a no-output diff from the base to current main for both touched files confirms this remains current-main behavior.
Protocol contract: The update schemas require non-empty version/channel strings and cap commits at five entries.
Introduced unbounded list: The PR head filters and maps every commit entry without retaining the existing five-item guard.
Findings 1 actionable finding [P2] Restore the five-entry update commit bound
Security None None.

How this fits together

Gateway hello snapshots, update events, and update-status responses feed Control UI readers that normalize update metadata before the sidebar and Updates page render it. The readers must preserve useful forward-compatible data without allowing malformed payloads to create invalid or unbounded UI state.

flowchart LR
  A[Gateway update payload] --> B[Hello, event, or status response]
  B --> C[Control UI update reader]
  C --> D[Required-field and list bounds]
  D --> E[Normalized update state]
  E --> F[Sidebar banner]
  E --> G[Updates commit list]
Loading

Before merge

  • Restore the five-entry update commit bound (P2) - The new tolerant filter().map() accepts every valid-looking commit, but the protocol and existing reader cap this field at five. Since the Updates page renders every normalized entry, an out-of-contract payload can now create an unbounded DOM list. Retain the five-entry guard before filtering and cover a six-entry payload.
  • Resolve merge risk (P1) - Merging would replace the existing five-entry guard with an unbounded normalized commit list, and the Updates page renders every accepted entry.
  • Complete next step (P2) - The protected maintainer label keeps this in human review despite the narrow code repair; restore the bound and add visible proof before reconsidering merge.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P2] Restore the five-entry update commit bound — ui/src/app/update-schedule-dto.ts:53-61
Agent review details

Security

None.

PR surface

Source -7, Tests +182. Total +175 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 91 98 -7
Tests 1 184 2 +182
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 275 100 +175

Review metrics

Metric Value Why it matters
Production versus test LOC production −7, tests +182 The bug fix is net-negative in production, while the added regression coverage needs one case for the removed five-entry safety bound.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #124232
Summary: This PR is the candidate implementation for the linked canonical Control UI update-reader defect; it needs one bounded correction before it can resolve that issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Restore the commit-list bound (recommended)
    Keep the existing five-entry cardinality guard before per-entry filtering and add a regression for six valid-looking commits.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve the five-entry update commit bound, add a six-entry regression, and attach redacted Control UI proof showing the bounded rendered list.

Technical review

Best possible solution:

Retain the non-empty-string repair and additive tolerance, but restore a five-entry bound before normalizing commits and prove the bound in a running Control UI.

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

Yes — source inspection shows a six-entry payload reaches the PR reader's unbounded filter/map path and the Updates page renders every normalized entry; no test was run in this read-only review.

Is this the best way to solve the issue?

No — the required-string fix is sound, but the best repair must retain the existing five-entry UI safety bound while keeping the intended per-entry tolerance.

Full review comments:

  • [P2] Restore the five-entry update commit bound — ui/src/app/update-schedule-dto.ts:53-61
    The new tolerant filter().map() accepts every valid-looking commit, but the protocol and existing reader cap this field at five. Since the Updates page renders every normalized entry, an out-of-contract payload can now create an unbounded DOM list. Retain the five-entry guard before filtering and cover a six-entry payload.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 availability: The PR removes the cap that prevents a malformed update payload from expanding into an unbounded rendered commit list.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review merge-risk labels are merge-risk: 🚨 availability.

Label justifications:

  • P2: This is a bounded Control UI validation regression with a concrete rendering impact, not an emergency runtime outage.
  • merge-risk: 🚨 availability: The PR removes the cap that prevents a malformed update payload from expanding into an unbounded rendered commit list.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Current blame attributes the update reader, protocol normalization helper, and rendered update list to the same recent implementation. (role: recent area contributor; confidence: high; commits: 0134c781cd1f; files: ui/src/app/update-schedule-dto.ts, packages/gateway-protocol/src/protocol-value-normalization.ts, ui/src/pages/config/updates.ts)
  • vyctorbrzezowski: A prior merged update-UI repair establishes independent history in this feature area beyond this PR. (role: prior update UI contributor; confidence: medium; commits: e7ba2e1f6b1f; files: ui/src/app/update-overlay-helpers.ts)
  • Peter Steinberger: Recent merged work added dev checkout commit-lag presentation, the UI surface affected by the restored commit bound. (role: adjacent update feature contributor; confidence: medium; commits: b4cedfd40e35; files: ui/src/pages/config/updates.ts, src/infra/update-startup.ts)

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 (1 earlier review cycle)
  • reviewed 2026-08-15T20:21:47.733Z sha 400183a :: needs changes before merge. :: [P2] Reject only own allowed keys

The Control UI update readers accepted `""` for fields the canonical
UpdateAvailableSchema/UpdateScheduleStateSchema declare as NonEmptyString,
so a malformed Gateway payload rendered an update banner with blank
version text.

Root cause is the reader treating "is a string" as the contract for
fields whose canonical contract is "is a non-empty string". Fixed at that
boundary with the protocol's own dependency-free `isNonEmptyProtocolString`
primitive: required NonEmptyString fields now reject the payload when
blank, and optional ones are dropped rather than discarding the whole
payload.

Deliberately does NOT re-derive the canonical schema in the browser:

- `additionalProperties: false` is a producer-side contract the Gateway
  enforces on its own outbound results (src/gateway/server-methods/update.ts).
  Rejecting unknown keys client-side would turn every additive protocol
  field into a blank overlay, since a service-worker-cached document keeps
  an older bundle across a Gateway upgrade.
- Canonical `maxLength` counts grapheme clusters (typebox 1.3.6
  guard/string.mjs), so the previous `subject.length <= 120` copy dropped
  valid emoji subjects the schema accepts. The bound is producer-side and
  is gone rather than approximated.
- typebox itself stays out of this module: it is in the Control UI startup
  graph, which has a hard gzip budget (scripts/check-control-ui-performance.mts).

Drift is now pinned in tests instead of duplicated in production: the
boundary suite runs fixtures through both the reader and Value.Check over
the canonical schemas, asserting that anything the schema accepts still
reaches the overlay.

Production LOC: net -7 against main.
@vyctorbrzezowski
vyctorbrzezowski force-pushed the brzezowski/update-dto-canonical branch from 400183a to d76b08e Compare August 15, 2026 21:01
@vyctorbrzezowski vyctorbrzezowski changed the title fix(ui): enforce canonical update DTO validation at the Control UI boundary fix(ui): reject blank required strings in Control UI update readers Aug 15, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 15, 2026
readUpdateAvailableValue's per-entry filter/map dropped the existing
five-commit bound while switching from all-or-nothing rejection to
tolerant filtering. The canonical schema caps commits at 5
(packages/gateway-protocol/src/schema/config.ts), and the Updates
page renders every entry this reader returns, so the cap is the
protocol's own render-side contract, not extra strictness. Slice to
MAX_COMMITS after filtering and cover an eight-entry valid payload.
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Restored the five-entry commit bound: filtering keeps dropping single malformed entries, but the result now slices to MAX_COMMITS = 5 after filtering, matching the canonical maxItems: 5 cap. Added a regression covering an eight-entry valid payload.

On the red checks-ui-e2e (2/12) job: unrelated to this diff. That shard failed session-management.sidebar.e2e.test.ts's reconnect-across-routes test on an expect.poll timeout; this PR only touches update-schedule-dto.ts and its own test, and nothing in that test's path imports or exercises the DTO reader. Same evening CI window has three other unrelated PRs hitting the identical timeout shape in different checks-ui-e2e shards/tests (see #124290 and its linked runs), so this reads as shared-runner timing flake, not a regression. Reran the failed job; details and evidence in the PR body.

New head: ed117af.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vyctorbrzezowski
vyctorbrzezowski merged commit 1db8fe4 into main Aug 15, 2026
174 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the brzezowski/update-dto-canonical branch August 15, 2026 22:47
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…penclaw#124264)

* fix(ui): reject blank required strings in Control UI update readers

The Control UI update readers accepted `""` for fields the canonical
UpdateAvailableSchema/UpdateScheduleStateSchema declare as NonEmptyString,
so a malformed Gateway payload rendered an update banner with blank
version text.

Root cause is the reader treating "is a string" as the contract for
fields whose canonical contract is "is a non-empty string". Fixed at that
boundary with the protocol's own dependency-free `isNonEmptyProtocolString`
primitive: required NonEmptyString fields now reject the payload when
blank, and optional ones are dropped rather than discarding the whole
payload.

Deliberately does NOT re-derive the canonical schema in the browser:

- `additionalProperties: false` is a producer-side contract the Gateway
  enforces on its own outbound results (src/gateway/server-methods/update.ts).
  Rejecting unknown keys client-side would turn every additive protocol
  field into a blank overlay, since a service-worker-cached document keeps
  an older bundle across a Gateway upgrade.
- Canonical `maxLength` counts grapheme clusters (typebox 1.3.6
  guard/string.mjs), so the previous `subject.length <= 120` copy dropped
  valid emoji subjects the schema accepts. The bound is producer-side and
  is gone rather than approximated.
- typebox itself stays out of this module: it is in the Control UI startup
  graph, which has a hard gzip budget (scripts/check-control-ui-performance.mts).

Drift is now pinned in tests instead of duplicated in production: the
boundary suite runs fixtures through both the reader and Value.Check over
the canonical schemas, asserting that anything the schema accepts still
reaches the overlay.

Production LOC: net -7 against main.

* fix(ui): restore the five-entry cap on tolerant commit filtering

readUpdateAvailableValue's per-entry filter/map dropped the existing
five-commit bound while switching from all-or-nothing rejection to
tolerant filtering. The canonical schema caps commits at 5
(packages/gateway-protocol/src/schema/config.ts), and the Updates
page renders every entry this reader returns, so the cap is the
protocol's own render-side contract, not extra strictness. Slice to
MAX_COMMITS after filtering and cover an eight-entry valid payload.
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: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use canonical update schemas at the Control UI trust boundary

1 participant