Skip to content

feat(ui): auto-load older external-session transcript on scroll - #105209

Merged
steipete merged 6 commits into
mainfrom
feat/chat-scrollback-autoload
Jul 12, 2026
Merged

steipete merged 6 commits into
mainfrom
feat/chat-scrollback-autoload

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #105165

What Problem This Solves

Viewing an external Claude Code / Codex catalog session in the Chat pane, older history sat behind a manual "Load older" button; scrolling up loaded nothing and there was no loading affordance. Tool-call, tool-result, and reasoning items with no plain-text body rendered as an ugly [Unsupported external session item] placeholder.

Why This Change Was Made

Catalog sessions should browse like native ones — scroll up, older messages appear, viewport stays put. This adds auto-load-on-scroll for external (read-only) catalog transcripts and fixes the placeholder rendering. Native-session scroll-back needs server-side history paging work and is tracked separately in #105127.

User Impact

  • Scrolling a Claude/Codex catalog transcript near the top auto-loads the next older page (IntersectionObserver on a top sentinel), with an inline spinner while it loads. The viewport is anchored — prepended history does not move what you were reading. Loading stops when the cursor is exhausted. The manual button remains only as a fallback (no IntersectionObserver, or to retry after a transient failure on a short, non-scrollable thread).
  • Tool calls, tool results, and reasoning now render their real content (command, tool name, aggregated output) pulled from the item's structured raw data, or are cleanly skipped — no more [Unsupported external session item].
  • Native OpenClaw sessions are unchanged (this touches only the catalog transcript path).

Evidence

  • Live-verified on a gateway built from this branch against a real ~/.claude:
    • Older-page load: 49 → 99 messages on trigger; cursor advances for further pages.
    • Viewport anchoring: after prepending 6106px of older content, scrollTop auto-shifted 0 → 5890 to keep the same message in view (no jump).
    • Placeholder fix: a catalog transcript that previously showed [Unsupported external session item] now renders Tool call / Tool result with real content and zero placeholder nodes.
  • Real-Chromium E2E (ui/src/e2e/claude-sessions.e2e.test.ts): scroll-to-top fires the observer → .chat-history-loading spinner appears → older page loads → after.scrollTop ≈ before.scrollTop + (after.scrollHeight - before.scrollHeight) (anchoring) → no "Load older" button in auto mode → second scroll-to-top with exhausted cursor triggers no further load.
  • Unit (ui/src/pages/chat/chat-pane.test.ts): raw-derived tool-call/tool-result/reasoning mapping; empty unknown item skipped; failed auto-load re-arms only on user scroll; blocked auto-load is recoverable via the fallback's loadOlderMessages.
  • node scripts/run-vitest.mjs ui/src/pages/chat/... and the catalog e2e pass locally; changed-file oxlint clean; pnpm build clean (no [INEFFECTIVE_DYNAMIC_IMPORT]); i18n check clean on the rebased branch.
  • Structured autoreview run; the one accepted finding (short-thread blocked-fallback retry) is fixed in-branch with a regression test.
  • Known gap: native-session scroll-back deferred to [Feature]: native chat scroll-back (offset paging + import-aware history) to unify with catalog auto-load #105127 (server paging contract work).

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Jul 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3609beff1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

content = text ? `Thinking\n\n${text}` : "Thinking";
} else if (item.type === "toolCall") {
const label =
text ?? catalogRawString(item.raw, ["command", "name", "tool", "title", "query"]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle nested Claude tool-use raw content

When a Claude Code transcript contains a tool_use block with its command under input.command and no plain text, the provider classifies it as toolCall and forwards the original message.content array as raw (extensions/anthropic/session-catalog.ts:629-640, extensions/anthropic/session-catalog.ts:1418-1427). This lookup only checks top-level object fields, so those Claude tool calls render as just Tool call instead of showing the command/tool name this change is meant to recover; the fallback needs to traverse array/nested raw content or the provider needs to promote that text.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P2 Normal backlog priority with limited blast radius. labels Jul 12, 2026
@clawsweeper

clawsweeper Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 12, 2026, 5:30 AM ET / 09:30 UTC.

Summary
The PR adds automatic scroll-triggered pagination with viewport anchoring for external catalog transcripts and maps tool, result, and reasoning records into visible chat messages.

PR surface: Source +288, Tests +263. Total +551 across 7 files.

Reproducibility: yes. at source level: Claude emits a raw content array for all-tool-use messages, while the changed helper only accepts top-level objects, producing a deterministic incomplete-rendering path.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: ui/src/pages/chat/chat-pane.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #105165
Summary: This PR is the explicit candidate fix for the external catalog transcript issue; native-session scroll-back requires a separate gateway history contract.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Handle nested Claude tool_use content and add a regression test using the provider-produced raw array shape.

Next step before merge

  • [P2] The protected maintainer-labeled PR should remain in normal review, with the author addressing the single concrete changed-line defect before merge.

Security
Cleared: The patch changes Control UI code, CSS, and tests only; no dependency, workflow, secret, permission, artifact-download, package-resolution, or publishing concern was found.

Review findings

  • [P2] Handle Claude's nested tool-use content — ui/src/pages/chat/chat-pane.ts:735
Review details

Best possible solution:

Keep the generic pagination lifecycle, but have providers emit stable display text for structured transcript items—or add a typed shared normalizer using real Claude and Codex fixtures—so the UI does not interpret undocumented provider-specific raw shapes.

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

Yes, at source level: Claude emits a raw content array for all-tool-use messages, while the changed helper only accepts top-level objects, producing a deterministic incomplete-rendering path.

Is this the best way to solve the issue?

No in its current form; automatic pagination and viewport anchoring are appropriate, but structured rendering must consume the actual provider contract rather than only synthetic top-level object fixtures.

Full review comments:

  • [P2] Handle Claude's nested tool-use content — ui/src/pages/chat/chat-pane.ts:735
    Claude classifies an all-tool_use message as toolCall and forwards message.content as raw, where useful fields are inside an array block such as { name, input: { command } }. Because catalogRawString rejects arrays and checks only top-level keys, these items render only Tool call, leaving the advertised command/tool recovery incomplete. Normalize this in the provider or traverse typed content blocks and add a provider-shaped regression test.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: A real external-session provider shape still loses visible tool details, but the impact is limited to catalog transcript rendering.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides quantified after-fix live output from a real Claude catalog and real-Chromium evidence for paging and viewport anchoring; that evidence is strong but does not cover the nested tool-use defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body provides quantified after-fix live output from a real Claude catalog and real-Chromium evidence for paging and viewport anchoring; that evidence is strong but does not cover the nested tool-use defect.

Label justifications:

  • P2: A real external-session provider shape still loses visible tool details, but the impact is limited to catalog transcript rendering.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body provides quantified after-fix live output from a real Claude catalog and real-Chromium evidence for paging and viewport anchoring; that evidence is strong but does not cover the nested tool-use defect.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides quantified after-fix live output from a real Claude catalog and real-Chromium evidence for paging and viewport anchoring; that evidence is strong but does not cover the nested tool-use defect.
Evidence reviewed

PR surface:

Source +288, Tests +263. Total +551 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 337 49 +288
Tests 3 267 4 +263
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 604 53 +551

What I checked:

  • Current-main behavior: Current main loads older external catalog pages through a manual button and maps unsupported empty catalog items to a placeholder, so the requested improvement remains necessary. (ui/src/pages/chat/chat-pane.ts:665, b4a0fc5c57cc)
  • Concrete provider mismatch: Claude classifies content containing only tool-use blocks as toolCall and forwards the original message content array as raw; the useful tool name and command can therefore be nested rather than top-level fields. (extensions/anthropic/session-catalog.ts:639, b4a0fc5c57cc)
  • Blocking changed line: The new tool-call fallback uses catalogRawString, but that helper rejects arrays and checks only top-level command, name, tool, title, and query fields, so nested Claude tool-use content renders only the generic label. (ui/src/pages/chat/chat-pane.ts:735, d3609beff13d)
  • Coverage gap: The added unit test supplies a synthetic top-level raw command object and does not exercise the content-array shape produced by the Claude provider. (ui/src/pages/chat/chat-pane.test.ts:370, d3609beff13d)
  • Codex contract check: Direct sibling Codex source inspection confirms Codex command, dynamic-tool, and MCP items expose object fields such as command, tool, result, and aggregated output; that supports the top-level object path but does not cover Claude arrays. (extensions/codex/src/app-server/protocol.ts:379, b4a0fc5c57cc)
  • Pagination quality: The branch disconnects observers during updates and teardown, bounds repeated or cyclic cursors, preserves the viewport after prepending, and retains a manual fallback after blocked or failed automatic loading. (ui/src/pages/chat/chat-pane.ts:773, d3609beff13d)

Likely related people:

  • steipete: Authored merged work defining the external catalog pagination, Codex session supervision, and Claude CLI history surfaces affected here. (role: recent feature owner; confidence: high; commits: 3255b3218ab6, f94a7dc183c6, 36671719e618; files: ui/src/pages/chat/chat-pane.ts, extensions/anthropic/session-catalog.ts, extensions/codex/src/session-catalog.ts)
  • ZOOWH: Recently changed Claude CLI synthetic-history handling and is relevant to provider-side transcript normalization and its regression coverage. (role: recent Claude history contributor; confidence: medium; commits: 9aa4250c58ad; files: src/gateway/cli-session-history.ts, src/gateway/cli-session-history.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@steipete
steipete force-pushed the feat/chat-scrollback-autoload branch from d3609be to 6b76947 Compare July 12, 2026 09:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b76947131

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +994 to +996
if (!prepended) {
this.pendingHistoryAnchor = null;
this.historyAutoLoadBlocked = this.hasOlderMessages();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the anchor when the last older page loads

When sessions.catalog.read returns the final older page with items but no nextCursor, loadCatalogSession() still prepends those messages and sets pendingHistoryAnchor, but it returns false because the cursor is exhausted. This block then treats that as “nothing prepended” and clears the anchor before updated() can restore scrollTop, so the common end-of-history load can jump the reader away from the message they were viewing instead of preserving the viewport.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 842f8f3 into main Jul 12, 2026
198 checks passed
@steipete
steipete deleted the feat/chat-scrollback-autoload branch July 12, 2026 09:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 13, 2026
…claw#105209)

* feat(ui): auto-load older catalog transcript on scroll with a stable viewport

* fix(ui): surface the load-older fallback when auto-load is blocked on a short thread

* fix(ui): clamp oversized aggregated tool output in catalog transcripts

* fix(ui): stop catalog auto-pagination when an older read makes no progress

* fix(ui): continue catalog paging through advancing empty pages; exhaust only on a stalled cursor

* fix(ui): detect catalog cursor cycles to bound auto-pagination
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: auto-load older external-session transcript on scroll + drop unsupported-item placeholder

1 participant