Skip to content

perf(ui): coalesce cron event refresh requests - #138065

Merged
steipete merged 1 commit into
mainfrom
codex/team-opt-cron-events-20260904
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/team-opt-cron-events-20260904

Conversation

@steipete

@steipete steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users viewing Automations would send another status and run-history request for every cron event while earlier reads were still pending. Busy automations could build up redundant Gateway work whose results were immediately discarded.

Why This Change Was Made

The existing cron request owners now combine compatible page refreshes into one pending read and one trailing reread. Successful responses remain visible during sustained events; changed filters, selected jobs, pagination, manual Refresh, and explicit mutation reads keep their existing supersession behavior. Page replacement retires refresh work without canceling an already accepted create-and-run action.

User Impact

Automations stays current during event bursts while issuing fewer redundant reads. Retired page responses cannot populate a replacement page. No configuration, protocol, or persistent-state changes are required.

Evidence

A real Chromium flow with a synthetic Gateway, on a baseline that includes the landed Sidebar refresh fix, held reads while delivering 20 cron events. The baseline grew from 1 to 21 run-history requests and from 2 to 22 total status requests. This change kept the pending counts at 1 and 2, then completed at 2 history and 4 total status requests after release; the completed synthetic run was visible. Status totals include the page and Sidebar owners. This measures request amplification, not deployed server latency.

303 focused owner and sibling tests pass, including sustained progress, first/last failure ordering, immediate manual Refresh, filter and pagination replacement, reconnect/unmount, retired results, and create-and-run completion through navigation. The production UI build and bundle budgets pass. The focused Chromium regression fails on the baseline and passes with the change.

The normal changed gate passed all 16 core test type graphs, UI types, global guards, and dead exports, then stopped on four lint findings. After a mechanical test split and redundant type-argument removal, fresh UI types, all 303 tests, type-aware lint, and styles pass. The production runtime is identical to the Chromium-tested candidate after type stripping. Independent P2 review found no actionable findings.

The exact tested baseline is 7297799. Main b456aa1 retains all four patch preimages and the relevant cron/page/deferred contracts; the three added files remain absent. This is source qualification of the same candidate, not a new runtime measurement. Production is +74/-15 (net +59) for active-read and trailing-refresh ownership; tests/support are +816/-317 including moved tests.

The following screenshots show the same held-read phase before and after the change. The visible state is intentionally unchanged; the recorded RPC counts above establish the reduction.

The captures are byte-identical, so both labels reuse the same uploaded image.

Before:

Before: Automations during held event reads

After:

After: Automations during held event reads

@clawsweeper

clawsweeper Bot commented Sep 4, 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: XL maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 4:18 AM ET / 08:18 UTC.

ClawSweeper review

What this changes

The Automations page combines overlapping event-driven status and run-history reads, retires queued refreshes when the page changes, and adds regression coverage.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused performance fix: current main still issues redundant reads during cron event bursts. No blocking introduced defect was found.

Priority: P2
Reviewed head: d9959404875e45c0cde9897ca9057cb01778d531

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with useful regression coverage and no blocking correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies a MEMBER-authored PR, so the contributor proof gate does not apply. The captured body reports Chromium exercising the Automations refresh owners against a synthetic Gateway, with bounded request counts and visible completion; this is not deployed-server latency evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies a MEMBER-authored PR, so the contributor proof gate does not apply. The captured body reports Chromium exercising the Automations refresh owners against a synthetic Gateway, with bounded request counts and visible completion; this is not deployed-server latency evidence.
Evidence reviewed 10 items Verified introduced scope: The merge-base-to-head diff contains the seven supplied UI paths. The test merge has the exact recorded base and head parents, and its versions of all seven paths match the reviewed head.
Still necessary on current main: Current main calls refreshCron for every cron event; status reads dispatch immediately and run-history reads supersede earlier requests without combining them. The two production modules and shared deferred helper are unchanged between the tested baseline and fetched main.
Request ownership and completion: Status requests track the active client and request; run-history requests retain exact query ownership. Compatible events share one queued completion, while explicit reads remain immediate and finish independently of subsequent event refreshes.
Findings None None.
Security None None.

How this fits together

The Automations page receives scheduler events from the Gateway and requests current jobs, scheduler status, and run history. Its refresh owners decide which responses may update the displayed page.

flowchart TD
  A[Scheduler events] --> C[Automations refresh owner]
  B[Manual refresh and actions] --> C
  C --> D{Compatible read pending?}
  D -->|Yes| E[Queue one trailing read]
  D -->|No| F[Request Gateway data]
  E --> F
  F --> G[Update current page]
  H[Page or connection changes] -->|Retire queued reads| C
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +59, Tests +499. Total +558 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 2 74 15 +59
Tests 5 816 317 +499
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 890 332 +558

Review metrics

Metric Value Why it matters
Production versus test growth Production net +59; tests/support net +499, excluding pure moves from net growth Production growth supplies active-status and trailing-read ownership; the larger test diff includes relocated fixtures and lifecycle cases.
Reported request amplification 20 held events: history requests 21 → 1; total status requests 22 → 2 The supplied Chromium measurement directly targets redundant requests; status totals include the separate Sidebar owner.

Technical review

Best possible solution:

Keep refresh ownership in the existing cron loaders; distinct query identities and independent mutation completion justify the additional lifetime state.

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

Yes, from source: hold status and history responses while delivering repeated cron events to the Automations page; current main dispatches another pair per event. This review did not execute the reproduction.

Is this the best way to solve the issue?

Yes. Query-aware coalescing belongs at the read owners; transport-wide deduplication cannot distinguish event refreshes from explicit reads, and a page-wide debounce would delay unrelated progress.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This reduces redundant Gateway work while users view busy Automations pages, without evidence of an urgent outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies a MEMBER-authored PR, so the contributor proof gate does not apply. The captured body reports Chromium exercising the Automations refresh owners against a synthetic Gateway, with bounded request counts and visible completion; this is not deployed-server latency evidence.

Label justifications:

  • P2: This reduces redundant Gateway work while users view busy Automations pages, without evidence of an urgent outage.
  • 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: Repository State identifies a MEMBER-authored PR, so the contributor proof gate does not apply. The captured body reports Chromium exercising the Automations refresh owners against a synthetic Gateway, with bounded request counts and visible completion; this is not deployed-server latency evidence.

Evidence

What I checked:

  • Verified introduced scope: The merge-base-to-head diff contains the seven supplied UI paths. The test merge has the exact recorded base and head parents, and its versions of all seven paths match the reviewed head. (a366ef5931e5)
  • Still necessary on current main: Current main calls refreshCron for every cron event; status reads dispatch immediately and run-history reads supersede earlier requests without combining them. The two production modules and shared deferred helper are unchanged between the tested baseline and fetched main. (ui/src/pages/cron/cron-page.ts:123, 79e20aa5d1fd)
  • Request ownership and completion: Status requests track the active client and request; run-history requests retain exact query ownership. Compatible events share one queued completion, while explicit reads remain immediate and finish independently of subsequent event refreshes. (ui/src/lib/cron/index.ts:1494, d9959404875e)
  • Lifecycle and mutation boundary: Page reset invalidates queued reads before replacing state. GatewayPageController invokes reset for connection/source changes and unmount; accepted create-and-run actions retain their existing mutation chain. Regression coverage checks these boundaries and replacement-page isolation. (ui/src/pages/cron/cron-page.ts:134, d9959404875e)
  • Sibling implementations: Job-list loading already queues a trailing reload, channel status already avoids overlapping equivalent reads, and the Sidebar independently coalesces its inventory pair. The Sidebar change associated with fix(ui): keep Inbox current during automation bursts #137753 is present on main but does not cover Automations page reads. (ui/src/components/sidebar-attention-store.ts:224, 7297799493f1)
  • Transport contract and dependency boundary: The browser client delegates to this repository's Gateway client, whose pending-request owner allocates and sends each request separately. It does not supply query-aware coalescing. The changed path uses OpenClaw's shared deferred helper and has no affirmative Codex runtime or protocol dependency. (packages/gateway-client/src/pending-request.ts:62, d9959404875e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • AGI ASI: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit 407a8f4 into main Sep 4, 2026
132 checks passed
@steipete
steipete deleted the codex/team-opt-cron-events-20260904 branch September 4, 2026 15:25
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 4, 2026
…9-prep

* commit '407a8f453c0f0306af1ddc0aafa8697c1d49a9e7': (312 commits)
  perf(ui): coalesce automation event refreshes (#138065)
  fix: reject incomplete Skill Workshop directory reads (#138082)
  test(ui): decouple rendering checks from generated wording (#138283)
  perf: avoid temporary entries in bounded JSON traversal (#138017)
  fix(irc): render complete messages before splitting (#138328)
  perf: prepare worker trajectory payloads only for recorded events (#138086)
  fix(mcp): paginated listings no longer time out after a forward clock step (#137206)
  fix(codex): page native transcripts and bound UI previews (#136282)
  feat(gateway): apply more settings without restarting (#138112)
  fix(docs): preserve mirrored ClawHub maturity links (#138241)
  fix(test): own UI animation and legacy database setup (#138296)
  fix(tts): preserve literal directives in Markdown code (#138319)
  fix: load chat widgets behind authenticated gateways (#138074)
  chore(ui): cover native approval finalization (#137259)
  fix(cron): cancel conditions before main-session handoff (#138313)
  fix(backup): preserve text after embedded NUL characters (#138327)
  fix(android): align composer control sheets (#137442)
  fix(ci): wait for replacement PR runs instead of stale failures (#138307)
  fix(sessions): keep Gateway responsive with long transcripts (#138094)
  fix(computer): map window inputs to delivered image coordinates (#138271)
  ...

# Conflicts:
#	scripts/release-check.ts
#	test/release-check.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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