fix(tasks): only reconcile cloud tasks into workspace registry#2153
Merged
Conversation
…istry
The sync-cloud-tasks reconciliation effect was creating a cloud workspace
for every task without a local workspace, including local-worktree tasks
mid-creation. The TaskCreationSaga invalidates `useTasks` before it calls
`workspace.create.mutate({ mode: "worktree" })`, so a new worktree task
briefly appears with no workspace and races against this effect, ending
up registered as cloud.
Filter the reconciliation to only tasks whose `latest_run.environment`
is "cloud".
Generated-By: PostHog Code
Task-Id: ee21f72a-87af-4505-926a-a22cc881b47b
Contributor
|
Reviews (1): Last reviewed commit: "fix(tasks): only reconcile cloud-environ..." | Re-trigger Greptile |
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.
Problem
When the
posthog-code-sync-cloud-tasksflag is enabled, creating a new local worktree task ends up registered as a cloud task. Paul hit this and confirmed it goes away after he removes himself from the flag.The reconciliation effect added in #2146 (apps/code/src/renderer/components/MainLayout.tsx) creates a
cloudworkspace for every task without a local workspace, regardless of the task's actual environment. TheTaskCreationSagacallsonTaskReady(which invalidatesuseTasks) beforeworkspace.create.mutate({ mode: "worktree" }), so a freshly-created worktree task briefly appears intaskswith no workspace and races the reconciliation effect — which wins and registers it ascloud.Changes
Filter reconciliation to only tasks whose
latest_run?.environment === "cloud". Local-worktree tasks mid-creation no longer match, so the saga's workspace.create runs uncontested.How did you test this?
Publish to changelog?
no
Created with PostHog Code