Skip to content

PR-Agent Fails to Generate Line Links in PR Description on Azure DevOps #1558

@facusantillo

Description

@facusantillo

Git provider (optional)

Azure

System Info (optional)

  • PR-Agent Version: codiumai/pr-agent:latest
  • Pipeline Environment: Azure DevOps (Ubuntu 22.04)
  • OpenAI API: Azure OpenAI

Issues details

PR-Agent is not generating line links for certain files in the PR description. The following warnings appear in the logs during the /describe command execution:

2025-02-20 09:11:41.225 | WARNING  | pr_agent.tools.pr_description:process_pr_files_prediction:686 - Error getting line link for '/src/config/configuration.json'
2025-02-20 09:11:41.226 | WARNING  | pr_agent.tools.pr_description:process_pr_files_prediction:686 - Error getting line link for '/configuration.toml'
2025-02-20 09:11:41.227 | WARNING  | pr_agent.tools.pr_description:process_pr_files_prediction:686 - Error getting line link for '/.azuredevops/ci-pipeline.yaml'
2025-02-20 09:11:41.227 | WARNING  | pr_agent.tools.pr_description:process_pr_files_prediction:686 - Error getting line link for '/src/app/components/menus/side-menu/side-menu.component.ts'
2025-02-20 09:11:41.228 | WARNING  | pr_agent.tools.pr_description:process_pr_files_prediction:686 - Error getting line link for '/src/app/components/menus/side-menu/side-menu.component.spec.ts'
  • The issue persists across multiple PRs and file types.
  • The Azure DevOps PAT token used has full Code (Read & Write) permissions (we are using System.AccessToken)

Also, seems like is not taking the configuration, so we are using some values in the script itself:

stages:
- stage: 'PR_Agent'
  condition: eq(variables['Build.Reason'], 'PullRequest')

  jobs:
  - job: 'Run_PR_Agent'
    displayName: 'Run PR-Agent with Azure OpenAI'
    pool:
      vmImage: 'ubuntu-22.04'
    container:
      image: codiumai/pr-agent:latest
      options: --entrypoint ""

    steps:
    - script: |
        echo "Running PR-Agent with Azure OpenAI"
        PR_URL="${SYSTEM_COLLECTIONURI}${SYSTEM_TEAMPROJECT}/_git/${BUILD_REPOSITORY_NAME}/pullrequest/${SYSTEM_PULLREQUEST_PULLREQUESTID}"
        echo "PR URL: $PR_URL"

        # Extract organization URL from System.CollectionUri
        ORG_URL=$(echo "$(System.CollectionUri)" | sed 's/\/$//') # Remove trailing slash if present
        echo "Organization URL: $ORG_URL"

        export azure_devops__org="$ORG_URL"
        export config__git_provider="azure"
        export openai__key: $(AZURE_OPENAI_API_KEY)
        export azure_devops__pat: $(System.AccessToken)
        
        # Ejecutar PR-Agent
        pr-agent --pr_url="$PR_URL" describe
        pr-agent --pr_url="$PR_URL" review
        pr-agent --pr_url="$PR_URL" improve
      displayName: 'Ejecutar PR-Agent'
      env:
        AZURE_DEVOPS.PAT: $(System.AccessToken)
        AZURE_DEVOPS.ORG: $(AZURE_DEVOPS_ORG)
        OPENAI.API_TYPE: 'azure'
        OPENAI.KEY: $(AZURE_OPENAI_API_KEY)
        OPENAI.VERSION: $(AZURE_OPENAI_API_VERSION)
        OPENAI.API_BASE: $(AZURE_OPENAI_ENDPOINT)
        CONFIG.MODEL: $(AZURE_OPENAI_MODEL)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions