Skip to content

fix: prevent stale pointer writes in RefreshDiffs#345

Merged
tomasz-tomczyk merged 1 commit intomainfrom
fix/refresh-diffs-stale-pointers
Apr 24, 2026
Merged

fix: prevent stale pointer writes in RefreshDiffs#345
tomasz-tomczyk merged 1 commit intomainfrom
fix/refresh-diffs-stale-pointers

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

  • Replace captured *FileEntry pointers with path-based lookups in the write-lock section of RefreshDiffs()
  • If RefreshFileList runs between the read-lock snapshot and write-lock assignment (possible during concurrent agent requests via runAgentCmd), captured pointers could reference orphaned entries, silently losing diff updates

Test plan

  • go build ./... — compiles clean
  • go vet ./... — no issues
  • go test ./... — all tests pass
  • Manual: start review, trigger agent request while diffs are computing — diffs should update correctly

🤖 Generated with Claude Code

Look up FileEntry by path in the write-lock section instead of using
pointers captured under the earlier read-lock. If RefreshFileList runs
between the two lock sections (possible during concurrent agent
requests), the captured pointers could reference orphaned entries,
silently losing diff updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tomasz-tomczyk tomasz-tomczyk merged commit 59a8af8 into main Apr 24, 2026
4 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the fix/refresh-diffs-stale-pointers branch April 24, 2026 08:40
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