fix(handoff): set mode and repositoryId together on cloud hand off#1958
Merged
jonathanlab merged 2 commits intomainfrom Apr 30, 2026
Merged
fix(handoff): set mode and repositoryId together on cloud hand off#1958jonathanlab merged 2 commits intomainfrom
jonathanlab merged 2 commits intomainfrom
Conversation
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/main/services/handoff/service.test.ts:89-90
**`workspaceRepo` mock incomplete for new execute path**
`attachWorkspaceToFolder` calls `this.workspaceRepo.findByTaskId(taskId)` and `this.workspaceRepo.setModeAndRepository(...)`, but the mock here only provides `updateMode`. Any test that exercises `service.execute()` will throw `"workspaceRepo.findByTaskId is not a function"` rather than a clear test failure. Worth extending the mock now so future execute-path tests don't silently regress.
### Issue 2 of 2
apps/code/src/main/services/handoff/handoff-saga.ts:127-137
**Mutable closure variable for revert leaks state across async boundary**
`attachmentRevert` is captured in a mutable outer variable and assigned inside the `execute` callback. The saga framework guarantees `execute` runs before `rollback`, so this is safe today, but it's a fragile pattern — if the step API ever changes or a parallel step is introduced, the rollback could silently call `null?.()` instead of the real revert. Returning the revert through the saga step's output type, if the framework supports it, would be cleaner.
Reviews (1): Last reviewed commit: "fix(handoff): set mode and repositoryId ..." | Re-trigger Greptile |
k11kirky
approved these changes
Apr 30, 2026
Generated-By: PostHog Code Task-Id: e2a44dd9-f5de-433e-8d8c-dce9920f20ba
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.
The cloud to local handoff saga only set workspace.mode to "local" but left repositoryId null, which broke everything.
Created with PostHog Code