Skip to content

fix(ui): surface compaction checkpoints in chat history#76437

Merged
BunsDev merged 2 commits into
mainfrom
meow/compaction-history-boundary
May 3, 2026
Merged

fix(ui): surface compaction checkpoints in chat history#76437
BunsDev merged 2 commits into
mainfrom
meow/compaction-history-boundary

Conversation

@BunsDev

@BunsDev BunsDev commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #76415 by making compaction boundaries explicit in Control UI/WebChat history instead of letting refreshes look like earlier turns silently disappeared.

The narrow product choice here is to preserve the current bounded active-transcript chat.history behavior and add a chat-level recovery affordance:

  • render compaction transcript entries as Compacted history dividers instead of a generic Compaction label
  • explain that earlier turns are preserved in a compaction checkpoint
  • add an Open checkpoints action that switches to the Sessions view, expands the active session's checkpoint panel, and refreshes checkpoint metadata
  • keep checkpoint branch/restore permissions enforced by the existing Sessions APIs
  • document the behavior in WebChat docs and add a user-facing changelog entry

Bug / Current Behavior

Issue #76415 reports that after automatic compaction, a long Control UI/WebChat session reloads from the compacted successor transcript. The old full turn-by-turn transcript is retained in checkpoint/reset files, but normal chat history can make earlier messages look lost after refresh.

I verified the issue is still open and not already closed by a linked PR. closedByPullRequestsReferences is empty.

Related PR Review

I checked related live PRs before opening this one:

gitcrawl was stale for #76415 (local store last updated before the issue existed), so I fell back to live GitHub search. prtags was installed and authenticated, but the prtags API returned 502 for list/search/write attempts, so duplicate-group writes could not be completed in this run.

Security / Privacy

This PR intentionally does not read, stitch, replay, or expose archived/checkpoint transcript bytes through chat.history.

Security-relevant boundaries preserved:

  • no new filesystem reads
  • no checkpoint-path trust changes
  • no reset/restore epoch replay by default
  • no dependency, workflow, lockfile, or secret-handling changes
  • branch/restore remains behind the existing sessions.compaction.* methods and server-side permissions

Tests

RED proof first:

  • pnpm test ui/src/ui/chat/build-chat-items.test.ts ui/src/ui/views/chat.test.ts failed before implementation because the builder emitted only Compaction and the view rendered no explanation/action.

Passing proof:

  • pnpm test ui/src/ui/chat/build-chat-items.test.ts ui/src/ui/views/chat.test.ts — 27 tests passed
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/web/webchat.md ui/src/styles/chat/grouped.css ui/src/ui/app-render.ts ui/src/ui/types/chat-types.ts ui/src/ui/chat/build-chat-items.ts ui/src/ui/chat/build-chat-items.test.ts ui/src/ui/views/chat.ts ui/src/ui/views/chat.test.ts — passed
  • git diff --check — passed
  • Blacksmith Testbox tbx_01kqp0e8zndm2cng8ky8d9jpan: OPENCLAW_TESTBOX=1 pnpm check:changed — passed (core, coreTests, docs lanes)

Docs

Updated WebChat docs: https://docs.openclaw.ai/web/webchat

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels May 3, 2026
@clawsweeper

clawsweeper Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR expands WebChat compaction dividers with recovery copy and an Open checkpoints action, plus focused tests, CSS, WebChat docs, and a changelog entry.

Reproducibility: yes. Current main has a source-level reproduction path: gateway emits compaction markers, but the UI renders them as a generic Compaction separator with no recovery copy or action.

Next step before merge
Protected maintainer/member PR with no narrow automated blocker found; the remaining action is explicit maintainer UX review and normal merge validation.

Security
Cleared: Cleared: the diff stays within UI rendering/types/styles, tests, docs, and changelog, and reuses existing sessions.compaction APIs without adding supply-chain or secret-handling changes.

Review details

Best possible solution:

Land the focused UI/docs change if maintainers accept the chat-level recovery affordance; keep deeper transcript stitching and reset-archive recovery in the existing gateway PRs tracking those paths.

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

Yes. Current main has a source-level reproduction path: gateway emits compaction markers, but the UI renders them as a generic Compaction separator with no recovery copy or action.

Is this the best way to solve the issue?

Yes, pending maintainer UX approval. The PR is narrow because it preserves bounded chat.history behavior and points users to existing Sessions checkpoint APIs instead of replaying checkpoint transcript bytes in chat.history.

What I checked:

  • Protected PR status: Provided GitHub context shows authorAssociation MEMBER and labels include maintainer, so this cleanup workflow should not close the PR automatically. (76e0bbddb114)
  • Current main generic divider: Current main maps __openclaw.kind compaction markers to a divider labeled only "Compaction". (ui/src/ui/chat/build-chat-items.ts:219, b258c3fc6578)
  • Current main render lacks recovery action: Current main renders divider items as a separator with only the label and no description or checkpoint button. (ui/src/ui/views/chat.ts:907, b258c3fc6578)
  • Gateway emits stable compaction markers: readSessionMessages already emits synthetic system messages for transcript compaction entries, giving the UI a stable source-level path to render a boundary. (src/gateway/session-utils.fs.ts:683, b258c3fc6578)
  • Existing checkpoint API surface: Sessions controller and gateway already support listing compaction checkpoints, and existing tests cover checkpoint listing, branch, and restore paths. (ui/src/ui/controllers/sessions.ts:158, b258c3fc6578)
  • PR diff scope: The PR diff is limited to UI rendering/types/styles, targeted UI tests, WebChat docs, and CHANGELOG; it does not add dependencies, workflows, filesystem reads, or secret-handling changes. (ui/src/ui/app-render.ts:2372, 76e0bbddb114)

Likely related people:

  • vincentkoc: Local blame on current main assigns the existing WebChat compaction divider builder and renderer to this author, and the same area includes recent bounded session-list/checkpoint work. (role: recent adjacent maintainer; confidence: medium; commits: 85520f664d02, 23e0be355ac3; files: ui/src/ui/chat/build-chat-items.ts, ui/src/ui/views/chat.ts, ui/src/ui/controllers/sessions.ts)
  • Takhoffman: The prior ClawSweeper review context traces the Web UI compaction divider path that this PR extends from a generic label into a recovery affordance to this commit. (role: introduced behavior; confidence: medium; commits: 82419eaad60d; files: ui/src/ui/chat/build-chat-items.ts, ui/src/ui/views/chat.ts, src/gateway/session-utils.fs.ts)
  • tyler6204: The prior review context links this author to adjacent context-overflow compaction work that established the compaction boundary behavior surfaced by the UI. (role: compaction feature history; confidence: medium; commits: 191da1feb52e; files: src/gateway/session-utils.fs.ts, src/gateway/session-compaction-checkpoints.ts)

Remaining risk / open question:

  • I did not rerun the PR's tests because this review was restricted to read-only inspection.
  • The reported issue allowed multiple acceptable UX directions, so maintainer acceptance of this chat-level checkpoint affordance is still needed.

Codex review notes: model gpt-5.5, reasoning high; reviewed against b258c3fc6578.

@BunsDev BunsDev self-assigned this May 3, 2026
@BunsDev BunsDev force-pushed the meow/compaction-history-boundary branch from a23a9a5 to 76e0bbd Compare May 3, 2026 04:24
@BunsDev BunsDev merged commit 2810f12 into main May 3, 2026
78 checks passed
@BunsDev BunsDev deleted the meow/compaction-history-boundary branch May 3, 2026 04:29
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 size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Control UI loses visible pre-compaction chat history after refresh

1 participant