fix(sync): separate init and sync commands, extract file discovery#2613
Merged
tusharmath merged 21 commits intomainfrom Mar 23, 2026
Merged
fix(sync): separate init and sync commands, extract file discovery#2613tusharmath merged 21 commits intomainfrom
tusharmath merged 21 commits intomainfrom
Conversation
🤖 Augment PR SummarySummary: This PR changes workspace syncing so it no longer implicitly creates/registers a workspace on first sync. Changes:
Technical Notes: Sync now depends on 🤖 Was this summary useful? React with 👍 or 👎 |
e9d60d2 to
0224542
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.
Summary
Separate the
syncandinitworkspace commands so thatsyncno longer auto-creates a workspace, and introduce a dedicated--initflag (andsync-initslash command) for first-time workspace setup.Context
Previously,
workspace syncwould silently auto-create a workspace if one did not exist, blurring the distinction between initializing and synchronizing a workspace. This caused confusion and made it difficult to run sync safely in environments where the workspace had not been explicitly set up. The fix ensures thatsyncis purely a sync operation and initialization is an explicit, opt-in step.Changes
Core Behavior Change
workspace syncno longer auto-creates a workspace — it will fail gracefully if no workspace exists for the given path--initflag onworkspace syncconditionally initializes the workspace first (only if it does not already exist), then proceeds with syncsync-initbuilt-in slash command and shell plugin action are added to exposeworkspace initdirectly from the UIRefactoring: File Discovery Extraction
The file discovery logic that was embedded in
context_engine.rshas been extracted into three focused modules:fd.rs—FileDiscoverytrait,ALLOWED_EXTENSIONSfilter,discover_sync_file_pathshelper, andFdDefaultrouting implementationfd_git.rs—FsGit: git-based discovery viagit ls-filesfd_walker.rs—FdWalker: filesystem-walker-based fallbackThis makes each strategy independently testable and removes ~200 lines from
context_engine.rs.API Simplification
sync_workspaceno longer takes abatch_sizeparameter — batch size is now sourced from the environment internally, removing an accidental public API surfaceget_workspace_by_pathhelper added tocontext_engine.rsfor DRY path-to-workspace resolution with a clear error messageMCP Cleanup
timeoutfield fromMcpStdioServerandMcpHttpServer(and associated tests) — timeout configuration is handled globally viaFORGE_MCP_TIMEOUTShell Plugin
_forge_action_syncnow passes--initso the interactive sync flow still sets up the workspace on first use_forge_action_sync_initaction andsync-initdispatcher entry for explicit init-only flowsTesting