Skip to content

Small refactor / simplification#441

Open
Soph wants to merge 1 commit intomainfrom
soph/small-rewind-refactor
Open

Small refactor / simplification#441
Soph wants to merge 1 commit intomainfrom
soph/small-rewind-refactor

Conversation

@Soph
Copy link
Collaborator

@Soph Soph commented Feb 20, 2026

Entire-Checkpoint: af494d0087bc

Entire-Checkpoint: af494d0087bc
@Soph Soph requested a review from a team as a code owner February 20, 2026 10:13
Copilot AI review requested due to automatic review settings February 20, 2026 10:13
@cursor
Copy link

cursor bot commented Feb 20, 2026

PR Summary

Low Risk
Small internal refactor that centralizes existing write-path logic; behavior should remain the same aside from potential subtle error-path/permission propagation differences.

Overview
Refactors transcript restoration during rewind to remove duplicated logic when checkpoint/shadow-commit data includes agent exportData (e.g., OpenCode).

Both restoreSessionTranscriptFromStrategy and restoreSessionTranscriptFromShadow now delegate to a shared helper, writeSessionWithExportData, which resolves the transcript path, ensures directories exist, and invokes agent.WriteSession for combined file write + native import.

Written by Cursor Bugbot for commit ee37431. Configure here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR performs a refactoring to eliminate code duplication by extracting common logic into a helper function. The changes extract identical code blocks from two functions (restoreSessionTranscriptFromStrategy and restoreSessionTranscriptFromShadow) that both handle session restoration with export data.

Changes:

  • Extracted duplicated session restoration logic into new helper function writeSessionWithExportData
  • Both caller functions now invoke this helper instead of duplicating the implementation
  • Minor comment update for consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments