Skip to content

fix(gitlab): merge request details report their head commit - #18608

Merged
Yash-Singh1 merged 1 commit into
pingdotgg:mainfrom
ScottN-PV:fix/18592-gitlab-mr-head-sha
Oct 12, 2026
Merged

Yash-Singh1 merged 1 commit into
pingdotgg:mainfrom
ScottN-PV:fix/18592-gitlab-mr-head-sha

Conversation

@ScottN-PV

Copy link
Copy Markdown
Contributor

Problem

Generating a review guide for any GitLab merge request fails with "This host did not report the pull request's head commit." The guide service reads the head commit from the pull request detail, and the GitLab detail decoder (gitLabMergeRequestJson.ts) dropped the merge request's sha.

Change

The raw merge request schema now reads GitLab's top-level sha, the source branch's head commit, and toDetail passes it on as headSha. When GitLab sends none, headSha is left out. GitLabPullRequestProvider.getChangeRequest already spreads the decoded detail, so the provider needs no change. This is the GitLab counterpart of the Forgejo fix in #18463 and the Bitbucket fix in #18402.

The fix reads sha rather than diff_refs.head_sha because GitLab fills in diff_refs only after it computes the diff, so it can be null on a new merge request. The list mapper is unchanged.

The pull request watch also reads the detail's headSha, so it can now tell when a watched GitLab merge request's head moves, as it already does for GitHub and Forgejo.

Scope and approval

Fixes the bug confirmed in the maintainer triage: #18592 (comment)

Closes #18592

Verification

Agent-run on Linux. No person tested this.

Live run in headless Chromium (1280×800 viewport, shots cropped) against a Linux dev server signed in to gitlab.com with a read-only token, on two open gitlab-org/cli merge requests. Nothing was written to GitLab.

Main This branch
!4064 Main: !4064 toast This branch: !4064 guide
!4089 (fork) Main: !4089 toast This branch: !4089 guide

On main, Write guide shows "Could not start a review guide / This host did not report the pull request's head commit." and no run starts. On this branch the guide is written, and the head commit it stores matches GitLab's sha for each merge request (772a4f2 and afce4da). !4089's source branch is in a fork, and the guide still checked out its head. Its shot is from Rewrite guide, because a guide already existed there. The guides shown were written by Claude Sonnet 5.5.

Main, !4064:

18592-main-4064-toast.mp4

This branch, !4064:

18592-fix-4064-guide.mp4

  • vp test run in packages/source-control-gitlab: 136 passed. The new case ("reads the head commit, and says nothing where GitLab omitted it") fails on main, where headSha is undefined.
  • vp lint and vp fmt --check on the two changed files, and the source-control-gitlab and server typechecks, pass.

Model: Claude Opus 5.5 (implementation and review), GPT-6-Astra (review). Harness: Claude Code, Codex.

A review guide needs the pull request's head commit from its detail. The
GitLab detail decoder dropped the merge request's `sha`, so generating a
guide for any GitLab merge request stopped with "This host did not report
the pull request's head commit." The detail now carries `headSha` from
GitLab's `sha`, and leaves it out where GitLab sends none.

Refs pingdotgg#18592

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 12, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 12, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 328e80c

Macroscope's review found this PR approvable — This is a narrowly scoped GitLab decoder bug fix that propagates the existing merge request head SHA into already-implemented review-guide and watch behavior, with regression tests for missing and partial API responses. It does not change defaults, schemas, deployment configuration, or static-analysis settings.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 12, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 12, 2026 10:12

Dismissing prior approval to re-evaluate 328e80c

@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf2cbad5-0728-4811-8717-90e6c64ba7c5

📥 Commits

Reviewing files that changed from the base of the PR and between 58d2532 and 328e80c.


📒 Files selected for processing (2)
  • packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts
  • packages/source-control-gitlab/src/server/gitLabMergeRequestJson.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.



📝 Walkthrough

Walkthrough

The GitLab merge-request detail decoder now reads the source head commit from optional sha, trims it, and omits headSha when empty. Tests cover valid SHA values and absent, null, or whitespace-only values, including cases with null diff_refs and zero merge_commit_sha.

Changes

GitLab head SHA

Layer / File(s) Summary
Decode and expose the head SHA
packages/source-control-gitlab/src/server/gitLabMergeRequestJson.ts, packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts
The raw merge-request schema accepts an optional nullable sha. The detail decoder sets headSha to the trimmed value when it is non-empty. Tests cover valid and omitted values.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge


Merge Risk | ⚪ Minimal · up to 328e8

Merge Risk: ⚪ Minimal · up to 328e8

GitLab review-guide generation and pull-request watching receive the head SHA when GitLab provides it. No actionable merge-blocking risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 328e8

The change preserves repository checks and safeguards against concurrent or outdated review runs. No security regression was established, but the permissions used during guide generation and unusual missing-commit transitions were not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The traced effects concern explicitly requested guides for the project's repository and existing watches on linked pull requests. Guides now send GitLab change context to the configured generation provider. The provider's complete sandbox and credential exposure remain unverified.

Trust Boundaries and Controls

  • observed — Guide generation requires matching host and repository identity. Commit fetching uses the project's primary remote and argument arrays rather than shell text. The newly accepted sha is trimmed but has no explicit hexadecimal validation at the decoder or inspected checkout boundary.

Resilience and Maintainability Implications

  • observed — Watch synchronization matches pull-request identity and watch start time, rejecting updates from stopped or replaced watches and wakes for inactive threads. Read failures are bounded, while closed or merged pull requests terminate their watches.

Hardening Proposals

  • proposed — Consider validating host-reported commit identifiers at the shared checkout boundary before passing them to Git. This would make reliance on trusted host SHA syntax explicit; it is not an observed exploit through ordinary merge-request content.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: GitLab merge request details now report the head commit.
Description check Passed The description includes all required sections. It explains the problem, implementation, scope approval, issue link, focused verification, observed results, limitations, and the agent model and harnes…
Linked Issues check Passed Issue #18592 requires GitLab merge-request guide generation to receive the source branch head commit. The decoder now accepts GitLab's top-level sha, trims it, and maps it to optional headSha. It …
Out of Scope Changes check Passed The changes are limited to GitLab merge-request detail decoding and focused automated tests. The schema field, headSha mapping, and tests directly support issue #18592. No unrelated product behavior…

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Yash-Singh1
Yash-Singh1 merged commit a3c4e9e into pingdotgg:main Oct 12, 2026
33 checks passed
aorwall added a commit to aorwall/t3code that referenced this pull request Oct 13, 2026
Merges upstream `pingdotgg/t3code` `5070a83a32` (48 commits, base
`e688034b5f`) into the fork. It does not stack on another PR.

## Merge
- 240 of 240 upstream-range files landed. Fork delta: 775 files.
- One conflict: `apps/web/src/routeTree.gen.ts`, regenerated for
upstream's new `/_chat/new` route. The other 18 files both sides touched
auto-merged: `duplicate-adds` and `resolution-check` are clean, and
every delta guard holds.
- `pnpm-lock.yaml` was re-derived by install, and `verify --only
lockfile` passes.
- Sweep: `promptLinks/HostedPromptLinkLanding.tsx` renders only in the
`hosted-static` auth state, which Moatless never reaches. Taken as
upstream's.
- Unsupported methods: ADD 0, DROP 0.

## Verification
`verify.mjs` passes duplicate-adds, tripwires, resolution-check,
unsupported-methods, lockfile, fmt, lint, typecheck and build. `test`
fails only on files that fail alone and failed the same way on the last
three merges, because of the sandbox: shared `AgentScope`
(`oom_score_adj` is 935 here), server `ServerBrowserPage` (no Playwright
browser), `AcpAdapterV2`, `OrchestratorReplayFixtures`, and
provider-opencode `OpenCodeServerLedger`.

## Usable as-is
- Prompt links (pingdotgg#18454): `/new?prompt=…`, `ThreadLinkPrompt` on thread
routes, and copy-prompt-link from messages and the command palette.
Choosing a project and placing the prompt work against Moatless.
- Terminal colors (pingdotgg#17168), context meter rounding (pingdotgg#17539), stable
button text (pingdotgg#18866), setup wizards follow themes (pingdotgg#18725), Git actions
follow the selected thread (pingdotgg#18862), dropped threads attach to pending
answers (pingdotgg#18789), the compact merge-button second click (pingdotgg#18878), a
numeric `q` on pull requests (pingdotgg#18666), the home-page bounce fix
(pingdotgg#18672), running terminals shown in the sidebar (pingdotgg#18740), and
computer-use titles (pingdotgg#18865).
- Mobile and desktop fixes (theme contrast, settings rows, the PR action
bar, image caching, the iOS 27.2 black screen, Hyprland, updater
diagnostics).
- "Update everything" sidebar pill (pingdotgg#18053): inert against Moatless,
which advertises no `serverSelfUpdate` or `versionAdvisory`.

## Unsupported in Moatless / needs implementation
- Prompt-link "clone this repository"
(`NewThreadLinkView.cloneRepository`): needs `projectClone.start` and
the `projectCloneTracking` capability. It refuses with a message today.
Added to gaps.md under *Project and repository management*.
- Renaming built-in models (pingdotgg#18840): saves through
`server.updateSettings` (custom model entry with a built-in slug). It
stays behind `FEATURES.providerConfiguration`, under the existing
settings gap.
- Provider secret settings (pingdotgg#18505, `secretSetting` and
`isSecretSetting` in contracts): stored on the host, so they fall under
the same settings gap.

## Backend behavior to consider reproducing in Moatless
Recorded in gaps.md under *Runtime fixes upstream made to its own
server*:
- A confirmed Claude subagent outcome settles that task and its child
work (pingdotgg#18778, the new `subagent` target on
`thread.background-work.settle`).
- Claude thinking before a tool call stays a collapsed Thought (pingdotgg#18887).
- Codex title and branch-name generation no longer starts the user's MCP
servers (pingdotgg#17058).
- The event store resyncs a thread holding an event type from a newer
build (pingdotgg#15937, `isKnownOrchestrationV2EventType`).
- A migration id clash stops startup with a clear error (pingdotgg#15925).
- Cached branch PR lookups start no git process (pingdotgg#17063).
- PR head commits are reported for Forgejo, GitLab and Bitbucket
(pingdotgg#18463, pingdotgg#18608, pingdotgg#18402), and PR bases resolve to branch names (pingdotgg#18754).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---
Moatless task:
https://moatless.soaplabstest.com/tasks/dcd13b46-6495-4b1d-af7c-03da83644d11
adampeterhiggins added a commit to adampeterhiggins/t3code that referenced this pull request Oct 13, 2026
* fix(gitlab): merge request details report their head commit (pingdotgg#18608)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* feat(server): rename built-in models from settings (pingdotgg#18840)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): Git actions follow the selected thread (pingdotgg#18862)

* fix(desktop): preserve updater failure causes in diagnostics (pingdotgg#18864)

* fix(web): attach dropped threads to pending answers (pingdotgg#18789)

* fix(web): keep button text stable during press scaling (pingdotgg#18866)

* fix(bitbucket): preserve PR head commits for review guides (pingdotgg#18402)

* fix(server): return null for unresolved optional commands (pingdotgg#18871)

* fix: show computer-use action titles and align app icons (pingdotgg#18865)

* fix(server): apply confirmed Claude subagent outcomes (pingdotgg#18778)

* fix(mobile): Browser page no longer logs a duplicate key warning (pingdotgg#18776)

* fix(web): a numeric q in the pull requests URL no longer crashes the page (pingdotgg#18666)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(client): T3 Connect clients reconnect once a new tunnel is ready (pingdotgg#16554)

Co-authored-by: PR Batch Tester <agent@local.test>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(web): leaving the home page while the app loads no longer bounces you to a new draft (pingdotgg#18672)

Co-authored-by: PR Batch Tester <agent@local.test>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): attachment images no longer re-download on every reconnect (pingdotgg#18824)

Co-authored-by: PR Batch Tester <agent@local.test>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(server): a migration id clash stops startup with a clear error instead of crash-looping (pingdotgg#15925)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: PR Batch Tester <agent@local.test>

* fix(server): a thread with an event type from a newer build can still resync after a downgrade (pingdotgg#15937)

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: PR Batch Tester <agent@local.test>

* fix(server): Codex titles and branch names no longer start the user's MCP servers (pingdotgg#17058)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Yash Singh <saiansh2525@gmail.com>

* fix(server): Claude thinking before a tool call stays a collapsed Thought (pingdotgg#18887)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>

* perf(server): cached branch PR lookups no longer start git processes (pingdotgg#17063)

* fix(web): compact merge buttons show when they need a second click (pingdotgg#18878)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mobile): pull requests load from another environment when theirs is offline (pingdotgg#18698)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* perf(web): collect active tool calls without array shifts (pingdotgg#18853)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: GPT-6.1 Sol <noreply@openai.com>

* fix(web): center the pace icon on the limit card's "left" label (pingdotgg#18580)

* fix(web): update everything includes npm-installed servers again (pingdotgg#18709)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(server): review guides find Bitbucket heads reported by short hash (pingdotgg#18900)

Co-authored-by: Pawel Mikolajczuk <pmikolajczuk@atlassian.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): scheduled task model picker no longer shifts the dialog (pingdotgg#18940)

* fix(ci): CodeRabbit reviews no longer request changes (pingdotgg#18954)

---------

Co-authored-by: Scott Norteman <snorteman@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Yash Singh <saiansh2525@gmail.com>
Co-authored-by: Paweł Mikołajczuk <pawel@mikolajczuk.in>
Co-authored-by: Tristan Knight <admin@snappeh.com>
Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com>
Co-authored-by: PR Batch Tester <agent@local.test>
Co-authored-by: Bryce Bjork <brycedbjork@gmail.com>
Co-authored-by: maria <maria@kuuro.net>
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
Co-authored-by: Dara Adedeji <76637177+SunkenInTime@users.noreply.github.com>
Co-authored-by: Antony <97451137+TonybynMp4@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Alex Southwell <saphid@gmail.com>
Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: GPT-6.1 Sol <noreply@openai.com>
Co-authored-by: Akash Moradiya <64416825+akash3444@users.noreply.github.com>
Co-authored-by: Pawel Mikolajczuk <pmikolajczuk@atlassian.com>
Co-authored-by: oliver <97427849+flamboh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: GitLab PR review-guide generation fails because the provider omits the head SHA

3 participants