Skip to content

Commit d5fa9c0

Browse files
committed
Add empty-stdout guard in listChangeRequests for non-open state
When GitHub CLI returns empty stdout (e.g. network issue, partial response), return an empty array instead of attempting JSON parse. This restores the resilient behavior from the old findLatestPr code, which used 'continue' to skip empty responses and try the next head selector.
1 parent 1585669 commit d5fa9c0

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

apps/server/src/sourceControl/GitHubSourceControlProvider.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () {
7676
],
7777
})
7878
.pipe(
79-
Effect.flatMap((result) =>
80-
Effect.sync(() => decodeGitHubPullRequestListJson(result.stdout.trim())).pipe(
79+
Effect.flatMap((result) => {
80+
const raw = result.stdout.trim();
81+
if (raw.length === 0) {
82+
return Effect.succeed([]);
83+
}
84+
return Effect.sync(() => decodeGitHubPullRequestListJson(raw)).pipe(
8185
Effect.flatMap((decoded) =>
8286
Result.isSuccess(decoded)
8387
? Effect.succeed(
@@ -95,8 +99,8 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () {
9599
}),
96100
),
97101
),
98-
),
99-
),
102+
);
103+
}),
100104
Effect.mapError((error) =>
101105
Schema.is(SourceControlProviderError)(error)
102106
? error

0 commit comments

Comments
 (0)