Skip to content

AzureDevopsProvider.get_repo_settings drops chunks after the first, silently truncating .pr_agent.toml #2376

@agonzalesipcoop-cmyk

Description

@agonzalesipcoop-cmyk

Bug

AzureDevopsProvider.get_repo_settings (pr_agent/git_providers/azuredevops_provider.py) calls azure_devops_client.get_item_content(...) which returns a streamed iterator of byte chunks, then keeps only list(contents)[0]. For any .pr_agent.toml larger than a single chunk the file is silently truncated and config keys after the cutoff are lost.

Current code

def get_repo_settings(self):
    try:
        contents = self.azure_devops_client.get_item_content(
            repository_id=self.repo_slug,
            project=self.workspace_slug,
            download=False,
            include_content_metadata=False,
            include_content=True,
            path=".pr_agent.toml",
        )
        return list(contents)[0]
    except Exception as e:
        get_logger().error(f"Failed to get repo settings, error: {e}")
        return ""

Repro

Push a .pr_agent.toml large enough to span more than one stream chunk to an Azure DevOps repo. Sections at the bottom of the file are silently ignored — extra_instructions, pr_reviewer overrides, etc., behave as if not set even though the file is committed.

Suggested fix

Join over the full iterator:

return b"".join(list(contents))

Environment

  • pr-agent 0.34.3 (PyPI)
  • Azure DevOps git provider

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions