Skip to content

fix: background requests delay opening chats - #147845

Merged
steipete merged 2 commits into
mainfrom
codex/chat-startup-background-reads
Sep 14, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/chat-startup-background-reads

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #145679

What Problem This Solves

Fixes unnecessary startup work when opening a chat with saved sidebar filters or while other conversations are active.

User Impact

The conversation gets priority over automatic sidebar and automation-status refreshes. Explicit filter changes stay immediate, and messages can still queue while history loads without losing the next draft. No configuration or migration is required.

Why This Change Was Made

Use the existing connection bootstrap and after-paint hydration owners for restored filters, cron inventory, and optional platform information. Model catalogs now invalidate for the affected canonical conversation, including agent-qualified aliases. Same-conversation changes, global updates, and ambiguous scopes retain their freshness safeguards. Metadata-only refresh rules stay with the lazy metadata owner so they do not add eager startup code.

Evidence

  • 137 focused admission/lifecycle tests and 202 catalog, metadata, and alias tests pass. Regressions reproduced premature reads, unrelated catalog retirement, and a missed non-default-agent alias refresh.
  • The desktop browser regression fails on the unchanged baseline and passes on this candidate. It verifies deferred requests, early queued delivery, and preserved draft, focus, and selection. Mobile selection and composition checks also pass.
  • Independent P2 review and the complete changed-check plan pass, including core-test/UI types, i18n, export scans, lint, and formatting. The same-toolchain UI size comparison also passes the existing budgets.
  • These are synthetic behavior proofs; live load-time improvement remains unmeasured for this candidate.

The review concern about unmeasured live latency is acknowledged. The reproduced request-ordering defect and preserved interaction tests justify landing this bounded repair. Production latency remains a post-deployment acceptance check; no measured latency improvement is claimed for this candidate.

The screenshots show the same held-history flow, with a queued message still available. Request ordering is checked by the executable regression.

Before After
Queued message before startup scheduling repair Queued message after startup scheduling repair

@clawsweeper

clawsweeper Bot commented Sep 14, 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 14, 2026
@steipete
steipete marked this pull request as ready for review September 14, 2026 03:59
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 12:47 AM ET / 04:47 UTC (Revision 2).

ClawSweeper review

What this changes

Prioritizes opening Control UI chats over automatic sidebar, automation-status, and platform reads, and limits model-catalog invalidation to the affected conversation.

Merge readiness

✅ Ready for maintainer review

No blocking defect found. Current main still exhibits the targeted behavior, and the maintainer has explicitly addressed the prior latency-evidence concern.

Priority: P2
Reviewed head: a538f6e34eb836782ef5cfd97ba61dc2b7837a0b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage, inspected visual evidence, and no blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show preserved queued-message presentation, and the reported browser regression exercises deferred requests; neither establishes live latency improvement, which the maintainer explicitly acknowledges.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show preserved queued-message presentation, and the reported browser regression exercises deferred requests; neither establishes live latency improvement, which the maintainer explicitly acknowledges.
Evidence reviewed 8 items Current main still needs the repair: At the fetched main revision, restored owner filters call refresh immediately; the PR instead uses the existing background scheduler.
Current catalog invalidation remains broader: Fetched main retires saved model projections across the event's agent. The introduced change narrows valid session events to canonical conversation identity while retaining broad invalidation for ambiguous events.
Deferred work preserves lifecycle checks: Cron work rechecks connection, profile, agent scope, generation, and visibility before reads; header hydration uses the existing session and connection checks after transcript paint.
Findings None None.
Security None None.

How this fits together

The Control UI loads conversation history and supporting data through the Gateway. Its startup scheduler and scoped caches determine when background requests run and which conversation data needs refreshing.

flowchart TD
  A[Open conversation] --> B[Load history]
  B --> C[Transcript ready or failed]
  C --> D[Background scheduler]
  D --> E[Sidebar and automation refreshes]
  C --> F[Optional header hydration]
  G[Session change events] --> H[Invalidate matching conversation cache]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +40, Tests +253, Docs +3. Total +296 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 10 96 56 +40
Tests 6 256 3 +253
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 355 59 +296

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +40 lines; tests net +253 lines Production growth primarily handles scoped invalidation, while regression coverage checks ordering, aliases, and lifecycle boundaries.

Technical review

Best possible solution:

Keep foreground admission and conversation-scoped invalidation with their existing owners while preserving immediate explicit refreshes and saved preferences.

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

Yes, source establishes premature restored-filter reads and agent-wide catalog retirement; the supplied browser regression targets these conditions. This review did not execute a reproduction or measure live latency.

Is this the best way to solve the issue?

Yes. Reusing existing admission, hydration, and identity owners is a focused repair, with explicit refreshes and persisted settings preserved.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded chat-opening responsiveness repair with no demonstrated outage or lost messages.
  • 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 external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show preserved queued-message presentation, and the reported browser regression exercises deferred requests; neither establishes live latency improvement, which the maintainer explicitly acknowledges.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show preserved queued-message presentation, and the reported browser regression exercises deferred requests; neither establishes live latency improvement, which the maintainer explicitly acknowledges.

Evidence

What I checked:

  • Current main still needs the repair: At the fetched main revision, restored owner filters call refresh immediately; the PR instead uses the existing background scheduler. (ui/src/components/session-owner-filter-controller.ts:94, fe645cd77de7)
  • Current catalog invalidation remains broader: Fetched main retires saved model projections across the event's agent. The introduced change narrows valid session events to canonical conversation identity while retaining broad invalidation for ambiguous events. (ui/src/lib/chat/chat-metadata-cache.ts:89, fe645cd77de7)
  • Deferred work preserves lifecycle checks: Cron work rechecks connection, profile, agent scope, generation, and visibility before reads; header hydration uses the existing session and connection checks after transcript paint. (ui/src/components/sidebar-attention-store.ts:227, a538f6e34eb8)
  • Browser regression covers the changed ordering: The desktop case restores an existing involving-me filter, holds history, asserts no filtered sessions, cron, or platform requests, then checks their eventual dispatch and preservation of queued delivery, draft, focus, and selection. Tests were inspected, not executed during this read-only review. (ui/src/e2e/control-ui-route-readiness.e2e.test.ts:128, a538f6e34eb8)
  • Inspected screenshots and prior-review disposition: Both prepared before/after images were inspected and show the held-history queued-message state. They do not demonstrate request ordering or latency. The supplied complete PR body explicitly accepts synthetic ordering and interaction evidence for this bounded repair and retains production latency as post-deployment acceptance. The previous review lists no findings or rank-up moves. (a538f6e34eb8)
  • Existing scheduler ownership: Recent main history identifies repeated work on startup admission and catalog lifecycle. GitHub additionally verifies fix(ui): load selected chats before background session lists #146591 as merged at b023df8; its scheduler source and raw recorded parent's source were compared through read-only GitHub contents requests. (ui/src/app/connection-bootstrap.ts:52, b023df80868e)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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-14T04:06:47.725Z sha d09e0962128c03860b26136504a7ac15c77c0ebe :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/chat-startup-background-reads branch from d09e096 to a538f6e Compare September 14, 2026 04:30
@steipete
steipete merged commit e3d8d00 into main Sep 14, 2026
138 of 139 checks passed
@steipete
steipete deleted the codex/chat-startup-background-reads branch September 14, 2026 05:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 14, 2026
* commit 'e3d8d0078369b21223c70028c4502c89f1420897': (51 commits)
  fix: background requests delay opening chats (#147845)
  chore(i18n): refresh native locales (#147899)
  feat: start remote sessions without a repository (#147773)
  fix(slack): retire probe sockets after timeout (#147846)
  refactor(agents): share theme ANSI color encoding (#147838)
  improve(memory): bound vector recall decision counts (#147900)
  improve(browser): narrow dashboard lifetime rechecks (#147892)
  test(discord): compact lifecycle matrices (#147855)
  fix(agents): use exact model rows for harness support (#147849)
  test(agents): compact embedded lifecycle matrices (#147856)
  test(agents): compact embedded admission matrices (#147853)
  test(cli): compact node management matrices (#147854)
  feat(artifacts): select assistant-delivered files by run (#147682)
  improve: reduce event-loop work when recording prompts (#147876)
  fix: preserve readable generated image and video filenames (#147833)
  fix(ci): skip SDK rendering for identical revisions (#147572)
  fix: prevent false process failures and stalled background waits (#147871)
  fix(ui): restore live updates when retrying chat history (#147865)
  fix(ui): preserve text and image order in assistant replies (#147731)
  refactor(qa-lab): reuse approval result formatter (#147867)
  ...
obviyus added a commit that referenced this pull request Sep 14, 2026
Main fails its startup check: 362,012 B exceeds 361,938 B. Use the approved
1 KiB cap increase for scoped catalog invalidation (#147845), remote
workspaces (#147773), and update-status feedback (#147883). Deferring the new
workspace labels saved only 64 B and still failed at 361,952 B. Baseline
362,012 B; the 512 B growth and 64 B variance allowances are unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QnwfB1PDNraoifmaDYPBPJ
obviyus added a commit that referenced this pull request Sep 14, 2026
Main fails its startup check: 362,012 B exceeds 361,938 B. Use the approved
1 KiB cap increase for scoped catalog invalidation (#147845), remote
workspaces (#147773), and update-status feedback (#147883). Deferring the new
workspace labels saved only 64 B and still failed at 361,952 B. Baseline
362,012 B; the 512 B growth and 64 B variance allowances are unchanged.
obviyus added a commit that referenced this pull request Sep 14, 2026
AI-assisted.

## What Problem This Solves
Main fails its own structural checks, so every open PR is red: `check-lint-core-2` (the sidebar session-ownership test helper is over the 700-line rule since #147610), the chat transcript controller test (over the 1,000-line rule since #147612), and `control-ui-performance` (startup JS gzip 362,012 B exceeds the 361,938 B limit after #147845, #147773 and #147883).

## Why This Change Was Made
These repairs belong on main, in one PR.

- Lint: the avatar cases move from `session-ownership.ts` into a sibling case file in the directory's existing pattern (610 lines remain). Assertions and registration are unchanged.
- Chat lint: the four deferred-message-reveal cases move into a sibling test file. Their assertions, names and shared setup/cleanup remain unchanged, and the canonical test list preserves their isolated runner.
- Budget: the smallest whole-KiB cap step, 353 → 354 KiB, with the baseline refreshed to the measured 362,012 B. Deferring the new workspace labels saved only 64 B and still failed at 361,952 B, so a reduction was not available; the immediate Home and diagnostic frames stay intact. Follows #147574 and #146526.

## User Impact
None. No product behavior or asset changes.

## Evidence
- Lint: the max-lines check fails on main and passes here; 426 sidebar tests pass.
- Chat lint: pinned main fails at 1,010 counted lines; the candidate merge passes the same lint rule. All 146 affected chat tests pass, including the four moved cases in the isolated runner. The local preflight and test-root partition checks pass.
- Budget: same-toolchain comparison, last passing source 361,718 B, main 362,016 B (+298 B), fresh main and this candidate both 362,012 B (0 B asset delta). `pnpm ui:check-performance:base <main>` fails before the policy refresh and passes afterward. 552 focused tests pass.

## Compatibility
Cap 353 → 354 KiB; baseline 362,012 B; the 512 B growth and 64 B variance allowances are unchanged.

## Consumers
The performance check and the build size report read the same policy; the sidebar test suite registers the moved cases from the new file, and both UI test runners retain isolated chat-test registration.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
* fix(ui): prioritize opening chats over background reads

* perf(ui): keep metadata refresh policy lazy
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
AI-assisted.

## What Problem This Solves
Main fails its own structural checks, so every open PR is red: `check-lint-core-2` (the sidebar session-ownership test helper is over the 700-line rule since openclaw#147610), the chat transcript controller test (over the 1,000-line rule since openclaw#147612), and `control-ui-performance` (startup JS gzip 362,012 B exceeds the 361,938 B limit after openclaw#147845, openclaw#147773 and openclaw#147883).

## Why This Change Was Made
These repairs belong on main, in one PR.

- Lint: the avatar cases move from `session-ownership.ts` into a sibling case file in the directory's existing pattern (610 lines remain). Assertions and registration are unchanged.
- Chat lint: the four deferred-message-reveal cases move into a sibling test file. Their assertions, names and shared setup/cleanup remain unchanged, and the canonical test list preserves their isolated runner.
- Budget: the smallest whole-KiB cap step, 353 → 354 KiB, with the baseline refreshed to the measured 362,012 B. Deferring the new workspace labels saved only 64 B and still failed at 361,952 B, so a reduction was not available; the immediate Home and diagnostic frames stay intact. Follows openclaw#147574 and openclaw#146526.

## User Impact
None. No product behavior or asset changes.

## Evidence
- Lint: the max-lines check fails on main and passes here; 426 sidebar tests pass.
- Chat lint: pinned main fails at 1,010 counted lines; the candidate merge passes the same lint rule. All 146 affected chat tests pass, including the four moved cases in the isolated runner. The local preflight and test-root partition checks pass.
- Budget: same-toolchain comparison, last passing source 361,718 B, main 362,016 B (+298 B), fresh main and this candidate both 362,012 B (0 B asset delta). `pnpm ui:check-performance:base <main>` fails before the policy refresh and passes afterward. 552 focused tests pass.

## Compatibility
Cap 353 → 354 KiB; baseline 362,012 B; the 512 B growth and 64 B variance allowances are unchanged.

## Consumers
The performance check and the build size report read the same policy; the sidebar test suite registers the moved cases from the new file, and both UI test runners retain isolated chat-test registration.

Co-authored-by: Ayaan Zaidi <[email protected]>
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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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