Skip to content

fix(ui): load selected chats before background session lists - #146591

Merged
steipete merged 5 commits into
mainfrom
codex/prioritize-chat-startup
Sep 13, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/prioritize-chat-startup

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Automatic sidebar rosters, catalog discovery, and Swarm reads can compete with a selected chat's startup on a busy Gateway. This change lets the selected transcript and composer become usable before those background reads finish.

User Impact

Session events remain subscribed during startup. Explicit refreshes, filters, pagination, and retries stay available, and automatic reads resume after the selected transcript succeeds, fails visibly, or is left by navigation. Empty conversations also release background work correctly.

Why This Change Was Made

The connection coordinator owns admission; session, catalog, and pane owners retain their own pending work. The primary roster uses one queue for explicit actions, automatic hydration, and current agent selection. Each automatic successor obtains fresh admission, including when another chat is selected during an active read. Event registration uses acknowledgement-only subscription followed by separately admitted roster hydration. Model-picker catalog completion and cloud placement failure cleanup invalidate the existing roster query. This preserves selected filters and a held bootstrap instead of replacing them with an unscoped or pane-derived query. Cloud recovery keeps its visible error and explicit Retry.

Removing early roster reads exposed lifecycle assumptions that are repaired at their owners. The selected descriptor refreshes independently on global runner-availability changes, preserving newer facts against stale startup responses. Cache eviction retires cache readers without resetting a successfully loaded transcript; explicit session reset keeps its existing behavior. Background outbox wakeups preserve a failed transcript's visible Retry action, and reconnect reconciliation retains the terminal receipt for the exact owned run. Routed descriptor projections carry the producing event revision while retaining read provenance, so a valid live update survives an older invalidated descriptor read. Failed child refreshes retain visible rows and an explicit Retry without keeping a stale loaded marker.

Skill Workshop English now loads with its existing lazy editor consumers. The complete composed English catalog is byte-identical, and eager navigation labels remain available.

This preserves the managed child-query lifecycle, pagination, provenance, and explicit retry from #146410. No Gateway protocol or configuration changes are required.

Evidence

The earlier published candidate passed 69 bundled browser cases across startup priority, owner-first hydration, reconnect recovery, sidebar stability, identity links, cloud placement/reload, runner freshness, loading deadlines, and Skill Workshop. The startup cases verify an authoritative selected transcript, selected-message subscription, live peer message, and editable draft while bulk replies are held. The runner test rejects an invalidated descriptor reply and later stale startup without losing the visible current row.

152 primary roster/observation tests, 138 cache/history/prefetch tests, and 108 Skill Workshop tests pass. Regressions were demonstrated failing before their repairs. The combined CI repair passes 323 tests across ten catalog, bootstrap, selection, placement recovery, sidebar, and observation files, plus all ten bundled cloud-dispatch, startup-priority, and model-picker browser cases present on this branch. The picker-control fixture correction also passes a 163-test paired run without unhandled errors. Eight regression cases fail before their catalog or recovery repair and pass afterward; catalog coverage includes settled and competing filtered queries plus a scoped bootstrap held behind selected history. The production build passes the unchanged startup-size gate at 354,194 gzip bytes across 8 JavaScript requests (limit: 355,719 bytes). Independent P2 review found no actionable findings in the complete published candidate and in the complete nine-file CI repair and the final picker fixture correction.

Exact-head CI passed on 769d29e85eeb, including all 56 real-Gateway cases in 28 files. Its first attempt had one Canvas-heading timeout; the exact merge passed a Linux replay with the same prebuilt setup, system Chromium, and both overlapping sibling suites, followed by a successful unchanged-head CI rerun. The original timeout remains unattributed; test deadlines and assertions were unchanged.

The following synthetic captures show pending and completed transcript states while bulk replies remain held. They demonstrate request ordering and usable chat, not a production latency benchmark.

Selected chat startup pending:

Selected chat startup pending

Selected transcript, live peer message, and editable draft ready while bulk replies remain held:

Selected chat usable while background list replies remain held

@clawsweeper

clawsweeper Bot commented Sep 13, 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: XL maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 00:29
@steipete steipete changed the title fix(ui): load selected chats before background task lists fix(ui): load selected chats before background session lists Sep 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 1:35 AM ET / 05:35 UTC (Revision 4).

ClawSweeper review

What this changes

The Control UI prioritizes the selected chat over automatic session lists, preserves refresh and recovery behavior, and loads Skill Workshop translations with its lazy views.

Merge readiness

✅ Ready for maintainer review

This remains useful work beyond current main. The earlier subscription finding is resolved, and the latest fixture-only update introduces no actionable defect.

Priority: P2
Reviewed head: 769d29e85eebb7ce9d5c9bee209f8a42cadc4b3e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent implementation with relevant browser captures, focused regression coverage, and no remaining actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The supplied MEMBER association exempts this PR from contributor setup proof. Inspected synthetic browser captures demonstrate selected-chat content and a populated composer; the associated scenario checks request ordering, without claiming production latency.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER association exempts this PR from contributor setup proof. Inspected synthetic browser captures demonstrate selected-chat content and a populated composer; the associated scenario checks request ordering, without claiming production latency.
Evidence reviewed 7 items Review continuity: The previous reviewed head differs only in the model-picker test fixture: refresh becomes invalidate, with an assertion that invalidation occurs. Production code is unchanged.
Foreground admission and connection replacement: The coordinator holds background tasks until the matching connection and selected transcript are ready, permits prerequisites, and resets concurrency accounting when the connection changes.
Previous finding resolved: scheduleSidebarSessions binds the filtered subscription before scheduling its refresh; queued work checks that the same subscription still owns the query.
Findings None None.
Security None None.

How this fits together

The Control UI receives routes, session selections, and Gateway events. Its connection scheduler coordinates background reads while chat and sidebar owners publish their own results.

flowchart TD
  A[Route and selected chat] --> B[Connection scheduler]
  C[Gateway connection] --> B
  D[Transcript ready or visibly failed] --> B
  B --> E[Automatic session lists]
  C --> F[Live session events]
  F --> G[Chat and sidebar views]
  E --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +459, Tests +1341, Docs +2, Other +3. Total +1805 across 80 files.

View PR surface stats
Area Files Added Removed Net
Source 43 976 517 +459
Tests 35 1609 268 +1341
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 80 2590 785 +1805

Review metrics

Metric Value Why it matters
Production versus test growth Production/tooling +462 lines; tests/support +1,341 lines net Production growth has a stated purpose: coordinating admission and preserving existing recovery behavior, with regression coverage dominating the added code.

Technical review

Best possible solution:

Keep startup admission in the existing connection scheduler while session owners retain query scope, explicit actions, and visible recovery.

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

Yes: the browser scenario holds selected-chat startup and bulk list replies, then checks transcript readiness, live messages, and explicit actions. This review inspected that scenario and its captures without executing it.

Is this the best way to solve the issue?

Yes. Extending the existing scheduler and retaining query ownership is a maintainable way to prioritize chat without introducing competing session state.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This improves selected-chat responsiveness and session consistency under competing background reads without evidence of an emergency outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 supplied MEMBER association exempts this PR from contributor setup proof. Inspected synthetic browser captures demonstrate selected-chat content and a populated composer; the associated scenario checks request ordering, without claiming production latency.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The supplied MEMBER association exempts this PR from contributor setup proof. Inspected synthetic browser captures demonstrate selected-chat content and a populated composer; the associated scenario checks request ordering, without claiming production latency.

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)

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 (3 earlier review cycles)
  • reviewed 2026-09-13T00:40:56.514Z sha 9d911b7 :: blocked before merge. :: [P2] Bind the filtered subscription before scheduling its refresh
  • reviewed 2026-09-13T03:25:13.912Z sha f5ced56 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T05:11:29.477Z sha f4c8630 :: needs maintainer review before merge. :: none

Register session events immediately and defer automatic roster, catalog,
and Swarm hydration until selected native history is ready or fails.
Keep scope replacement, trailing refresh, and lazy-import resubmission
with their existing owners so startup priority does not drop later work.
Keep automatic roster successors behind the selected transcript while preserving explicit refresh, pagination, and retry behavior. Let the primary request owner coalesce selection and hydration, and retain managed invalidations across new foreground holds.

Preserve completed history across cache eviction, keep failed-history Retry with its owner, refresh selected runtime descriptors independently of bulk lists, and retain exact-run terminal reconciliation on reconnect. Repair canonical browser fixtures exposed by the new ordering.

Load Skill Workshop English with its lazy consumers while preserving the complete composed catalog and the existing startup-size budget.
@steipete
steipete force-pushed the codex/prioritize-chat-startup branch from 9d911b7 to f5ced56 Compare September 13, 2026 03:17
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 13, 2026
@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: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 13, 2026
Keep live descriptor observations current after invalidation, retain failed
child refreshes until explicit retry, and invalidate the existing roster
query when a model picker catalog completes instead of replacing it.

Validation: 265 focused tests, changed checks, production UI build, unchanged
startup-size gate, and independent P2 review passed.
Cloud placement failure cleanup must invalidate existing session queries
instead of issuing an unscoped refresh that consumes a held bootstrap.
Preserve the visible recovery error and explicit Retry.

Validation: 323 focused tests, 10 bundled browser cases, changed checks,
production build, unchanged startup-size gate, and independent P2 review.
@steipete
steipete merged commit b023df8 into main Sep 13, 2026
243 of 247 checks passed
@steipete
steipete deleted the codex/prioritize-chat-startup branch September 13, 2026 06:42
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…w#146591)

* fix(ui): load selected chats before background task lists

Register session events immediately and defer automatic roster, catalog,
and Swarm hydration until selected native history is ready or fails.
Keep scope replacement, trailing refresh, and lazy-import resubmission
with their existing owners so startup priority does not drop later work.

* fix(ui): preserve chat startup priority through recovery

Keep automatic roster successors behind the selected transcript while preserving explicit refresh, pagination, and retry behavior. Let the primary request owner coalesce selection and hydration, and retain managed invalidations across new foreground holds.

Preserve completed history across cache eviction, keep failed-history Retry with its owner, refresh selected runtime descriptors independently of bulk lists, and retain exact-run terminal reconciliation on reconnect. Repair canonical browser fixtures exposed by the new ordering.

Load Skill Workshop English with its lazy consumers while preserving the complete composed catalog and the existing startup-size budget.

* fix(ui): preserve session state across deferred startup

Keep live descriptor observations current after invalidation, retain failed
child refreshes until explicit retry, and invalidate the existing roster
query when a model picker catalog completes instead of replacing it.

Validation: 265 focused tests, changed checks, production UI build, unchanged
startup-size gate, and independent P2 review passed.

* fix(ui): keep the selected sidebar through cloud recovery

Cloud placement failure cleanup must invalidate existing session queries
instead of issuing an unscoped refresh that consumes a held bootstrap.
Preserve the visible recovery error and explicit Retry.

Validation: 323 focused tests, 10 bundled browser cases, changed checks,
production build, unchanged startup-size gate, and independent P2 review.

* test(ui): complete the model picker session fixture
steipete added a commit that referenced this pull request Sep 28, 2026
The final digest rendered correctly, but the test captured zero matching
sessions.list requests before initial roster bootstrap was released. Its
no-extra-read assertion then mistook the first roster read for an event
reload (expected length 0, received 1).

Introducing ordering: b023df8 (#146591) prioritizes selected chat
history over automatic background lists. A selected descriptor can already
render the sidebar row while chat.startup still holds that first list.

Hold chat.startup to exercise the early descriptor path, release it, then
wait for a second row available only from roster admission before recording
the request baseline. Preserve the exact final-digest and no-extra-list-read
assertions. No production change, retry, timeout increase, or sleep is added.

Probe evidence on main 1a94ee9:
- Original whole file: 5 passed, target failed with the CI 0-to-1 signature.
- Holding startup until after the final digest deterministically reproduces
  the same failure; the final digest is visible before the assertion fails.
- The identical probe passes with only the background-startup gate introduced
  by b023df8 temporarily removed. That production change was reverted.
- Suspect-range samples before and at b7e2666 and at 3a306a4 pass the
  unmodified file. Snapshot stamping is not the stale-digest cause: static
  list fixtures already seed canonical descriptors, and the digest renders.
- Full replay at b023df8 cannot build with the installed dependency set
  (missing historical ms dependency); no dependencies were installed. The
  attribution uses its parent-relative patch plus the isolated gate control.

Validation:
- Complete sidebar presentation E2E file: 6 passed, 49.08s wall including
  bundle build; changed scenario 1.405s.
- Bootstrap, sidebar narration, roster event and reconciliation owners:
  4 files / 107 tests passed, one worker, 29.23s runner wall.
- pnpm tsgo:ui, oxfmt, targeted core-tsconfig oxlint, git diff --check.
- Line-cap, max-lines suppression and assertion-safety ratchets pass.
  The combined max-lines command also reports the existing environment-name
  budget failure (484 vs 483), reproduced from the untouched HEAD index.
- Independent Codex autoreview: scoped-clean through P2.

Release-note context: test reliability only; product behavior is unchanged.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
The final digest rendered correctly, but the test captured zero matching
sessions.list requests before initial roster bootstrap was released. Its
no-extra-read assertion then mistook the first roster read for an event
reload (expected length 0, received 1).

Introducing ordering: 6474f32 (openclaw#146591) prioritizes selected chat
history over automatic background lists. A selected descriptor can already
render the sidebar row while chat.startup still holds that first list.

Hold chat.startup to exercise the early descriptor path, release it, then
wait for a second row available only from roster admission before recording
the request baseline. Preserve the exact final-digest and no-extra-list-read
assertions. No production change, retry, timeout increase, or sleep is added.

Probe evidence on main 5405301:
- Original whole file: 5 passed, target failed with the CI 0-to-1 signature.
- Holding startup until after the final digest deterministically reproduces
  the same failure; the final digest is visible before the assertion fails.
- The identical probe passes with only the background-startup gate introduced
  by 6474f32 temporarily removed. That production change was reverted.
- Suspect-range samples before and at 2642b2d and at d50e9f2 pass the
  unmodified file. Snapshot stamping is not the stale-digest cause: static
  list fixtures already seed canonical descriptors, and the digest renders.
- Full replay at 6474f32 cannot build with the installed dependency set
  (missing historical ms dependency); no dependencies were installed. The
  attribution uses its parent-relative patch plus the isolated gate control.

Validation:
- Complete sidebar presentation E2E file: 6 passed, 49.08s wall including
  bundle build; changed scenario 1.405s.
- Bootstrap, sidebar narration, roster event and reconciliation owners:
  4 files / 107 tests passed, one worker, 29.23s runner wall.
- pnpm tsgo:ui, oxfmt, targeted core-tsconfig oxlint, git diff --check.
- Line-cap, max-lines suppression and assertion-safety ratchets pass.
  The combined max-lines command also reports the existing environment-name
  budget failure (484 vs 483), reproduced from the untouched HEAD index.
- Independent Codex autoreview: scoped-clean through P2.

Release-note context: test reliability only; product behavior is unchanged.
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. scripts Repository scripts 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