fix(workspace): dedupe run-change attribution for overlapping runs (#2404) - #2466
Open
suantea wants to merge 1 commit into
Open
fix(workspace): dedupe run-change attribution for overlapping runs (#2404)#2466suantea wants to merge 1 commit into
suantea wants to merge 1 commit into
Conversation
…KKOLearnAI#2404) When two sessions whose workspace points to the same directory run concurrently, the run-end diff scans the whole shared directory, so a file written by session B is also recorded as a workspace change of session A. Fix at the store layer: a change row whose (path, change_type, additions, deletions, size_before, size_after) fingerprint matches a row already attributed to a time-overlapping run is a directory-diff echo of the same physical write and is dropped; the attribution stays with the first run. The overlap guard keeps genuinely sequential runs intact: two runs that make byte-identical changes to the same file are distinct real events and must both be recorded. Zero-file changes (pure workspace_diff cards) are exempt. Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
suantea
force-pushed
the
fix/workspace-run-change-attribution-2404
branch
from
August 10, 2026 14:21
71bc188 to
ff96455
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2404
Problem
When two sessions whose
workspacepoints to the same directory run concurrently, a file written by session B during session A's active run is recorded as a workspace change of both sessions. The run-end diff scans the whole shared directory, so attribution is "whatever changed in the shared directory while this run was active" rather than "what this run actually wrote".Evidence from #2404 (production DB): the same physical file creation (
+122,size_after 6197,change_type 'added') appears under both session B's run and session A's overlapping run, with A's spurious row written at A'sfinished_at(the run-end diff).Fix (store layer)
insertWorkspaceRunChangenow drops directory-diff echoes of writes already attributed to a concurrently-active run:(path, change_type, additions, deletions, size_before, size_after)uniquely identifies one physical write.[started_at, finished_at]window overlaps this run's. Two sequential runs that make byte-identical changes to the same file (e.g. re-applying the same fix) are distinct real events and must both be recorded — they are never deduped.workspace_diffcards) are not deduplication and are persisted exactly as before.Verification
tests/server/workspace-run-change-dedupe.test.ts(4 tests): unique change recorded; overlapping echo dropped; partially-echoed run keeps its own files; sequential byte-identical modification preserved.tsc --noEmit -p packages/server/tsconfig.jsonclean.Co-Authored-By: AtomCode (deepseek-v4-flash) noreply@atomgit.com