fix(server): threads follow their worktree's branch changes #31599
MergedYash-Singh1(GitHub profile, opens in a new tab)merged 5 commits into
main fromrefs/pull/31599/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
- apps/server/src/orchestration-v2/WorktreeBranchSync.ts line 28OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +8,21 @@8+import { forkParked } from "../serverActivation.ts";9+import * as VcsStatusBroadcaster from "../vcs/VcsStatusBroadcaster.ts";10+import * as ThreadManagement from "./ThreadManagementService.ts";11+12+const make = Effect.gen(function* () {13+ const threads = yield* ThreadManagement.ThreadManagementService;14+ const git = yield* GitWorkflowService.GitWorkflowService;15+ return Effect.fn("WorktreeBranchSync.reconcile")(function* (input: {16+ readonly cwd: string;17+ readonly refName: string | null;18+ }) {19+ if (input.refName === null) return;20+ const snapshot = yield* threads.getShellSnapshot({ worktreePath: input.cwd });21+ const sharing = [...snapshot.threads, ...snapshot.archivedThreads].filter(22+ (thread) => thread.worktreePath === input.cwd && thread.branch !== input.refName,23+ );24+ if (sharing.length === 0) return;25+ // Status events may queue behind a generated rename or another checkout.26+ if ((yield* git.currentBranch(input.cwd)) !== input.refName) return;27+ for (const thread of sharing) {28+ yield* threads.dispatch({
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/orchestration-v2/WorktreeBranchSync.ts line 20OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +1,20 @@1+import { CommandId } from "@t3tools/contracts";2+import { randomUuidV4 } from "@t3tools/provider-core/server/randomUuid";3+import * as Effect from "effect/Effect";4+import * as Layer from "effect/Layer";5+import * as Stream from "effect/Stream";6+7+import * as GitWorkflowService from "../git/GitWorkflowService.ts";8+import { forkParked } from "../serverActivation.ts";9+import * as VcsStatusBroadcaster from "../vcs/VcsStatusBroadcaster.ts";10+import * as ThreadManagement from "./ThreadManagementService.ts";11+12+const make = Effect.gen(function* () {13+ const threads = yield* ThreadManagement.ThreadManagementService;14+ const git = yield* GitWorkflowService.GitWorkflowService;15+ return Effect.fn("WorktreeBranchSync.reconcile")(function* (input: {16+ readonly cwd: string;17+ readonly refName: string | null;18+ }) {19+ if (input.refName === null) return;20+ const snapshot = yield* threads.getShellSnapshot({ worktreePath: input.cwd });
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/orchestration-v2/WorktreeBranchSync.ts line 20OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +1,20 @@1+import { CommandId } from "@t3tools/contracts";2+import { randomUuidV4 } from "@t3tools/provider-core/server/randomUuid";3+import * as Effect from "effect/Effect";4+import * as Layer from "effect/Layer";5+import * as Stream from "effect/Stream";6+7+import * as GitWorkflowService from "../git/GitWorkflowService.ts";8+import { forkParked } from "../serverActivation.ts";9+import * as VcsStatusBroadcaster from "../vcs/VcsStatusBroadcaster.ts";10+import * as ThreadManagement from "./ThreadManagementService.ts";11+12+const make = Effect.gen(function* () {13+ const threads = yield* ThreadManagement.ThreadManagementService;14+ const git = yield* GitWorkflowService.GitWorkflowService;15+ return Effect.fn("WorktreeBranchSync.reconcile")(function* (input: {16+ readonly cwd: string;17+ readonly refName: string | null;18+ }) {19+ if (input.refName === null) return;20+ const snapshot = yield* threads.getShellSnapshot({ worktreePath: input.cwd });
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Yash-Singh1(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed