Conversation
…g cold-start resume
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
|
Move restoreWorkspace() inside the try/catch block so that clone or branch-checkout failures also trigger workspace cleanup. Previously, a failure in manageBranch (after .git was created) would leave the workspace in a state where the next retry saw isColdStart = false and skipped the full restore flow.
jeanduplessis
approved these changes
Mar 9, 2026
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
When a post-clone step (e.g.
kilo import, snapshot fetch, diff apply) fails during cold-start resume, the workspace directory — including.git— was left behind. On the next retry,handleColdStartResumesawisColdStart = false(because.gitexisted) and skipped the full restore flow, leaving the session in a broken half-initialized state.This wraps the post-clone steps in
handleColdStartResumein a try/catch that callscleanupWorkspace()on failure, removing the workspace and session home directories so the next retry sees a true cold start and re-runs the full restore from scratch. This applies to all failure modes, includingSessionSnapshotRestoreError(404).Two tests are added covering the workspace-cleanup behavior on import failure and on 404 snapshot response.
Verification
pnpm vitest run— all 641 tests passpnpm typecheck— passesVisual Changes
N/A
Reviewer Notes
cleanupWorkspacehelper (fromworkspace.ts) removes both the workspace directory and the session home directory usingsession.exec(). This is best-effort — the original error is always re-thrown.02d0959) corrected this to also clean up on 404 since a stale.gitcauses the same warm-start misrouting regardless of the error type.