Skip to content

fix(server): preserve Claude rewind across fork history changes - #612

Merged
rynfar merged 4 commits into
pylonfrom
upstream/2026-09-17-claude-rewind
Sep 18, 2026
Merged

rynfar merged 4 commits into
pylonfrom
upstream/2026-09-17-claude-rewind

Conversation

@rynfar

@rynfar rynfar commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Claude native forks can retain the correct conversation while changing system-message history length. Rewind now validates retained conversation bodies and remaps their fork UUIDs, preserving Pylon’s session ownership and checkpoint guards.

Adopts upstream #11954, source eed974c122e192de45b54b7dac7ca1a51448c08f, with original author maria and coauthor provenance preserved. Part of #611; frozen upstream head 6d1d549441be84f19696ab59ed7e2fbf305280d4. The review cursor remains unchanged.

Validation:

  • All 173 Claude adapter tests pass, covering system metadata changes, restored ancestry, missing/reordered/changed conversation, malformed targets, stopped sessions and subsequent rewind.
  • Scoped server typecheck and lint passed in the implementation worktree.
  • A separate Antigravity adversarial reviewer found nine existing startup-fencing fixtures changed message bodies during simulated forks. The fixtures now model the SDK correctly; production validation remains strict and all nine fencing assertions pass.
  • No wire, persistence, migration or client contract changes. Backend behavior is shared by web, desktop and mobile, including remote connections. No live paid-provider session was required or claimed.

Implementation and adversarial review used Gemini 3.8 Flash High through Pylon’s Antigravity delegation; integration and verification used GPT-6 through Codex.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

maria-rcks and others added 4 commits September 17, 2026 18:10
…954)

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit eed974c122e192de45b54b7dac7ca1a51448c08f)
…nd rollback ownership

Cover fork ancestry reordering, changed history lengths with interleaved
system notices, negative conversation offset rejection, target validation
(integers >= 1), empty session history, unresolvable turn boundaries,
original session ownership preservation on failure, and stale session
fencing during fork history reads.
…startup fencing test

Startup event stamp fencing tests used synthetic message content { content: uuid },
which made mock fork message bodies ('fork-user-1') diverge from retained ancestry
('user-1'). Under PR #11954 turn remapping, ancestry divergence correctly rejects
the fork before session restart, leaving the stamp hook unresolved and hanging the
test. Strip the fork prefix so test mock messages model genuine fork message retention.
@vercel

vercel Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pylon-marketing Ready Ready Preview Sep 18, 2026 12:21am UTC

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 18, 2026
@rynfar

rynfar commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

Independent Antigravity adversarial review completed on author head 5498dfbac6ccd567991c7d9c7cd4bcad07451d30 (same implementation/test contents as this PR; integration commits only change hashes and add the decision index).

The reviewer found the nine startup-stamp fixture failures; these are resolved by preserving message bodies across simulated forks. The reviewer rechecked the final fixture correction and additional adversarial cases and reported no remaining blockers. Original and corrected validation runs confirm 9 failures / 164 passes before the fixture fix, then 173 / 173 passes after it. Production deep-content validation was not weakened.

Review covered suffix alignment, duplicate message bodies, metadata omission/insertion, tool results and steering, UUID remapping, reset-all, failed-fork state preservation, stop/replacement fencing, and account-scoped history workers. Server typecheck and targeted lint passed. Native paid-provider execution is not claimed.

@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 14.0 KiB 13.9 KiB −23 B (−0.2%) 15.1 KiB ✅
Codex Thread snapshot wire 7.2 KiB 7.2 KiB +9 B (+0.1%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.7 KiB 6.7 KiB −32 B (−0.5%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 58.0 KiB 58.0 KiB 0 B (0.0%) 66.4 KiB ✅
Codex Live turn messages 9 9 0 (0.0%) 21 ✅
Claude Total thread wire 14.0 KiB 14.0 KiB +20 B (+0.1%) 15.1 KiB ✅
Claude Thread snapshot wire 7.2 KiB 7.2 KiB +10 B (+0.1%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.7 KiB 6.8 KiB +10 B (+0.1%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 58.9 KiB 58.9 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 9 9 0 (0.0%) 21 ✅

Baseline: 738b5ed · PR result: 67171d0 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 115.7 KiB
  • Claude decoded thread snapshot: 116.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

This branch was successfully deployed

1 active deployment
Preview — 67171d01 Deployed Sep 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants