Repository navigation
feat(chat): native session scroll-back with offset paging and import-aware history - #105688
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3adff9794
ℹ️ 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".
| ...(historyPage.responseOffset !== undefined ? { offset: historyPage.responseOffset } : {}), | ||
| ...(hasMore ? { nextOffset } : {}), | ||
| ...(hasMore !== undefined ? { hasMore } : {}), | ||
| ...(historyPage.totalMessages !== undefined | ||
| ? { totalMessages: historyPage.totalMessages } | ||
| hasMore, |
There was a problem hiding this comment.
Return offset on first paginated history page
When callers make the normal first-page chat.history request without offset, this now emits hasMore/nextOffset but still omits offset; the agent-facing sessions history tool only preserves pagination when result.offset or a requested offset is present (src/agents/tools/sessions-history-tool.ts:235-237), so agents calling sessions.history without explicitly guessing offset: 0 cannot discover or request the older pages that this change exposes. Include offset: 0 on paginated first-page responses, or update that consumer alongside this contract change.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 12, 2026, 4:54 PM ET / 20:54 UTC. Summary PR surface: Source +336, Tests +1032, Other -2. Total +1366 across 17 files. Reproducibility: yes. Source inspection gives a high-confidence path: a default agent-tool request has no offset, the network response omits it, and the embedded sibling exposes paging only after an offset is already supplied. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Use one discoverable first-page pagination contract across network gateway, embedded gateway, agent-tool serialization, and Control UI; add real native-session UI proof, then explicitly accept the bounded imported-snapshot limitation or complete the linked cursor work first. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence path: a default agent-tool request has no offset, the network response omits it, and the embedded sibling exposes paging only after an offset is already supplied. Is this the best way to solve the issue? No, not yet. Offset paging plus the shared scroll-back UI is the right general direction, but the contract is incomplete across sibling runtime paths and the imported-history boundary needs explicit maintainer acceptance. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b640718204b1. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +336, Tests +1032, Other -2. Total +1366 across 17 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (2 earlier review cycles) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 667ff210c7
ℹ️ 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".
| ...(hasMore ? { nextOffset } : {}), | ||
| ...(hasMore !== undefined ? { hasMore } : {}), | ||
| ...(historyPage.totalMessages !== undefined | ||
| ? { totalMessages: historyPage.totalMessages } | ||
| hasMore, | ||
| totalMessages: pagination.totalMessages, |
There was a problem hiding this comment.
Keep embedded chat.history paging in sync
When OpenClaw runs in embedded mode, sessions_history is routed through createEmbeddedCallGateway (src/agents/openclaw-tools.ts:458-576), but that sibling chat.history implementation still only returns hasMore/nextOffset when the caller already supplied offset (src/agents/tools/embedded-gateway-stub.ts:461-468). A first sessions_history read in embedded mode therefore cannot discover older native messages even though this gateway path now advertises first-page pagination; mirror the new first-page pagination contract there as well.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…aware history (openclaw#105688) * feat(chat): native session scroll-back with import-aware history paging * fix(chat): page imported session history * fix(chat): restore terminal import snapshots * fix(chat): gate cli import resolver on ignore flag to stop history recursion * fix(chat): correct scroll-back types and drop orphaned recent-messages reader
What Problem This Solves
Native OpenClaw sessions had no scroll-back:
chat.historyreturned a single recent tail window and the Control UI offered no way to reach older messages. Catalog (Claude Code / Codex) sessions already got automatic scroll-back in #105209; native sessions — the far more common case — did not.Closes #105127.
Why This Change Was Made
Unify the older-history experience across native and catalog sessions using the same UI machinery (IntersectionObserver top sentinel, spinner row, viewport anchoring, bounded cursor guards) landed in #105209, backed by a new offset paging contract on
chat.history.Server:
chat.historyacceptsoffsetand returns{hasMore, nextOffset, totalMessages}(ChatHistoryPagination); offset pages read strictly-older transcript slices without re-materializing the whole session.completeSnapshotwithheld when byte caps truncate the response (honest signal for the deferred opaque-snapshot-cursor follow-up, [Feature]: snapshot-cursor paging for oversized imported CLI transcripts in chat.history #105644).ignoreCliSessionImportsnow gates the import resolver itself, so the re-entry terminates in local-only paging.UI:
olderOffsetsSeenguarding against cursor loops and message identity dedupe on prepend.User Impact
Scrolling up in any native session now automatically loads older messages with a loading indicator, without reloading the session. Bound Claude CLI sessions no longer risk a gateway-pegging infinite loop on a realistic dedupe layout.
Evidence
node scripts/run-vitest.mjs src/gateway/server.chat.gateway-server-chat-b.test.ts ui/src/pages/chat/chat-pane.test.ts ui/src/e2e/claude-sessions.e2e.test.ts— green (126 + 27 + 2 tests).chat.history terminates when the full local read dedupes every claude-cli import) spins the gateway at ~100% CPU indefinitely; with the fix it passes.nextOffset > offsetfor pathological multi-sibling records and eventual access to the oldest record.mainbound sessions already return one merged tail withhasMore: false, so this branch strictly widens reachable history and adds the honest withheld-completeSnapshotsignal; (b) one full local-transcript read per snapshot load mirrors the complete external JSONL scan the import reader already performs onmain(same O(N) class, once per load, not per page — the per-page O(N²) variant was reverted). Both get the proper fix via the opaque snapshot cursor in [Feature]: snapshot-cursor paging for oversized imported CLI transcripts in chat.history #105644.