Skip to content

Commit 908809e

Browse files
fix(server): share the checkpoint capture operation
1 parent 7bc4764 commit 908809e

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
766766

767767
const checkpoints: VcsDriver.VcsCheckpointOps = {
768768
captureCheckpoint: Effect.fn("GitVcsDriver.checkpoints.captureCheckpoint")(function* (input) {
769-
const operation = "GitVcsDriver.checkpoints.captureCheckpoint";
769+
const operation = VcsProcess.CHECKPOINT_CAPTURE_OPERATION;
770770
const indexConfig = [
771771
"-c",
772772
"core.fsmonitor=false",

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ describe("VcsProcess.run", () => {
6161
stderr: "fatal: Unable to create '/private/repo/index.lock': Permission denied",
6262
retryable: false,
6363
},
64-
{
65-
stderr: "fatal: cannot lock ref 'refs/t3/test': is at abc123 but expected def456",
66-
retryable: true,
67-
},
6864
{ stderr: 'error: open("/private/repo/file"): No such file or directory', retryable: true },
6965
{
7066
stderr: "fatal: unable to stat '/private/repo/file': No such file or directory",
@@ -120,7 +116,7 @@ describe("VcsProcess.run", () => {
120116
const error = yield* service
121117
.run({
122118
...baseInput,
123-
operation: "GitVcsDriver.checkpoints.captureCheckpoint",
119+
operation: VcsProcess.CHECKPOINT_CAPTURE_OPERATION,
124120
})
125121
.pipe(Effect.flip);
126122
expect(attempts).toBe(1);
@@ -202,7 +198,7 @@ describe("VcsProcess.run", () => {
202198
const fiber = yield* service
203199
.run({
204200
...baseInput,
205-
operation: capture ? "GitVcsDriver.checkpoints.captureCheckpoint" : baseInput.operation,
201+
operation: capture ? VcsProcess.CHECKPOINT_CAPTURE_OPERATION : baseInput.operation,
206202
...(streaming ? { onStdoutChunk: () => {} } : {}),
207203
})
208204
.pipe(Effect.exit, Effect.forkScoped);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const OUTPUT_TRUNCATED_MARKER = "\n\n[truncated]";
6060
const VCS_PROCESS_CONCURRENCY = 8;
6161
const GITHUB_PROCESS_CONCURRENCY = 4;
6262

63+
export const CHECKPOINT_CAPTURE_OPERATION = "GitVcsDriver.checkpoints.captureCheckpoint";
64+
6365
const classifyNonZeroExit = (command: string, stderr: string): VcsProcessExitFailureKind => {
6466
const normalized = stderr.toLowerCase();
6567

@@ -109,7 +111,6 @@ const classifyNonZeroExit = (command: string, stderr: string): VcsProcessExitFai
109111
// Classify before discarding stderr; keep paths and process output out of errors.
110112
const isTransientGitExit = (stderr: string) =>
111113
/unable to create [^\n]*\.lock['"]?: file exists/i.test(stderr) ||
112-
/cannot lock ref [^\n]+: is at [0-9a-f]+ but expected [0-9a-f]+/i.test(stderr) ||
113114
/(?:unable to stat|lstat\(|error: open\()[^\n]+: no such file or directory/i.test(stderr);
114115

115116
export const make = Effect.gen(function* () {
@@ -205,7 +206,7 @@ export const make = Effect.gen(function* () {
205206
const bounded = vcsProcesses.withPermits(1)(runUnbounded(input));
206207
if (
207208
input.command === "git" &&
208-
input.operation === "GitVcsDriver.checkpoints.captureCheckpoint" &&
209+
input.operation === CHECKPOINT_CAPTURE_OPERATION &&
209210
input.onStdoutChunk === undefined
210211
) {
211212
// Retry the failed command, retaining the private index/tree and recovery's outer deadline.

0 commit comments

Comments
 (0)