Skip to content

undo is unreliable after CapCut saves: the app rewrites .capcut-cli-history/*.snap #151

Closed

Description

@Phelim2023315

Summary

On CapCut 9.5.0.4050 (Windows 10.0.19045, app_source = "cc"), saving a project in the app rewrote a history snapshot the CLI had just written. .capcut-cli-history/draft_content.json.000001.snap changed from the genuine pre-write content to a copy of the app's own draft_content.json.bak — content that already includes the CLI's edit. undo therefore has nothing correct to restore.

Reproduction

  1. Fresh empty project created by the app; app fully closed.
  2. capcut add-text <project> 2s 3s "…" — creates .capcut-cli-history/{draft_content.json,template-2.tmp}.000001.snap, both holding the pre-write file (4281B, 0 segments).
  3. Open the project in CapCut, save (Ctrl+S), close.
  4. Compare the snapshots:
.capcut-cli-history/draft_content.json.000001.snap
    before save:  cd0a3701…   4281B   0 segments    <- correct pre-write state
    after save :  7c8af639…   9551B   1 segment
                              ^ byte-identical to the app's own draft_content.json.bak

.capcut-cli-history/template-2.tmp.000001.snap
    before save:  cd0a3701…   4281B   0 segments
    after save :  cd0a3701…   4281B   0 segments    <- untouched

Note the asymmetry: the template-2.tmp snapshot is left alone while the draft_content.json one is replaced — and the replacement is byte-identical to the app's draft_content.json.bak (9551B), which is not the pre-write file either.

Impact

  • capcut undo after an app save restores the wrong content — the state at save time rather than before the CLI write.
  • It fails silently. The journal still records before_sha256 / after_sha256 for the CLI write, so history looks intact while one snapshot no longer matches its own journal entry.

Possible mitigations

  • Keep snapshots somewhere the app does not enumerate (it appears to touch files matching the primary draft's name inside the project tree).
  • Before restoring, verify sha256(snap) == journal.before_sha256 and refuse with a clear message when it does not match, rather than restoring silently.

Environment

CapCut 9.5.0.4050, Windows 10.0.19045, capcut-cli 0.29.0.

Before/after fixtures were captured with capcut fixture (media excluded, home paths redacted) and can be attached if useful.

Activity

  1. renezander030 commented on Oct 14, 2026

    @renezander030
    Owner

    Thanks for catching this and comparing the hashes! The snapshot is currently hard-linked to .bak, so an in-place app rewrite could explain both changing together. Could you attach the redacted before/after captures? Independent snapshots and hash checks before restore look like the right fix.

  2. renezander030 commented on Oct 16, 2026

    @renezander030
    Owner

    This is addressed in v0.30.0 (npm i -g [email protected]):

    • History snapshots are now their own files, no longer hard links to .bak, so the app rewriting .bak on save leaves them untouched.
    • restore checks the .bak or snapshot against the hash recorded before the write. If the file changed, it refuses (refused [backup-changed] / [snapshot-changed]) and points at an intact step; --force-write overrides.
    • restore --list shows intact, changed or unverified for each snapshot.

    Snapshots written by older versions are still hard links, so they will show as changed once CapCut has saved. New edits get independent snapshots.

    Closing as fixed in 0.30.0. If undo still breaks after CapCut 9.5.0.4050 saves on this version, comment here and I'll reopen.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions