Skip to content

improve: open cold chats with the latest 24 messages - #207173

Merged
daniel-lxs merged 4 commits into
mainfrom
openclaw/cold-chat-opening-one-behaviour-e14bf8
Nov 28, 2026
Merged

daniel-lxs merged 4 commits into
mainfrom
openclaw/cold-chat-opening-one-behaviour-e14bf8

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #145679. Follow-up to #206816.

What Problem This Solves

Opening a chat without saved history fetches up to 80 messages unless the reader finds and enables a browser preference. Readers do not need to choose a page size to reach older messages.

User Impact

Cold chats open with the latest 24 messages. Scroll up or choose Show earlier to read the rest. Find can search earlier pages. Reopening a chat can still reuse saved history. No settings changes are needed.

Why This Change Was Made

The early connection and the chat pane use the same cold-opening rule. The Appearance switch, settings search entries, English copy, and preference storage are gone. Cursor recovery and older-page requests keep their existing sizes.

Evidence

CI repair and browser-data compatibility at ae86667ea7f2

I replayed all three failures from run 46104215847 on AWS CrabBox. All passed on main (f75bd912f3fd) and failed on the previous PR head (78be4ee68238).

  • UI shard 3/3: both /clear assertions still expected an 80-message request after the local transcript was discarded. I changed those expectations to 24 and kept the warm recovery expectations at 80.
  • UI E2E shard 3/5: a cold-open marker survived a later full 80-message reconnect response. It prevented the short viewport from fetching its older page. A full page now replaces that marker; cursor deltas do not. The original reconnect test passes unchanged, including the assertion that the consumed prompt appears exactly once.

I ran three browser upgrades in Chromium. In each case the old production UI wrote a 731px reading width, an unsent draft and a real IndexedDB snapshot. I then switched only the served bundle, keeping the same browser tab, profile and origin; I did not copy or inject browser storage. The session history and Gateway transport were synthetic. I checked each loaded JavaScript entry against the served build’s SHA-256.

Producer Snapshot before Snapshot after opening on this head Result
Published v2026.11.10, npm integrity verified v16, 80 rows Rebuilt from Gateway history as v18, 24 rows All 96 messages reachable, ordered and unique
Main with the old switch on v18, 24 rows; saved key true v18, 24 rows All 96 reachable, ordered and unique
Main with the old switch off v18, 80 rows; key absent v18, 80 rows All 96 reachable, ordered and unique

In all three cases the width and unsent draft survived, the old switch was absent, and saving a new width omitted the retired key. Returning to chat restored the draft again. This is a browser-data upgrade check, not a Gateway process upgrade.

On this head, 279 focused unit tests and all five tests in the unchanged pending-handoff browser file passed. UI typecheck and scoped lint passed. The clean paired Chat budget passed at 1,335,975 bytes gzip against 1,336,554 on the merge base, 579 bytes smaller, with 21 requests on each. Hosted CI is separate from the CrabBox checks.

Earlier bundle and cold-open comparison

I tested commit 78be4ee68238 on AWS CrabBox with Node 24.22.1, Vite 8.3.5 and the repository’s normalized gzip measurement. All comparisons used main at 3c4362b3ad48. The growth allowance was unchanged at 64 bytes.

Chat boot JavaScript (bytes gzip) Main Original PR At 78be4ee68238 Vs. main
Clean CI-style builds 1,336,554 1,336,499 1,335,912 −642
Both sides fully packaged 1,336,952 1,337,094 1,336,507 −445

The previously reported +540 compared a fully packaged PR with a clean main. With the PR source held fixed, the six additional packaged-plugin descriptors added exactly 595 gzip bytes to the shared boot chunk. The emitted source maps showed no extra Chat modules. Even repeating the original, stricter comparison, that head was 47 bytes below clean main (1,336,507 vs. 1,336,554). All runs used 21 boot JS requests.

The change keeps foreground history on its existing path. A background snapshot read for a sidebar link, including cursor reset and cache reconciliation, now loads only on navigation intent. In the production UI against a real Gateway, I saw zero prefetch-chunk fetches and zero speculative history reads on cold open, then one of each after focusing another session link. On the same 96-message fixture, main opened messages 17–96 (80); that PR build opened 73–96 (24). Scrolling reached message 1 with all 96 IDs present once and in order.

131 focused tests passed, along with the browser search and real-Gateway checks, UI typecheck, and scoped lint. The screenshots below show the unchanged visual comparison from the toggle removal. Hosted CI is separate from these checks.

Appearance → Chat

Main PR
Main: opening-size switch PR: opening-size switch removed
24 messages required opting in No opening-size preference

Worked on by

Work sessions

Linked for team reference; these sessions aren’t public.

🦞 Made with OpenClaw

roboclaw-bot and others added 2 commits November 28, 2026 03:08
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 46ff414f-0d6d-47b8-acc6-af2dca3e692e
@clawsweeper

clawsweeper Bot commented Nov 28, 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: S labels Nov 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 28, 2026
@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR makes cold chats open with 24 messages, removes the opening-size preference, and defers background history code until navigation intent.

Example: Open a 96-message conversation without saved browser history.

  • Before: The default opening shows messages 17–96; showing 24 requires enabling a preference.
  • After: The opening shows messages 73–96, with all 96 reachable through earlier-history loading.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful owner-directed simplification with production-entry evidence, browser-data compatibility checks, and no identified defects; hosted validation is still completing.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR records production-UI cold opening and prefetch behavior against a real Gateway, with all 96 fixture messages reachable once and in order; inspected screenshots verify switch removal. Current-head browser upgrades retain width, draft, and usable IndexedDB history from v2026.11.10 and both previous switch states. Those upgrade checks use synthetic Gateway transport and do not claim a Gateway process upgrade.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Preference · Worth it: Yes · Fix scope: Complete
User problem: Readers must discover a page-size setting to get the smaller cold-chat opening.
Reason: Maintainer-authored direction and the linked discussion authorize removing the switch; earlier messages remain accessible without another setting.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: it follows the recorded product direction, and no actionable correctness or security defects were found.

Reviewed head: ae86667ea7f2416918c00ebbc625822cc325744b

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI turns route selection and cached transcript facts into Gateway history requests, then renders and caches the returned messages.

flowchart TD
  A[Chat navigation] --> B[Early Gateway or chat pane]
  C[Saved transcript] --> B
  B --> D[Shared history request owner]
  D --> E[Gateway history response]
  E --> F[Transcript and cache]
  F --> G[Scroll or Find earlier history]
  G --> D
Loading

Technical review

Best possible solution:

Use one cold-opening rule in the existing history owners while preserving cached transcripts, cursor recovery, and reader-driven pagination.

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

This changes designed behavior: current main defaults to 80 messages unless the browser preference enables 24.

Is this the best way to solve the issue?

The change follows recorded owner direction, removes the superseded setting completely, and keeps foreground requests and recovery with their existing owners.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Opening-window preference changes intended behavior with a stated reason (835b91f: Off-by-default preference offered a smaller cold opening while preserving the previous default.)
  • Background history preparation keeps the original intent (b0fb3ac: Avoid speculative history reads on connect; this PR retains navigation-intent admission and moves existing preparation behind its lazy boundary.)
  • History-read cancellation keeps the original intent (491ce01: Release obsolete history consumers when leaving or hiding a chat while preserving independent shared readers.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduction reviewed: The introduced diff removes the preference across storage, settings, search, copy, and callers while retaining the existing shared history request owner. (ae86667ea7f2)
  • Current main remains opt-in: Current main still requires compactSessionOpening to request the smaller opening; this PR's default behavior is not already implemented. (ui/src/pages/chat/chat-history-state.ts:134, 4e84b43690b2)
  • Recorded product direction: Discussion on improve(ui): offer a 24-message opening window for cold chats #206816 explicitly requests tuning chat opening in the app and removing the switch; this PR also has COLLABORATOR authorship.
  • Recovery budgets preserved: Cold cursorless openings request 24 messages; cursor and ordinary recovery requests retain 80, and older-page requests retain their existing owner and limits. (ui/src/pages/chat/chat-history-request-params.ts:35, ae86667ea7f2)
  • Reconnect repair: A committed full page replaces the cold-opening marker, while delta responses preserve it; the unchanged reconnect browser test requires the older-page request and exactly one consumed prompt. (ui/src/pages/chat/chat-history-hydration.ts:357, ae86667ea7f2)
  • Behavior and upgrade evidence: The PR records production-UI testing against a real Gateway, complete ordered traversal of 96 messages, and current-head browser upgrades from v2026.11.10 and both previous preference states, preserving reading width, draft, and usable snapshots. (ae86667ea7f2)

Likely related people:

  • Daniel: Raw commit 835b91f adds ui/src/pages/chat/chat-history-state.ts:134 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 835b91f67814; files: ui/src/pages/chat/chat-history-state.ts)
  • Peter Steinberger: Raw commit b0fb3ac adds ui/src/pages/chat/session-prefetch.ts:342 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b0fb3ac33212; files: ui/src/pages/chat/session-prefetch.ts)
  • Vincent Koc: Raw commit 491ce01 adds ui/src/pages/chat/session-prefetch.ts:179 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 491ce01c486b; files: ui/src/pages/chat/session-prefetch.ts)

PR surface

Source +10, Tests -21, Docs 0. Total -11 across 35 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 18 242 232 +10
Tests 16 63 84 -21
Docs 1 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 35 307 318 -11

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The owner-directed change replaces the default opening size and retires a stored browser preference; reported upgrades cover stable browser data and both previous preference states.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • merge-risk: 🚨 compatibility: The owner-directed change replaces the default opening size and retires a stored browser preference; reported upgrades cover stable browser data and both previous preference states.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-28T03:32:25.895Z sha 1a42595 :: blocked before merge. :: [P2] [P2] Fit the changed boot path within the paired JavaScript budget
  • reviewed 2026-11-28T03:48:41.760Z sha 78be4ee :: blocked before merge. :: none

Reviewed November 27, 2026, 11:16 PM ET / November 28, 2026, 04:16 UTC (Revision 3).

Keep the foreground history request shared. Only load background snapshot conversion and cache reconciliation when a sidebar intent is eligible.

Co-authored-by: daniel-lxs <[email protected]>
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 28, 2026 03:43
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. label Nov 28, 2026
Replace the cold-window marker when a full history page commits. Keep incremental updates reader-driven, and distinguish cold and warm request budgets in clear tests.

Co-authored-by: daniel-lxs <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Nov 28, 2026
@daniel-lxs
daniel-lxs merged commit ebe5fc1 into main Nov 28, 2026
107 checks passed
@daniel-lxs
daniel-lxs deleted the openclaw/cold-chat-opening-one-behaviour-e14bf8 branch November 28, 2026 04:32
roboclaw-bot added a commit that referenced this pull request Nov 28, 2026
Upstream #207173 made the 24-message window the default and removed its preference. Remove the unshipped ID rather than redirect its link to an unrelated control.

Co-authored-by: Patrick-Erichsen <[email protected]>
steipete added a commit that referenced this pull request Nov 28, 2026
Keep the history request helper private after #207173 and cover the cached snapshot through navigation-intent prefetch.
obviyus added a commit that referenced this pull request Nov 28, 2026
## Problem

Five Control UI e2e tests fail on every run on `main`. Main-push CI does not select the `checks-ui-e2e` shards, so the failures only show on PRs that touch a file the suite imports (shards 2/10, 3/10 and 7/10).

- `sidebar-outbox.e2e.test.ts:80` and both reload cases of `new-session-page.cloud-startup-failure.e2e.test.ts` time out. The page throws `Cannot read properties of undefined (reading 'includes')` in `chatSessionPresentationTitle`, so the chat pane never renders.
- `chat-history-loading.e2e.test.ts:141` and `chat-error-details.e2e.test.ts:143` time out while they wait for an older `chat.history` request that never comes.

## Cause (bisected, 3 runs per side)

- **#205607** (`9316f053`): `chatSessionPresentationTitle` now reads `source.key` from the session row. The three tests mock `chat.history` `sessionInfo` (and `sessions.describe`) without `key`. The Gateway always sends a full `GatewaySessionRow` with `key`, and #205607 fixed the same keyless fixture in `placement-error-unicode.e2e.test.ts`. The fixtures are out of date; the product is correct.
- **#207173** (`ebe5fc10`): every cold chat now opens with the latest 24 messages and loads older ones only on reader intent ("Scroll up or choose **Show earlier** … even if the transcript fits on screen", `docs/web/control-ui.md`). The two tests expected the old automatic older-page fill after an opening with visible rows.

## Fix

Tests only, no product change.

- The keyless fixtures now send a valid session row: the outbox test drops its `chat.history` override and uses the row the mock derives from `sessions`; the cloud startup test returns the same row that `sessions.list` returns.
- The two history tests click **Show earlier** before they wait for the older page. The rest of each test (inline retry, archived-child error placement, paging past tool activity) is unchanged.

## Evidence

- Red on `main` (`45fc9339`): 5 failed / 16 passed, 3 of 3 runs.
- Green on this branch: 21 / 21 passed, 3 of 3 runs.
- Bisect: `08a545d2` 11/11 ×3 → `9316f053` 3 failed ×3; `563eef98` 10/10 ×3 → `ebe5fc10` 2 failed ×3.

Co-authored-by: Ayaan Zaidi <[email protected]>
@obviyus

obviyus commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

@daniel-lxs a follow-up on the compact cold opening from this PR. A cold opening whose latest window is tool activity only shows no message at all.

Repro (current main at 24b7801f, Control UI e2e mock Gateway, synthetic data):

  1. Create a session whose newest page is tool activity only: three read calls with their results. The user prompt and the assistant reply are in the older page (hasMore: true).
  2. Open that session cold at 1280×900.
  3. Wait 3 seconds. The UI requests no older chat.history page.

What the user sees: the session title, Show earlier, one collapsed "Read files" row, and an empty pane above the composer. No user or assistant message is visible, so the chat looks empty or broken until the reader scrolls up or clicks Show earlier.

Why: in evaluateHistoryEdge (ui/src/pages/chat/chat-pane-history.ts:226-233), the compact-opening gate skips the one viewport fill when this.transcript.hasMessageRows is true. hasMessageRows (ui/src/pages/chat/components/chat-transcript-virtualizer-host.ts:618) is true for every rendered transcript item, tool rows included.

Narrow ask: count only message rows (user or assistant) in that gate. Then a cold opening with no message gets its one automatic fill, and an opening that shows a message keeps the reader-intent behavior.

This is your design call. We made no change. If you take it, note that #207513 changed chat-error-details.e2e.test.ts to click Show earlier for this case, so that click would no longer be needed.

Tool-only cold opening: Show earlier and one Read files row, no user or assistant message

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 29, 2026
Open cold chats with the latest 24 messages and remove the opening-size preference. Load background history preparation on navigation intent. Keep earlier messages available through scrolling and search, and preserve the existing recovery request sizes.

Co-authored-by: daniel-lxs <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 29, 2026
Keep the history request helper private after openclaw#207173 and cover the cached snapshot through navigation-intent prefetch.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 29, 2026
…07513)

## Problem

Five Control UI e2e tests fail on every run on `main`. Main-push CI does not select the `checks-ui-e2e` shards, so the failures only show on PRs that touch a file the suite imports (shards 2/10, 3/10 and 7/10).

- `sidebar-outbox.e2e.test.ts:80` and both reload cases of `new-session-page.cloud-startup-failure.e2e.test.ts` time out. The page throws `Cannot read properties of undefined (reading 'includes')` in `chatSessionPresentationTitle`, so the chat pane never renders.
- `chat-history-loading.e2e.test.ts:141` and `chat-error-details.e2e.test.ts:143` time out while they wait for an older `chat.history` request that never comes.

## Cause (bisected, 3 runs per side)

- **openclaw#205607** (`fbc31d21`): `chatSessionPresentationTitle` now reads `source.key` from the session row. The three tests mock `chat.history` `sessionInfo` (and `sessions.describe`) without `key`. The Gateway always sends a full `GatewaySessionRow` with `key`, and openclaw#205607 fixed the same keyless fixture in `placement-error-unicode.e2e.test.ts`. The fixtures are out of date; the product is correct.
- **openclaw#207173** (`9017a5bf`): every cold chat now opens with the latest 24 messages and loads older ones only on reader intent ("Scroll up or choose **Show earlier** … even if the transcript fits on screen", `docs/web/control-ui.md`). The two tests expected the old automatic older-page fill after an opening with visible rows.

## Fix

Tests only, no product change.

- The keyless fixtures now send a valid session row: the outbox test drops its `chat.history` override and uses the row the mock derives from `sessions`; the cloud startup test returns the same row that `sessions.list` returns.
- The two history tests click **Show earlier** before they wait for the older page. The rest of each test (inline retry, archived-child error placement, paging past tool activity) is unchanged.

## Evidence

- Red on `main` (`1c59a157`): 5 failed / 16 passed, 3 of 3 runs.
- Green on this branch: 21 / 21 passed, 3 of 3 runs.
- Bisect: `67dd7ed5` 11/11 ×3 → `fbc31d21` 3 failed ×3; `cf90329d` 10/10 ×3 → `9017a5bf` 2 failed ×3.

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 impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

3 participants