Skip to content

Commit 0924091

Browse files
committed
fix: preserve source behavior against current upstream contracts
1 parent 004159f commit 0924091

3 files changed

Lines changed: 40 additions & 35 deletions

File tree

‎apps/server/src/orchestration-v2/ThreadLaunchService.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ const make = Effect.gen(function* () {
427427
branch = flattenTemporaryWorktreeBranchName(branch);
428428
}
429429
yield* setupTracker.stageStatus(threadId, "checkout", "running");
430-
const baseRefName = input.workspaceStrategy.baseRef;
431430
const createWorktree = (newRefName: string) =>
432431
git.createWorktree(
433432
{

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,9 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
17921792
const spawner = ChildProcessSpawner.make((command) => {
17931793
if (
17941794
ChildProcess.isStandardCommand(command) &&
1795-
(command.args.includes("worktree") || command.args[0] === "checkout")
1795+
(command.args.includes("worktree") ||
1796+
command.args[0] === "branch" ||
1797+
command.args[0] === "checkout")
17961798
) {
17971799
locales.push(command.options.env?.LC_ALL);
17981800
}

‎apps/server/src/vcs/GitVcsDriverCore.ts‎

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3730,12 +3730,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
37303730
// as renames, but leave the expensive checkout outside the lock.
37313731
yield* configLocks.withLock(
37323732
yield* resolveGitCommonDir(input.cwd),
3733-
runGit("GitVcsDriver.createWorktree.createBranch", input.cwd, [
3734-
"branch",
3735-
"--",
3736-
input.newRefName,
3737-
input.refName === "-" ? "@{-1}" : input.refName,
3738-
]),
3733+
executeGitWithStableDiagnostics(
3734+
"GitVcsDriver.createWorktree.createBranch",
3735+
input.cwd,
3736+
["branch", "--", input.newRefName, input.refName === "-" ? "@{-1}" : input.refName],
3737+
{ fallbackErrorDetail: "git worktree add failed" },
3738+
),
37393739
);
37403740
}
37413741
const args = ["worktree", "add", "--", worktreePath, targetBranch];
@@ -3841,31 +3841,33 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
38413841
if (input.newRefName && input.baseRefName) {
38423842
const base = yield* resolveBranchBase(input.cwd, input.baseRefName);
38433843
if (base) {
3844-
yield* configLocks.withLock(
3845-
yield* resolveGitCommonDir(input.cwd),
3846-
Effect.gen(function* () {
3847-
yield* runGit("GitVcsDriver.createWorktree.configureBaseRef", input.cwd, [
3848-
"config",
3849-
`branch.${input.newRefName}.gh-merge-base`,
3850-
base.branchName,
3851-
]);
3852-
if (base.baseRef.startsWith("refs/remotes/")) {
3853-
// gh consumes its key as a provider branch; T3 also needs the selected remote.
3854-
yield* runGit("GitVcsDriver.createWorktree.configureComparisonRef", input.cwd, [
3855-
"config",
3856-
`branch.${input.newRefName}.t3-merge-base-ref`,
3857-
base.baseRef,
3858-
]);
3859-
}
3860-
})).pipe(
3861-
Effect.catchTags({
3862-
GitCommandError: () =>
3863-
Effect.logWarning(
3864-
"worktree base-ref configuration failed; using base-branch fallback",
3865-
),
3866-
}),
3867-
),
3868-
);
3844+
yield* configLocks
3845+
.withLock(
3846+
yield* resolveGitCommonDir(input.cwd),
3847+
Effect.gen(function* () {
3848+
yield* runGit("GitVcsDriver.createWorktree.configureBaseRef", input.cwd, [
3849+
"config",
3850+
`branch.${input.newRefName}.gh-merge-base`,
3851+
base.branchName,
3852+
]);
3853+
if (base.baseRef.startsWith("refs/remotes/")) {
3854+
// gh consumes its key as a provider branch; T3 also needs the selected remote.
3855+
yield* runGit("GitVcsDriver.createWorktree.configureComparisonRef", input.cwd, [
3856+
"config",
3857+
`branch.${input.newRefName}.t3-merge-base-ref`,
3858+
base.baseRef,
3859+
]);
3860+
}
3861+
}),
3862+
)
3863+
.pipe(
3864+
Effect.catchTags({
3865+
GitCommandError: () =>
3866+
Effect.logWarning(
3867+
"worktree base-ref configuration failed; using base-branch fallback",
3868+
),
3869+
}),
3870+
);
38693871
}
38703872
}
38713873

@@ -4069,7 +4071,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
40694071
timeToLive: () => Duration.zero,
40704072
},
40714073
);
4072-
const fetchRemoteShared: GitVcsDriver.GitVcsDriver["Service"]["fetchRemote"] = (input) =>
4074+
const fetchRemoteShared = (input: GitVcsDriver.GitFetchRemoteInput) =>
40734075
Cache.get(
40744076
fetchRemoteInFlight,
40754077
new FetchRemoteKey({
@@ -4551,7 +4553,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
45514553
Effect.flatMap((fetched) =>
45524554
fetched
45534555
? Effect.void
4554-
: fetchRemoteShared({ cwd: input.cwd, remoteName: input.remoteName }).pipe(Effect.asVoid),
4556+
: fetchRemoteShared({ cwd: input.cwd, remoteName: input.remoteName }).pipe(
4557+
Effect.asVoid,
4558+
),
45554559
),
45564560
),
45574561
),

0 commit comments

Comments
 (0)