Skip to content

Commit 1b3fa1a

Browse files
committed
fix: improve checkpoint error handling and race condition
- Show user-friendly notification when nested git repos prevent checkpoint initialization - Fix race condition in Task.ts where checkpoint restoration overlapped with first user message - Add proper i18n translations for all checkpoint error messages - Move error display logic to ShadowCheckpointService for better separation of concerns - Prevent checkpoint errors from disrupting the user experience
1 parent 04c4ff7 commit 1b3fa1a

File tree

21 files changed

+27
-14
lines changed

21 files changed

+27
-14
lines changed

src/core/checkpoints/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,6 @@ async function checkGitInstallation(
169169
log(`[Task#getCheckpointService] initShadowGit -> ${err.message}`)
170170
task.enableCheckpoints = false
171171
task.checkpointServiceInitializing = false
172-
173-
// If the error is due to nested git repositories, show a user-friendly message
174-
// but don't prevent the task from continuing
175-
if (err.message?.includes("nested git repositories")) {
176-
await vscode.window.showWarningMessage(
177-
"Checkpoints are disabled because nested git repositories were detected in the workspace. The task will continue without checkpoint support.",
178-
"OK",
179-
)
180-
// Task can continue without checkpoints
181-
}
182172
}
183173
} catch (err) {
184174
log(`[Task#getCheckpointService] Unexpected error during Git check: ${err.message}`)

src/core/task/Task.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
16641664
// Don't await this - let it run in the background so task can continue even if it fails
16651665
getCheckpointService(this).catch((error) => {
16661666
console.log(`[Task#initiateTaskLoop] Checkpoint service initialization failed: ${error.message}`)
1667+
// Explicitly set the flags to prevent race conditions
1668+
this.enableCheckpoints = false
1669+
this.checkpointServiceInitializing = false
16671670
// Task continues without checkpoints
16681671
})
16691672

src/i18n/locales/ca/common.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"checkpoint_timeout": "Timed out when attempting to restore checkpoint.",
3030
"checkpoint_failed": "Failed to restore checkpoint.",
3131
"git_not_installed": "Git is required for the checkpoints feature. Please install Git to enable checkpoints.",
32+
"nested_git_repos_detected": "Checkpoints are disabled because nested git repositories were detected in the workspace. To use checkpoints, please remove or relocate nested git repositories.",
3233
"no_workspace": "Please open a project folder first",
3334
"update_support_prompt": "Failed to update support prompt",
3435
"reset_support_prompt": "Failed to reset support prompt",

src/i18n/locales/es/common.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/common.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/common.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/common.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/it/common.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)