Updated Token Count - #60
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves Git workspace preparation reliability under concurrency by adding a cross-process mutation lock around shared-clone Git operations and by switching base-branch updates to a private snapshot ref (refs/symphony/origin/<base_branch>) rather than broad/pruning origin fetches.
Changes:
- Added a cross-process shared-clone mutation lock using a
<shared_clone_path>.lockfile and lock metadata for debugging. - Updated base-branch fetching and worktree creation to use a private snapshot ref (
refs/symphony/origin/<base_branch>). - Added an integration test intended to verify that workspace preparation waits for the mutation lock.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Symphony.Infrastructure.Workspaces/GitWorktreeWorkspaceManager.cs | Adds cross-process file locking around shared-clone mutations and fetches base branch into a private snapshot ref for safer worktree creation. |
| tests/Symphony.Integration.Tests/WorkspaceManagerTests.cs | Adds an integration test for the shared-clone mutation lock behavior. |
| docs/UserGuide.md | Documents the new cross-process lock and private snapshot ref fetch behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+296
to
+306
| var stream = new FileStream( | ||
| lockPath, | ||
| FileMode.OpenOrCreate, | ||
| FileAccess.ReadWrite, | ||
| FileShare.None, | ||
| bufferSize: 1, | ||
| FileOptions.None); | ||
|
|
||
| WriteLockMetadata(stream, sharedClonePath); | ||
| return stream; | ||
| } |
Comment on lines
+122
to
+123
| var firstCompleted = await Task.WhenAny(prepareTask, Task.Delay(TimeSpan.FromMilliseconds(500), cts.Token)); | ||
| Assert.NotSame(prepareTask, firstCompleted); |
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.
This pull request introduces significant improvements to the reliability and safety of Git workspace preparation in Symphony by adding cross-process locking for shared Git clones and switching to private, non-pruning fetches for base branch snapshots. It also adds comprehensive tests for the new locking mechanism and refactors related code for clarity and correctness.
Concurrency and Safety Improvements:
<shared_clone_path>.lockfile to serialize Git mutations across processes, preventing race conditions and.git/configlock contention during concurrent workspace preparations. (src/Symphony.Infrastructure.Workspaces/GitWorktreeWorkspaceManager.cs,docs/UserGuide.md) [1] [2]AcquireSharedCloneMutationLockAsyncmethod to handle creation and acquisition of the lock file with metadata for debugging. (src/Symphony.Infrastructure.Workspaces/GitWorktreeWorkspaceManager.cs) [1] [2]Git Fetch and Worktree Handling:
refs/symphony/origin/<base_branch>snapshot instead of updating/pruning all remote refs, reducing side effects and improving reproducibility. (src/Symphony.Infrastructure.Workspaces/GitWorktreeWorkspaceManager.cs,docs/UserGuide.md) [1] [2] [3]origin/<base_branch>. (src/Symphony.Infrastructure.Workspaces/GitWorktreeWorkspaceManager.cs)Testing:
PrepareIssueWorkspaceAsyncwaits correctly for the shared clone mutation lock, verifying the new locking mechanism works as intended. (tests/Symphony.Integration.Tests/WorkspaceManagerTests.cs)These changes collectively improve the robustness of workspace management, especially in environments with high concurrency.