Skip to content

fix(history): make snapshots durable and keep history controls visible - #159

Merged
LeoStehlik merged 4 commits into
masterfrom
fix/page-history-reliability
Nov 21, 2026
Merged

LeoStehlik merged 4 commits into
masterfrom
fix/page-history-reliability

Conversation

@LeoStehlik

@LeoStehlik LeoStehlik commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

A browser edit could save successfully but never reach page history if an ancillary queue failed after the page transaction. Title-only changes were not scheduled, and the history worker ignored them. History also sorted random agent IDs as if they were chronological. Separately, fixed-height history panels hid Restore/Cancel/diff controls on short desktop screens, and an open history dialog never refreshed its list.

This PR addresses persistence, presentation, and change navigation:

  • Commit pending snapshot work with body/title/icon edits in PostgreSQL. A bounded worker coalesces edits using the existing one-/five-minute windows, captures and acknowledges snapshots atomically, retains failures with backoff, and transfers legacy BullMQ history jobs. Notification/indexing/watcher failures cannot discard the pending snapshot.

  • Order versions by capture timestamp and ID. Cursor anchors resolve their timestamps in SQL, preserving microseconds and compatibility with existing ID cursors. Agent snapshots also retain icon/cover metadata.

  • Fit the dialog to the viewport, keep controls outside scrolling panels, refresh while open, and show pending/retrying snapshot status. Indicate title/metadata changes and formatting-only differences that text highlighting cannot show.

  • Navigate using scroll-viewport coordinates, so changes inside positioned table cells no longer jump to the top. A synthetic three-location page reproduced the original failure; the fix also covers manual scrolling and wraparound.

The page-history user guide explains the one-/five-minute grouping windows, pending/retry notices, automatic refresh, and local timestamps shown in 12-hour format, change-arrow behaviour, and restoring a version. It is linked from the README and operations notes.

Data and deployment

The additive migration creates one pending-work table and two indexes. It does not rewrite/delete existing pages, versions, audit records, or uploads. Snapshot grouping remains intentional; this does not create a version for every keystroke or reconstruct previously missing versions. Deployment/recovery guidance is in docs/page-history.md.

The reported page-specific loading failure remains deferred in #158. This PR does not claim to diagnose or fix that separate report.

Validation

  • Full server/client/editor-extension production build and client type check.
  • 228 server tests across 33 suites; 35 editor-extension tests; three formatting-diff regressions.
  • Disposable PostgreSQL integration: queue outage, transactional rollback, restart/coalescing, title-only edits, retained retry diagnostics, watcher failure, concurrent writers/workers, timestamp precision, forward/backward pagination, capture-time ordering, and legacy queue transfer.
  • Chromium and WebKit: controls/dialog within 1366×768, 1280×720, 1024×600, 900×450, 420×800 and 320×568; formatting notice; pending status; automatic list refresh; polling stops on close. Synthetic content only.
  • Existing multi-process MCP regression passed, including permissions, tool edits, rich content, retries, comments/history, and token lifecycle.
  • Dedicated history regression workflow added.
  • Follow-up navigation regression passed in Chromium and WebKit: single/separated/table-cell changes, both directions, wraparound, and manual scrolling at 1280×720, 900×450, and 420×800. Client type check passed.
  • Live acceptance check: a browser edit on an established page produced its snapshot after the five-minute window; pending work cleared and the snapshot matched the saved content and title.

Deployed at commit c38da15 (including the navigation fix and user guide) to the maintainer’s test instance and accepted after live testing. Merged into master after all five CI checks passed. Startup is healthy, the additive migration applied, existing content hashes matched before/after deployment, and the database/storage were retained.

DCO sign-off

All commits include a Signed-off-by line matching the contributor identity. Implemented from WrenLore code and reproduced behaviour; no post-fork upstream or proprietary code was used.

@LeoStehlik
LeoStehlik merged commit 34e507d into master Nov 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant