Skip to content

[Bug]: Follow change request templates ignores GitLab and Azure DevOps templates #12330

Open

Description

@BradyHazell

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. Use a project hosted on GitLab or Azure DevOps.
  2. Commit a template to the repository’s default branch:
    • GitLab: .gitlab/merge_request_templates/Default.md
    • Azure DevOps: .azuredevops/pull_request_template.md
  3. Give the template distinctive headings, such as ## Context and ## Verification.
  4. Enable Settings → Source Control → Follow change request templates.
  5. Create a pull request or merge request through T3 Code’s Git actions.

Expected behavior

When enabled, the setting discovers the hosting provider’s repository template and uses it to generate the description.

Actual behavior

Template discovery is explicitly restricted to GitHub. GitLab and Azure DevOps templates are not passed to the description generator, regardless of the setting.

GitManager.ts:2023 checks provider.kind === "github" before calling detectPrTemplate. The detector in PrTemplateDetection.ts only includes GitHub-compatible paths.

Impact

Minor bug or occasional failure

Version or commit

main @ e26af33

Environment

No response

Logs or stack traces

Screenshots, recordings, or supporting files

No response

Workaround

Manually apply the template when editing the generated request description.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Sep 17, 2026
  2. juliusmarminge commented on Sep 17, 2026

    @juliusmarminge
    Member

    Triage

    Decision: Accept
    Classification: Bug
    Severity: Minor (P3)
    Confidence: High
    Repro: Source-confirmed. Reporter steps are sufficient; no extra environment details are required.
    Area: apps/server (Git stacked actions + PR/MR description generation)

    Summary

    Confirmed. Settings → Source Control → Follow change request templates is on by default and advertised as host-agnostic (“Use the repository's template for change request descriptions when available”), but PR/MR body generation only loads a template when the remote is GitHub. GitLab and Azure DevOps repos skip discovery entirely, so generated descriptions fall back to the generic ## Summary / ## Testing prompt instead of the repo template.

    This is not a duplicate of a still-open issue. It is leftover GitHub-only scope from #4204 / #264.

    Diagnosis

    Two independent gates, both still present on current main:

    1. Provider gate in runPrStep. Template detection runs only when settings.style.followChangeRequestTemplates && provider.kind === "github". Any other host (gitlab, azure-devops, also Forgejo/Gitea/Bitbucket) passes changeRequestTemplate: undefined into generatePrContent.
        const changeRequestTemplate =
          settings.style.followChangeRequestTemplates && provider.kind === "github"
            ? Option.getOrUndefined(yield* detectPrTemplate(cwd, baseRangeRef, gitCore.execute))
            : undefined;
    1. GitHub-only path list in the detector. Even if the kind check were removed, detectPrTemplate only looks at GitHub-compatible files/directories. It does not include the paths the reporter named:

      • GitLab: .gitlab/merge_request_templates/Default.md (and the rest of .gitlab/merge_request_templates/*.md)
      • Azure DevOps: .azuredevops/pull_request_template.md
    const TEMPLATE_PATHS = [
      ".github/pull_request_template.md",
      ".github/PULL_REQUEST_TEMPLATE.md",
      "pull_request_template.md",
      "PULL_REQUEST_TEMPLATE.md",
      "docs/pull_request_template.md",
      "docs/PULL_REQUEST_TEMPLATE.md",
    ] as const;
    
    const TEMPLATE_DIRECTORIES = [
      ".github/PULL_REQUEST_TEMPLATE",
      "PULL_REQUEST_TEMPLATE",
      "docs/PULL_REQUEST_TEMPLATE",
    ] as const;

    User-facing copy does not mention a GitHub limit:

            description="Use the repository's template for change request descriptions when available."

    When no template is passed, generation uses the generic body rules in TextGenerationPrompts.ts. followChangeRequestTemplates defaults to true, so GitLab/Azure users hit this without changing settings.

    PR #4204 implemented this as “Detect GitHub pull request templates” and closed #264. The setting and source-control docs later grew to cover GitLab and Azure DevOps, but discovery did not.

    Reproduction assessment

    Reporter steps match the code path. No log/screenshot is needed.

    1. Repo on GitLab or Azure DevOps with a distinctive template at the host’s documented path.
    2. Follow change request templates enabled (default).
    3. Create a PR/MR from T3 Git actions.

    Expected: template headings appear in the generated description.
    Actual: detector never runs (non-GitHub), and GitLab/ADO paths are not in TEMPLATE_PATHS / TEMPLATE_DIRECTORIES.

    Tests only cover GitHub paths (PrTemplateDetection.test.ts) and a GitHub pr create flow. There is no GitLab/Azure case that asserts a template is passed through.

    Related issues

    Same provider gate also blocks Forgejo, Gitea, and Bitbucket. Out of scope for this report, but a fix should not special-case only GitLab + Azure if those hosts already have documented template paths.

    Recommended next step

    Accept and implement in apps/server:

    1. Stop gating detectPrTemplate on provider.kind === "github". Keep the followChangeRequestTemplates setting as the only user switch.
    2. Extend TEMPLATE_PATHS / TEMPLATE_DIRECTORIES with host paths, at least:
      • .gitlab/merge_request_templates (prefer Default.md when several files exist; today’s “ambiguous directory → none” rule would otherwise ignore a valid GitLab default)
      • .azuredevops/pull_request_template.md
    3. Add detector tests for those paths and a GitManager test that a non-GitHub provider still receives changeRequestTemplate.
    4. Optional docs tweak in docs/user/source-control.md under “Create a pull request” so the supported template locations are explicit.

    Workaround

    Unchanged from the report: after T3 generates the description, paste or edit in the host template by hand.

  3. added
    acceptedfeature request accepted
    via-triageFiled through npx t3 triage
    and removed
    needs-triageIssue needs maintainer review and initial categorization.
    on Sep 17, 2026
  4. scs0209 commented on Sep 18, 2026

    @scs0209

    I've prepared a fix in #12392 that adds GitLab (.gitlab/merge_request_templates/Default.md) and Azure DevOps (.azuredevops/pull_request_template.md) change request template detection — let me know if you'd like any changes.

  5. SachinD6 commented on Sep 23, 2026

    @SachinD6

    Proposal ready in my fork for #12330:

    Adds .gitlab/merge_request_templates/Default.md (+ directory) and .azuredevops template paths to PrTemplateDetection, and enables followChangeRequestTemplates for gitlab and azure-devops in GitManager. Small fix, 3 files, 12 insertions. Happy to adjust scope.

  6. fixfon commented on Oct 11, 2026

    @fixfon
    Contributor

    I'd like to take this. I'll follow the direction in the maintainer triage above and open a focused PR with before/after evidence, noting the model and harness used.

  7. fixfon commented on Oct 11, 2026

    @fixfon
    Contributor

    PR is up: #18209. It adds the GitLab and Azure DevOps template readers following the triage. Forgejo, Gitea, Bitbucket and Azure branch-specific templates are out of scope there.

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

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.good first issueGood for newcomersvia-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