The best way to control Claude Code, Codex and more from any computer or phone
Stabilize git workspace and terminal tests (#2540)
Co-authored-by: Julius Marminge <julius@macmini.local>
Julius Marminge committed
May 5, 2026 at 20:31 UTC
25c9d267acbf058229a07e9f789be8ac00dec6d7
2 files changed
+61
-42
apps/server/src/git/GitManager.test.ts
+60
-39
@@ -294,6 +294,18 @@ function configureRemote(
294
});
295
}
296
297
+function configureVisibleRemoteUrlWithLocalRewrite(
298
+ cwd: string,
299
+ remoteName: string,
300
+ visibleUrl: string,
301
+ localRemotePath: string,
302
+): Effect.Effect<void, GitCommandError, GitVcsDriver.GitVcsDriver> {
303
+ return Effect.gen(function* () {
304
+ yield* runGit(cwd, ["config", `remote.${remoteName}.url`, visibleUrl]);
305
+ yield* runGit(cwd, ["config", `url.${localRemotePath}.insteadOf`, visibleUrl]);
306
+ });
307
+}
308
+
309
function createTextGeneration(overrides: Partial<FakeGitTextGeneration> = {}): TextGenerationShape {
310
const implementation: FakeGitTextGeneration = {
311
generateCommitMessage: (input) =>
@@ -1012,11 +1024,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
1024
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
1025
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
1026
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
1015
- yield* runGit(repoDir, [
1016
- "config",
1017
- "remote.fork-seed.url",
1027
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
1028
+ repoDir,
1029
+ "fork-seed",
1030
"git@github.com:jasonLaster/codething-mvp.git",
1019
- ]);
1031
+ forkDir,
1032
+ );
1033
1034
const { manager, ghCalls } = yield* makeManager({
1035
ghScenario: {
@@ -1076,17 +1089,19 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
1089
yield* runGit(repoDir, ["checkout", "-b", "effect-atom"]);
1090
yield* runGit(repoDir, ["push", "-u", "origin", "effect-atom"]);
1091
yield* runGit(repoDir, ["push", "-u", "my-org/upstream", "effect-atom"]);
1079
- yield* runGit(repoDir, [
1080
- "config",
1081
- "remote.origin.url",
1092
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
1093
+ repoDir,
1094
+ "origin",
1095
"git@github.com:pingdotgg/codething-mvp.git",
1083
- ]);
1096
+ originDir,
1097
+ );
1098
yield* runGit(repoDir, ["config", "remote.origin.pushurl", originDir]);
1085
- yield* runGit(repoDir, [
1086
- "config",
1087
- "remote.my-org/upstream.url",
1088
- "git@github.com:pingdotgg/codething-mvp.git",
1089
- ]);
1099
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
1100
+ repoDir,
1101
+ "my-org/upstream",
1102
+ "ssh://git@github.com/pingdotgg/codething-mvp.git",
1103
+ upstreamDir,
1104
+ );
1105
yield* runGit(repoDir, ["config", "remote.my-org/upstream.pushurl", upstreamDir]);
1106
yield* runGit(repoDir, ["checkout", "main"]);
1107
yield* runGit(repoDir, ["branch", "-D", "effect-atom"]);
@@ -1861,11 +1876,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
1876
const forkDir = yield* createBareRemote();
1877
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
1878
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
1864
- yield* runGit(repoDir, [
1865
- "config",
1866
- "remote.fork-seed.url",
1879
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
1880
+ repoDir,
1881
+ "fork-seed",
1882
"git@github.com:octocat/codething-mvp.git",
1868
- ]);
1883
+ forkDir,
1884
+ );
1885
1886
const { manager, ghCalls } = yield* makeManager({
1887
ghScenario: {
@@ -1923,17 +1939,19 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
1939
yield* runGit(repoDir, ["checkout", "-b", "effect-atom"]);
1940
yield* runGit(repoDir, ["push", "-u", "origin", "effect-atom"]);
1941
yield* runGit(repoDir, ["push", "-u", "my-org/upstream", "effect-atom"]);
1926
- yield* runGit(repoDir, [
1927
- "config",
1928
- "remote.origin.url",
1942
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
1943
+ repoDir,
1944
+ "origin",
1945
"git@github.com:pingdotgg/codething-mvp.git",
1930
- ]);
1946
+ originDir,
1947
+ );
1948
yield* runGit(repoDir, ["config", "remote.origin.pushurl", originDir]);
1932
- yield* runGit(repoDir, [
1933
- "config",
1934
- "remote.my-org/upstream.url",
1935
- "git@github.com:pingdotgg/codething-mvp.git",
1936
- ]);
1949
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
1950
+ repoDir,
1951
+ "my-org/upstream",
1952
+ "ssh://git@github.com/pingdotgg/codething-mvp.git",
1953
+ upstreamDir,
1954
+ );
1955
yield* runGit(repoDir, ["config", "remote.my-org/upstream.pushurl", upstreamDir]);
1956
yield* runGit(repoDir, ["checkout", "main"]);
1957
yield* runGit(repoDir, ["branch", "-D", "effect-atom"]);
@@ -2013,11 +2031,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
2031
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2032
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
2033
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2016
- yield* runGit(repoDir, [
2017
- "config",
2018
- "remote.fork-seed.url",
2034
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
2035
+ repoDir,
2036
+ "fork-seed",
2037
"git@github.com:octocat/codething-mvp.git",
2020
- ]);
2038
+ forkDir,
2039
+ );
2040
2041
const { manager, ghCalls } = yield* makeManager({
2042
ghScenario: {
@@ -2083,11 +2102,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
2102
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2103
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
2104
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2086
- yield* runGit(repoDir, [
2087
- "config",
2088
- "remote.fork-seed.url",
2105
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
2106
+ repoDir,
2107
+ "fork-seed",
2108
"git@github.com:octocat/codething-mvp.git",
2090
- ]);
2109
+ forkDir,
2110
+ );
2111
2112
const { manager, ghCalls } = yield* makeManager({
2113
ghScenario: {
@@ -2263,11 +2283,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
2283
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2284
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-91/statemachine"]);
2285
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2266
- yield* runGit(repoDir, [
2267
- "config",
2268
- "remote.fork-seed.url",
2286
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
2287
+ repoDir,
2288
+ "fork-seed",
2289
"git@github.com:octocat/codething-mvp.git",
2270
- ]);
2290
+ forkDir,
2291
+ );
2292
2293
const { manager, ghCalls } = yield* makeManager({
2294
ghScenario: {
@@ -3147,7 +3168,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
3168
fs.writeFileSync(path.join(repoDir, "hooked.txt"), "hooked\n");
3169
fs.writeFileSync(
3170
path.join(repoDir, ".git", "hooks", "pre-commit"),
3150
- '#!/bin/sh\necho "hook: start" >&2\nsleep 1\necho "hook: end" >&2\n',
3171
+ '#!/bin/sh\necho "hook: start" >&2\nsleep 0.05\necho "hook: end" >&2\n',
3172
{ mode: 0o755 },
3173
);
3174
apps/server/src/terminal/Layers/Manager.test.ts
+1
-3
@@ -238,9 +238,7 @@ const createManager = (
238
...(options.subprocessPollIntervalMs !== undefined
239
? { subprocessPollIntervalMs: options.subprocessPollIntervalMs }
240
: {}),
241
- ...(options.processKillGraceMs !== undefined
242
- ? { processKillGraceMs: options.processKillGraceMs }
243
- : {}),
241
+ processKillGraceMs: options.processKillGraceMs ?? 1,
242
...(options.maxRetainedInactiveSessions !== undefined
243
? { maxRetainedInactiveSessions: options.maxRetainedInactiveSessions }
244
: {}),