Skip to content

fix(ui): keep Inbox current during automation bursts - #137753

Merged
steipete merged 3 commits into
mainfrom
codex/team-opt-ui-20260904
Sep 4, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/team-opt-ui-20260904

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users watching the Control UI would generate overlapping automation-inventory requests and miss Inbox warnings when many automation events arrived while the Gateway was responding slowly. Twenty events during pending reads produced 21 concurrent cron.list requests and 21 cron.status requests, and could invalidate an independently loading model-auth warning.

Why This Change Was Made

The Inbox store now owns one in-flight inventory pair and one queued refresh for its current connection, profile, and agent scope. It publishes successful progress even while more events arrive, preserves previously valid values when either read fails, and only uses a fresh successful complete inventory to retire saved dismissals. A first page with more results cannot establish that a dismissed job is absent. Model-auth reads retain separate in-flight ownership and one trailing visibility/idle refresh. Each source has its own completion timestamp, so frequent automation activity cannot postpone an overdue auth refresh. Retired scopes cannot publish or drain queued requests.

User Impact

The Inbox remains current during bursts and sustained automation activity without multiplying Gateway requests. Slow automation reads no longer hide independently loaded auth warnings, failed reads retain useful attention, and stale results cannot overwrite a replacement connection or agent selection.

Evidence

  • The regression failed on the base in both unit and real Chromium tests: 20 events produced 21 requests per inventory method. The fix keeps one pair in flight and performs one trailing pair, reducing the completed finite-burst total from 42 cron requests to 4.
  • Focused store, Inbox, and attention-item tests: 54 passed. Coverage includes sustained invalidations, unsuccessful inventory reads, disabled-scheduler preservation, dismissal freshness, disconnect, client replacement, disposal, agent switching, independent model-auth publication, explicit auth freshness during slow requests, and auth refresh after frequent automation updates.
  • Real Chromium Control UI E2E: 12 passed across sidebar settings and agent attention scopes. The new scenario observes Gateway request counts and rendered Inbox content while a trailing inventory is deliberately held pending, then verifies another invalidation reaches the visible Inbox. A second scenario holds the first auth response across a visibility refresh, observes its warning while a trailing read is pending, then verifies the latest response removes it. It also proves fresh automation updates cannot suppress an overdue auth refresh. Expanded/collapsed presenters and Settings transitions remain covered.
  • Independent Codex autoreview through P2: scoped-clean on the final candidate after repairing sustained-event publication, queued auth freshness, and independent source completion clocks. The ClawSweeper auth finding and its rendered-Inbox regression request are addressed.
  • Changed-file validation passed contracts, formatting, core/UI types, and all unused-export scans, then caught six test-only no-promise-executor-return violations. The separate cleanup commit passed the lint rerun on all four paths, the remaining stylelint step, all 10 affected store tests, and a fresh P2 review. The auth follow-up additionally passed all-four-file formatting, lint and stylelint, UI production/test types, the 54-unit/12-browser suites, and a fresh full-candidate P2 review. The original wrapper result was a failure; this is explicit focused recovery.
  • Production delta: +83/-27, net +56 lines. Test delta: +509/-27, net +482 lines. Production growth owns the previously missing inventory/auth request lifecycles independent source freshness, and the distinction between publishable progress and authoritative dismissal retirement.
  • No config, database, migration, protocol, public API, provider, or dependency changes. Browser proof uses the real Control UI build and Chromium with a deterministic mocked Gateway; it does not claim a measured production latency improvement.
node scripts/run-vitest.mjs ui/src/components/sidebar-attention-store.test.ts ui/src/components/sidebar-attention.test.ts ui/src/components/sidebar-attention-items.test.ts
OPENCLAW_CAPTURE_UI_PROOF=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/sidebar-settings.e2e.test.ts ui/src/e2e/sidebar-attention-scope.e2e.test.ts
env -u OPENCLAW_TESTBOX node scripts/check-changed.mjs -- ui/src/components/sidebar-attention-store.ts ui/src/components/sidebar-attention-store.test.ts ui/src/components/sidebar-attention.test.ts ui/src/e2e/sidebar-settings.e2e.test.ts

| Inbox before burst fix | Inbox after burst fix |

@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: M maintainer Maintainer-authored PR labels Sep 4, 2026
@steipete
steipete marked this pull request as ready for review September 4, 2026 01:29
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. 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 Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 12:05 AM ET / 04:05 UTC.

ClawSweeper review

What this changes

The PR serializes Control UI Inbox cron and model-auth refreshes so automation bursts do not create overlapping Gateway requests or hide current warnings.

Regression provenance

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

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open for normal landing: source review found no introduced correctness defect, but this maintainer-authored, maintainer-labeled PR still has queued and in-progress exact-head checks.

Priority: P2
Reviewed head: 473751ec1028d316cfa4caede1f85dcf75ea3e30

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-consistent concurrency repair with meaningful boundary coverage; exact-head CI is still pending.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; the PR body nevertheless supplies Chromium Inbox evidence, though its linked attachments could not be retrieved in this environment.
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 the author as a MEMBER, so the external-contributor proof gate does not apply; the PR body nevertheless supplies Chromium Inbox evidence, though its linked attachments could not be retrieved in this environment.
Evidence reviewed 6 items Refresh owner: The Inbox controller owns the event subscription and refresh lifecycle; cron events call the controller load path, which serializes a cron inventory pair and retains only one trailing request.
Lifecycle guards: The introduced loops publish only while the connection, client, profile, and agent scope remain current; unsuccessful cron reads retain the prior corresponding value.
Caller and callee boundary: Application bootstrap creates the app-lifetime Inbox store, while the cron loader catches request errors into owner state instead of rejecting the refresh pair.
Findings None None.
Security None None.

How this fits together

The Control UI Inbox turns Gateway cron inventory and model-auth status into visible attention entries. Gateway automation events and browser visibility changes request refreshes, which update the Inbox and its locally saved dismissals.

flowchart LR
  A[Automation and visibility events] --> B[Inbox attention store]
  B --> C[Serialized cron inventory refresh]
  B --> D[Serialized model-auth refresh]
  C --> E[Attention and dismissal reconciliation]
  D --> E
  E --> F[Control UI Inbox]
Loading

Before merge

  • Resolve merge risk (P1) - The bug fix adds net 56 production lines for concurrent-refresh ownership; this is justified by separate cron/auth lifecycles, but exact-head CI remains the landing gate.
  • Resolve merge risk (P1) - Reviewer limitation: promisor blobs and the linked browser screenshots could not be fetched because github.com DNS resolution failed, so current-main file content and attachment visuals were not independently inspected.
  • Complete next step (P2) - Wait for the queued and in-progress exact-head required checks to complete green before merging.
Agent review details

Security

None.

PR surface

Source +56, Tests +482. Total +538 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 83 27 +56
Tests 3 509 27 +482
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 592 54 +538

Review metrics

Metric Value Why it matters
Lifecycle implementation size production +56 net; tests +482 net The added production state implements separate cron and auth refresh ownership; the larger test delta covers concurrency, scope retirement, failures, and rendered Inbox behavior.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one controller-owned serialized refresh lifecycle for each source, retain the focused boundary coverage, and land only after the exact head’s required checks are green.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one controller-owned serialized refresh lifecycle for each source, retain the focused boundary coverage, and land only after the exact head’s required checks are green.

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

Yes, at source level: the previous path started a new cron inventory pair for every event, and the introduced regression tests model a pending pair followed by 20 events.

Is this the best way to solve the issue?

Yes: coalescing belongs in the app-lifetime Inbox controller, which owns both event invalidation and the state that must survive incomplete or failed reads.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded Control UI reliability repair for missed Inbox warnings during automation bursts.
  • 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 the author as a MEMBER, so the external-contributor proof gate does not apply; the PR body nevertheless supplies Chromium Inbox evidence, though its linked attachments could not be retrieved in this environment.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vyctor H. Brzezowski: 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 (2 earlier review cycles)
  • reviewed 2026-09-04T01:37:24.293Z sha cbc091e :: blocked before merge. :: [P2] Queue a trailing model-auth refresh
  • reviewed 2026-09-04T02:14:06.629Z sha e77a3ae :: blocked before merge. :: none

@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 4, 2026
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

The missed trailing auth refresh is fixed in e77a3aeb1636: visibility and idle refresh requests received during an in-flight load now schedule the needed follow-up. Auth and cron freshness also have independent completion times, so a cron response cannot make stale auth data appear fresh.

The final candidate passes 54 focused unit tests and 12 bundled Chromium cases, UI production/test typechecks, typed lint, formatting, and independent P2 review. The original synthetic automation burst still refreshes the Inbox without per-event reload amplification. This addresses the review's auth refresh finding and the related freshness race. Hosted CI for the exact final head remains required; the unrelated cold Browser-cleanup stall found in an earlier shard is being repaired separately with its own reproduction.

@steipete
steipete force-pushed the codex/team-opt-ui-20260904 branch from e77a3ae to 473751e Compare September 4, 2026 03:58
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed the branch onto main to include the existing Chrome MCP prewarm prerequisite for the browser CI job. The full patch is byte-identical: all four final files and 26 checked owner, harness, dependency and policy preimages are unchanged, and all three authored commits replayed without conflicts. Existing focused and Chromium proof remains applicable; the new exact-head CI run must still verify the browser, dependency and audit jobs.

@steipete steipete self-assigned this Sep 4, 2026
@steipete
steipete merged commit 7297799 into main Sep 4, 2026
129 checks passed
@steipete
steipete deleted the codex/team-opt-ui-20260904 branch September 4, 2026 04:52
@steipete

steipete commented Sep 4, 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 5, 2026
* fix(ui): keep Inbox current during automation bursts

* test(ui): avoid returning timer handles from executors

* fix(ui): preserve independent auth refresh freshness
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: 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