Skip to content

fix(chat): older history stops loading from legacy transcripts - #188488

Merged
roboclaw-bot merged 7 commits into
mainfrom
openclaw/frv-history-offsets-410719
Oct 30, 2026
Merged

roboclaw-bot merged 7 commits into
mainfrom
openclaw/frv-history-offsets-410719

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #188372

What Problem This Solves

Fixes: clients stop loading older history when a legacy transcript page cannot supply native message IDs, including the initial CLI-import page.

User Impact

User impact: clients consuming numeric history continuation can reach older messages from both initial and explicit-offset pages. Exhausted hidden history still terminates. No configuration change, migration, or user action is required.

Why This Change Was Made

The existing response owner now uses the page’s numeric-pagination metadata and the reader’s hasOlder result, rather than requiring an explicit-offset echo or an encodable message-ID cursor. Cursor-only pages, source fences, and byte budgets are unchanged. The centered-page assertion matches the existing cursor metadata contract.

The repair adds one net production line and 41 test lines against 4cc05039…. The unique 41-line allocation covers the two legacy initial-page regressions and extending existing hidden-prefix exhaustion checks to explicit offset zero; the shared baseline is unchanged. No new state, public fields, storage-writer behavior, schema, dependencies, timeouts, or UI code are introduced.

Evidence

  • Scheduled main run 41071928241, job 124118722165 failed the original offset-gap and centered-page cases. Those assertions reproduced on unmodified 4cc05039… through the real WebSocket Gateway suite under Node 24.22.1.
  • New regressions load supported legacy rows without IDs through the existing import fixture, request the initial CLI page with limits 1 and 2, and walk returned numeric offsets without losing rows. Both fail on the previously published implementation. Fresh-ID CLI cases already passed and were controls, not the red proof.
  • Actual ci-run-node-test-shard.mts / bun-all execution, Node 24.22.1 orchestration and repository-pinned Bun 191755ec1: 106/106 pass—62 full WebSocket Gateway cases plus 44 CLI-import/cursor/budget cases. Default and explicit hidden-prefix/tool-only exhaustion, reversible byte-limited walks, and transcript-replacement fences pass.
  • Core production typecheck and all 29 selected dependent test graphs pass. Changed-file type-aware lint, formatting, exact test-line ratchet, and diff checks pass.
  • Fresh independent canonical autoreview: complete five-file snapshot against 4cc05039…, P0–P3, GPT-6.1 Sol, scoped-clean, no actionable findings. Complete reader, CLI, cursor, byte-budget and UI-consumer context was supplied. The original hosted review found no defects on the prior revision; it is not represented as review of this update.
  • Unchanged-module-graph unused-file evidence: production scan has zero entries; full-tree scan reports three untouched performance scripts (control-ui-forbidden-catalog-measure.ts, github-publication-read-measure.ts, transcript-turn-gateway.mts). No ignores or baseline weakening.
  • Current head 62be5a09… passed CI 41095455757, attempt 1. The earlier e4925792… run was not reused as current-head proof; no CI rerun was requested.
Red/green boundary trace
Before: published implementation + legacy import fixture (Bun)
  limit=1: hasMore=false; nextOffset missing; totalMessages=5
  limit=2: hasMore=false; nextOffset missing; totalMessages=8
  Tests: 2 failed | 18 passed (20)
After: coherent response-owner repair (Bun)
  CLI/cursor/budget: 44 passed (44)
  Gateway chat:      62 passed (62)

The fixed initial pages retain numeric continuation and the complete walk recovers the earlier imports and every legacy row. This is real Gateway RPC/worker-path proof, not browser visual proof or a full scheduled-main replay.

Requested by Vincent Koc.

Work sessions

roboclaw-bot and others added 6 commits October 27, 2026 13:11
Refuse the retained post-open validation publication instead of the redundant
schema-open checkpoint intentionally removed by #185760. Keep the during-open
refusal, all four failure rows, real reader barrier, exact refusal count,
physical-owner rejection, and cleanup assertions. Production code is unchanged.

Reproduced scheduled main run 40496973076, attempt 1, job 122165204064 at
8d9d946: 11 passing tests and the same
after-open failure. The final candidate and schema-admission keeper pass all
16 tests in 22.69 seconds wall time. Typed lint, formatting, line ratchets and
independent P0-P2 review pass. The patch adds zero net test lines.

At the tested a4a8f63 base, the full-tree unused-file scan reports eight
untouched scripts; production scan passes and no changed path is reported.
The subsequently incorporated main changes are disjoint from the reviewed
reader, worker, state, transcript, test-runner and dependency inputs.

Work session: https://team.openclaw.ai/chat/roboclaw/~key/dashboard/f2d13397-ed54-4d44-ade1-12b2edc3d0e3

Co-authored-by: vincentkoc <[email protected]>
Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: b4478a06-9f85-4034-aeec-975c3e197b4c
Reconcile the completed worktree with the verified failing main head and preserve its history. Explicitly restore the cold transcript before the lifecycle fixture reads it.

Co-authored-by: vincentkoc <[email protected]>
Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: f37bdf97-875f-4437-ac04-32a29baab130
Honor reader-owned hasOlder for explicit offset pages whose legacy records lack native message IDs. Keep cursor-only exhaustion unchanged and align the centered-page assertion with its existing cursor contract.

Co-authored-by: vincentkoc <[email protected]>
Integrate the exact reviewed and tested b77f135 snapshot. Preserve canonical #186193 archive fixture bytes instead of the retired duplicate fix from closed #186152.

Co-authored-by: vincentkoc <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 30, 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 gateway Gateway runtime size: XS labels Oct 30, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 30, 2026 15:47
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) October 30, 2026 15:54
@roboclaw-bot
roboclaw-bot disabled auto-merge October 30, 2026 15:55
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves numeric continuation for initial and explicit-offset history pages whose legacy messages lack native IDs.

Example: A CLI-backed conversation contains two earlier imported messages and three newer legacy messages; the client requests limit=1.

  • Before: The initial page reports hasMore=false without nextOffset, leaving four older messages unreachable through numeric pagination.
  • After: The initial page reports hasMore=true and nextOffset=1, and successive offset requests recover all five messages.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-supported, with relevant reported harness validation and no actionable findings; standalone shipped-entry-point evidence is absent.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor proof gate; its supplied red/green trace covers legacy initial pages through the production handler/worker harness, while inspected screenshots cover only the predecessor's UI scenario.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Clients following numeric history offsets stop before reaching older messages when legacy transcript rows cannot provide native-ID cursors.
Reason: The collaborator-authored direction restores an existing pagination contract, introduces no configuration or public fields, and keeps the predecessor's exhaustion behavior.

Regression provenance

Regression provenance — verified: source commit 3d7b4c47e9c8 by Peter Steinberger; canonical PR #188372 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a concrete legacy-history pagination regression still present on fetched main, and review found no introduced defect.

Priority: P2
Reviewed head: 62be5a097fcbe8ff42dc24b7fd6b4cd73687caac

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A standalone shipped Gateway legacy-history offset walk is not supplied; the ordinary contributor proof gate does not apply to this collaborator-authored PR.
Agent review details

How this fits together

The Gateway history reader converts stored and imported transcripts into bounded display pages; the response owner publishes messages, cursors, and numeric continuation metadata to clients.

flowchart LR
  A[Client history request] --> B[Gateway history handler]
  B --> C[Canonical and CLI transcript readers]
  C --> D[Display page and reader progress]
  D --> E[Response budget and continuation owner]
  E --> F[Messages and paging metadata]
Loading

Technical review

Best possible solution:

Retain the existing response owner's numeric continuation repair while preserving reader-owned exhaustion, source cursors, and byte budgets.

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

The current-main cursor-only condition establishes the failure for ID-less numeric pages, and the supplied trace reports the corresponding legacy regressions failing before repair; this review ran no target code.

Is this the best way to solve the issue?

This is the smallest complete repair at the existing continuation owner: pagination metadata identifies numeric pages, and the reader's hasOlder fact preserves exhaustion semantics.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • History continuation calculation changes intended behavior with a stated reason (3d7b4c4: Stop advertising unusable cursor continuation after the reader consumes an older hidden prefix.)
  • Hidden-prefix exhaustion coverage keeps the original intent (3d7b4c4: Ensure hidden and tool-only tails terminate without unusable continuation metadata; this PR retains those assertions and adds explicit offset zero.)
  • Centered-page response assertion changes intended behavior with a stated reason (143fed8: Centered history originally omitted numeric pagination metadata; the later cursor contract permits hasMore independently of numeric offsets.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5046692 adds src/gateway/server-methods/chat-history-response-page.ts:226 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 504669209392; files: src/gateway/server-methods/chat-history-response-page.ts)
  • Vincent Koc: Raw commit e5ca68c adds src/gateway/server-methods/chat-history-page-cursor.test.ts:107 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e5ca68c31a7c; files: src/gateway/server-methods/chat-history-page-cursor.test.ts)

PR surface

Source +1, Tests +41, Other +2. Total +44 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 2 +1
Tests 3 50 9 +41
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 5 55 11 +44

Review metrics

Metric Value Why it matters
Production versus test growth Production +3/-2; tests +50/-9 The small production repair reuses existing progress metadata; test growth adds legacy initial-page walks and extends existing exhaustion coverage.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Numeric-pagination clients can lose access to older legacy history, without demonstrated transcript deletion or a broader runtime outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 (1 earlier review cycle)
  • reviewed 2026-10-30T16:03:56.824Z sha e492579 :: needs maintainer review before merge. :: none

Reviewed October 30, 2026, 1:17 PM ET / 17:17 UTC (Revision 2).

Retain numeric continuation whenever the page owns numeric pagination and the reader reports older rows. Preserve native cursor/source fences and hidden-prefix exhaustion.

Apply the exact independently reviewed and verified c36517b2 tree, with real legacy CLI-import regressions and 106 passing Bun cases.

Co-authored-by: vincentkoc <[email protected]>
@roboclaw-bot roboclaw-bot changed the title fix(chat): older history stops early with numeric offsets fix(chat): older history stops loading from legacy transcripts Oct 30, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 30, 2026
@roboclaw-bot
roboclaw-bot merged commit a3df6c6 into main Oct 30, 2026
142 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/frv-history-offsets-410719 branch October 30, 2026 17:49
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…law#188488)

Keep older legacy chat history reachable from initial and explicit numeric pages when native message IDs are unavailable. Use the page’s existing numeric-pagination metadata and reader-owned hasOlder result, preserving hidden-prefix exhaustion, native cursor/source fences, and byte budgets.

Preserve the centered-page cursor metadata contract. Add real legacy CLI-import regressions for limits one and two, with lossless numeric traversal, and retain default/explicit hidden-prefix and byte-limited cursor coverage.

Verification: original Gateway assertions reproduced on the unmodified base; new legacy initial cases fail on the previous implementation. The coherent repair passes 106 actual Bun cases, core production and 29 dependent test type graphs, changed lint/format/ratchets, and fresh independent review. Current-head CI and protected landing are recorded separately in the native receipt.

Work session: https://team.openclaw.ai/chat/roboclaw/~key/dashboard/f2d13397-ed54-4d44-ade1-12b2edc3d0e3

Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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