Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: anthropics/claude-code
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: konsta95/claude-code
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fix/diff-clear-resume-races-2
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 4 files changed
  • 2 contributors

Commits on Sep 27, 2026

  1. mods/diff: settle async work by session epoch, so /clear and /resume …

    …discard work from the session they ended
    
    Four clear/resume races reproduce on main 7779afb under the plugin's own function-hook tests: a refresh pending at /clear duplicates the fresh read; a git read started before /clear publishes its obsolete snapshot afterwards; a delayed restored-history read from the previous session reopens the pane after /clear, and likewise after /resume.
    
    refresh, openPane, openOnFirstEdit, openOnRestore and the /diff command now capture pin.epoch, as probeBackend already does, and drop their result once unpin() has moved it. The clear/resume handler cancels the pending refresh timer and the queued refresh. A /diff that /clear or /resume interrupts answers "The session changed. Run /diff again to show the diff panel." instead of opening a pane for the session that ended. Failure marks (git_diff_failed, git_hunks_failed) are still recorded for a read that spans /clear.
    
    Replaces a7e4ee4 (on 7974a70), whose read-only half already landed with #95423.
    
    Tests on Claude Code 2.1.283, following the Mod tests workflow: tsc -p mods/tsconfig.json with typescript 5.9.3 is clean; claude plugin test gives mods/diff 178 pass / 0 fail, and the other mods pass. Control, the same tests over main's register.ts: 164 pass / 14 fail, the four races among them. The fake process results carry isStdoutTruncated and isStderrTruncated, so the tests also typecheck merged with #97293.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Claude-Session: a8a0b1ef-4a1b-460a-a37b-2b32fa7f2909
    konsta95 and claude committed Sep 27, 2026
    Configuration menu
    Copy the full SHA
    ec71cba View commit details
    Browse the repository at this point in the history
Loading