@devries-cameron20 / t3code Mirror · read-only / commits / d899bddfa2
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 16:00 UTC

fix(gitlab): long merge request descriptions no longer break the list (#24215)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

fixfon committed Nov 14, 2026 at 10:12 UTC d899bddfa2a6f824411eaae10fb7a8fa0a37bbb7
2 files changed +35
packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts
+32
@@ -591,6 +591,38 @@ layer("GitLabPullRequestCli.layer", (it) => {
591 }),
592 );
593
594 + it.effect("reads a page of merge requests larger than the VCS default output limit", () =>
595 + Effect.gen(function* () {
596 + const vcsDefaultMaxOutputBytes = 1_000_000;
597 + const rows = (JSON.parse(mergeRequests(100, 1)) as ReadonlyArray<object>).map((row) => ({
598 + ...row,
599 + description: "x".repeat(20_000),
600 + }));
601 + const response = JSON.stringify(rows);
602 + expect(Buffer.byteLength(response)).toBeGreaterThan(vcsDefaultMaxOutputBytes);
603 + mockedExecute.mockImplementationOnce(({ maxOutputBytes = vcsDefaultMaxOutputBytes }) =>
604 + Effect.succeed(
605 + maxOutputBytes >= Buffer.byteLength(response)
606 + ? output(response)
607 + : output(response.slice(0, maxOutputBytes), true),
608 + ),
609 + );
610 + const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
611 +
612 + const batch = yield* cli.listMergeRequests({
613 + cwd: "/w",
614 + repository: "acme/web",
615 + state: "open",
616 + involvement: "all",
617 + viewer: "bilal",
618 + limit: 99,
619 + });
620 +
621 + assert.strictEqual(batch.items.length, 99);
622 + assert.isTrue(batch.truncated);
623 + }),
624 + );
625 +
626 it.effect("stops walking when every row on a page fails to decode", () =>
627 Effect.gen(function* () {
628 const unusable = JSON.stringify(Array.from({ length: 100 }, () => ({ iid: "nope" })));
packages/source-control-gitlab/src/server/GitLabPullRequestCli.ts
+3
@@ -343,6 +343,8 @@ const DIFF_MAX_OUTPUT_BYTES = 8 * 1024 * 1024;
343 const DIFF_TIMEOUT_MS = 60_000;
344 const isVcsProcessExitError = Schema.is(VcsProcessExitError);
345 const DIFF_FILE_MAX_OUTPUT_BYTES = 1024 * 1024;
346 +// REST list rows carry full descriptions, so a page can pass the 1 MB default output cap.
347 +const MERGE_REQUEST_LIST_MAX_OUTPUT_BYTES = 16 * 1024 * 1024;
348
349 export interface GitLabDiscussionThreads {
350 readonly threads: ReadonlyArray<PullRequestConversationThread>;
@@ -1085,6 +1087,7 @@ export const make = Effect.gen(function* () {
1087 ["per_page", String(perPage)],
1088 ["page", String(input.page)],
1089 ])}`,
1090 + maxOutputBytes: MERGE_REQUEST_LIST_MAX_OUTPUT_BYTES,
1091 }).pipe(
1092 Effect.flatMap((result) => {
1093 const raw = result.stdout.trim();