Skip to content

fix(ui): stop automation refreshes in hidden tabs - #140097

Merged
steipete merged 3 commits into
mainfrom
codex/ui-cron-hidden-refresh-20260906
Sep 6, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/ui-cron-hidden-refresh-20260906

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users leaving the Automations page open in a background tab would continue generating scheduler-status, automation-list, and run-history requests. Refreshes queued before hiding the tab could also dispatch later.

Why This Change Was Made

The page now decides whether all three refresh loaders may dispatch, including their queued continuations. Returning to the tab requests one coalesced catch-up through the existing refresh flow. Accepted saves, runs, and configuration-conflict recovery keep their existing behavior.

User Impact

Hidden Automations tabs avoid unnecessary Gateway work. Returning to the tab refreshes the current selection while preserving filters and unsaved drafts. There are no new settings, dependencies, database changes, or protocol changes.

Evidence

  • Original-code Blacksmith proof reproduced hidden-mount/event traffic, queued refreshes dispatching after hiding, and unnecessary readbacks after an accepted create-and-run action.
  • Corrected head 948e937c5392: targeted lint and 274 focused tests across five files passed, covering queue completion, hidden mount/reconnect, Gateway replacement, retained filters/drafts, accepted create-and-run, conflict recovery, and existing lifecycle behavior.
  • All three Chromium mocked-Gateway scenarios passed. The new scenario held page-specific inventory/history requests at one each while hidden, then observed exactly one additional request each after visibility and focus events. Visibility is controlled synthetically; this is not a production latency measurement.
  • Exact-head CI passed: 89 successful jobs, 12 skipped jobs, no failures, including the real-Gateway UI E2E lane.
  • Full check:changed passed on the same head, including all 16 core-test type graphs, UI types, i18n, coercion/dead-export guards, and changed-file lint/styles. Independent P2 review and the current ClawSweeper review have no actionable findings.

The first browser attempt lacked Playwright's matching video encoder; installing its pinned FFmpeg asset made the complete browser file pass. CI also caught four test-only lint findings, which were fixed without changing production behavior.

The captures below show the same synthetic page while hidden and after catch-up. This change affects request scheduling, so its visible layout stays unchanged.

Synthetic Automations page while document visibility is hidden

The same page after one coalesced catch-up on return

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 12:29
@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 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 8:54 AM ET / 12:54 UTC.

ClawSweeper review

What this changes

The Automations page pauses scheduler, task-list, and run-history refreshes in hidden tabs and catches up on return while preserving drafts and submitted operations.

Merge readiness

✅ Ready for maintainer review

Keep open: the fix remains useful against pinned main, and no actionable introduced defect was found. The prior review had no findings, and this maintainer-authored PR is protected from cleanup closure.

Priority: P2
Reviewed head: 948e937c53922e6c0b3619cf9c2037e56bf581f0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with meaningful lifecycle coverage and no actionable correctness or security findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-author exemption applies. Inspected coverage exercises CronPage and its loaders with mocked Gateway traffic and synthetic Chromium visibility; the captured body reports candidate validation in progress, not completed real-runtime proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-author exemption applies. Inspected coverage exercises CronPage and its loaders with mocked Gateway traffic and synthetic Chromium visibility; the captured body reports candidate validation in progress, not completed real-runtime proof.
Evidence reviewed 7 items Current main still admits hidden refreshes: Pinned main checks connection availability but not document visibility in initial loading and refreshCron; its status loader likewise has no page admission guard.
Visibility and lifecycle ownership: The page installs admission on each replacement CronState and requests catch-up only on a hidden-to-visible transition. The existing GatewayPageController registers and removes visibility/focus listeners with the host lifecycle.
Queued reads and submitted mutations remain separate: All three read loaders check admission before dispatch, including recursive queued continuations. Save, run, and exact-job conflict recovery retain their mutation requests; only their background readbacks are gated.
Findings None None.
Security None None.

How this fits together

The Control UI’s Automations page reads scheduler status, jobs, and run history from the Gateway. Page visibility now controls refresh admission, including queued reads, while submitted mutations retain their existing execution flow.

flowchart TD
  A[Gateway events and initial load] --> C[Page refresh admission]
  B[Browser visibility changes] --> C
  C -->|Hidden| D[Skip background reads]
  C -->|Visible| E[Coalesced Gateway reads]
  E --> F[Status jobs and run history]
  G[Submitted saves and runs] --> H[Existing mutation flow]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +18, Tests +331, Docs +1. Total +350 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 2 26 8 +18
Tests 3 331 0 +331
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 358 8 +350

Review metrics

None.

Technical review

Best possible solution:

Keep visibility admission at the page boundary and reuse the existing coalesced loaders without resetting drafts or interrupting submitted operations.

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

Yes, from source: a connected Automations page on pinned main dispatches cron-event refreshes and queued continuations without checking visibility; runtime reproduction was not executed.

Is this the best way to solve the issue?

Yes. The patch reuses the existing activation and coalescing mechanisms and gates read dispatch at its owner without adding another refresh system.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 897013c73351.

Labels

Label justifications:

  • P2: Unnecessary hidden-tab Gateway requests are a bounded performance and lifecycle problem.
  • 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: The maintainer-author exemption applies. Inspected coverage exercises CronPage and its loaders with mocked Gateway traffic and synthetic Chromium visibility; the captured body reports candidate validation in progress, not completed real-runtime proof.

Evidence

What I checked:

  • Current main still admits hidden refreshes: Pinned main checks connection availability but not document visibility in initial loading and refreshCron; its status loader likewise has no page admission guard. (ui/src/pages/cron/cron-page.ts:243, 897013c73351)
  • Visibility and lifecycle ownership: The page installs admission on each replacement CronState and requests catch-up only on a hidden-to-visible transition. The existing GatewayPageController registers and removes visibility/focus listeners with the host lifecycle. (ui/src/pages/cron/cron-page.ts:84, 948e937c5392)
  • Queued reads and submitted mutations remain separate: All three read loaders check admission before dispatch, including recursive queued continuations. Save, run, and exact-job conflict recovery retain their mutation requests; only their background readbacks are gated. (ui/src/lib/cron/index.ts:432, 948e937c5392)
  • Focused regression coverage inspected: Tests cover hidden mount/reconnect, queued completions before and after return, replacement Gateways, retained filters/drafts, and an accepted create-and-run chain. The Chromium scenario uses synthetic document visibility and mocked Gateway responses; no tests were executed during this read-only review. (ui/src/pages/cron/cron-page.visibility.test.ts:37, 948e937c5392)
  • Re-review continuity: The supplied completed-review projection contains no findings or published rank-up moves. Comparing its reviewed head with this head shows no changes to either production file. (ui/src/pages/cron/cron-page.ts, 948e937c5392)
  • Area-history routing: Current-main history identifies Peter Steinberger’s coalesced refresh work and Ayaan Zaidi’s catalog-refresh work as relevant routing context. Missing historical blobs prevented exact-line blame verification, so these are routing candidates without introduction claims. (ui/src/pages/cron/cron-page.ts, 897013c73351)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-06T12:40:00.566Z sha 813b5b9 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit a80e23c into main Sep 6, 2026
136 of 137 checks passed
@steipete
steipete deleted the codex/ui-cron-hidden-refresh-20260906 branch September 6, 2026 13:10
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
* fix(ui): pause automation refreshes in hidden tabs

* test(ui): tighten hidden cron refresh lifecycle coverage

* test(ui): fix hidden refresh test lint
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 docs Improvements or additions to documentation 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: M 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