Skip to content

[Bug]: Expanding unmodified lines in GitLab merge requests silently does nothing #17156

Description

@saibotma

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Open a GitLab merge request in the pull request pane.
  2. Go to the Code tab.
  3. Click an "N unmodified lines" divider between two hunks.

Expected behavior

The hidden lines are revealed, as they are for GitHub PRs (#5546 lists GitLab as supported). If expanding fails, an error is shown.

Actual behavior

Nothing visible happens: no lines expand and no error appears. The error is only logged to the DevTools console.

Impact

Major degradation or frequent failure

Version or commit

0.0.46-nightly.20261008.2813

Environment

macOS, desktop app, GitLab

Logs or stack traces

PullRequestOperationError: Pull request operation diffFileContents failed: This host cannot expand unchanged pull request lines.
loadFilesForDiff        @ renderDiffChildren-D8HsbUTF.js:1
loadFilesIfNecessary    @ renderDiffChildren-D8HsbUTF.js:1
expandHunk              @ renderDiffChildren-D8HsbUTF.js:1
handleExpandHunk        @ renderDiffChildren-D8HsbUTF.js:1
handlePointerEvent      @ WorkerPoolContext-D4Io5ghu.js:1
handlePointerClick      @ WorkerPoolContext-D4Io5ghu.js:1

Activity

  1. juliusmarminge commented on Oct 8, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Thanks for the clear report and the stack trace. I traced it on current main (5e22256). There are two separate problems here.

    1. The GitLab provider never wires up expansion

    The error comes from PullRequestService.diffFileContents (apps/server/src/pullRequest/PullRequestService.ts:1901-1923). It refuses with "This host cannot expand unchanged pull request lines." whenever the host's provider has no getDiffFileContents.

    GitLab can already do this read. GitLabPullRequestCli.getMergeRequestDiffFileContents (apps/server/src/pullRequest/GitLabPullRequestCli.ts:1250-1299) was added in #5546 and has tests (GitLabPullRequestCli.test.ts ~L620-780). It reads the MR's diff_refs (or a commit's parent for the per-commit view). Then it fetches both sides from projects/:id/repository/files/:path/raw?ref=<sha>, with the same 1 MB and binary limits as GitHub.

    The step that's missing is in GitLabPullRequestProvider.ts. GitHub wires its CLI method into the provider (GitHubPullRequestProvider.ts:549-550), and Forgejo and Azure DevOps have their own. The GitLab provider only exposes getDiff (GitLabPullRequestProvider.ts:231) and never sets getDiffFileContents. So the optional method is undefined, it's left out at PullRequestService.ts:643-645, and every expand on a GitLab MR fails. The provider file at #5546's merge commit has the same gap, so this looks like an oversight from that PR rather than a later regression.

    The fix is likely small. Add the following to the GitLab provider, next to getDiff, plus a provider-level test:

    getDiffFileContents: (input) =>
      cli.getMergeRequestDiffFileContents(input).pipe(Effect.mapError(fail("getDiffFileContents"))),

    I haven't run this against a live GitLab instance. Fork MRs and older self-managed GitLab (see #15660 / #15886) are worth a quick check once it's wired.

    Bitbucket appears to be in the same state: diff: true but no getDiffFileContents. It probably fails the same way, though I didn't verify that.

    2. The web UI swallows the failure

    Even with GitLab fixed, any expansion failure is currently invisible. That includes the existing "oversized" (>1 MB) and "binary" errors on GitHub.

    • The Code tab passes createPullRequestDiffFileContentsLoader to the diff viewer as loadDiffFiles (apps/web/src/components/pullRequest/PullRequestCodeTab.tsx:361-371, 896). The loader throws on failure (apps/web/src/lib/diffFileContents.ts:119-121).
    • useAtomCommand's default failure reporting only does a console.warn (packages/client-runtime/src/state/runtime.ts:418-433). It doesn't show a toast.
    • @pierre/diffs 1.5.2 FileDiff.loadFilesForDiff catches the loader error and just calls console.error (dist/components/FileDiff.js:555-563). That's the trace in your report. expandHunk likely still re-renders, but with nothing loaded to reveal, so the click appears to do nothing.

    There's also no capability flag for expansion: PullRequestCapabilities (packages/contracts/src/pullRequest.ts:394) only has diff. So the client can't hide or disable the "N unmodified lines" divider for a host that can't expand. How to surface this is a UX choice: show an error toast or inline notice when the loader fails, add an expand capability and hide the divider, or both. Fixing (1) removes the GitLab case either way.

    Summary

  2. added
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions