Skip to content

Conversation

@majamassarini
Copy link
Member

Fedora infra needs it (otherwise packit is treated like any other AI bot and it is given back the Anubis page).

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/271f018ffd1e4753bb144793cdf87657

pre-commit NODE_FAILURE Node request 200-0008095228 failed in 0s
ogr-tests-pip-deps NODE_FAILURE Node request 200-0008095229 failed in 0s

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @majamassarini, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where Fedora infrastructure was misinterpreting requests from Packit, leading to incorrect responses. By introducing explicit 'Accept' headers in HTTP requests to the Pagure API, the system can now correctly identify the expected content type, ensuring proper communication and preventing misidentification as a generic bot.

Highlights

  • Explicit Accept Header for Pagure API Calls: The Pagure service now explicitly sets an 'Accept' header for API requests. By default, it's set to 'application/json' to ensure proper API response handling.
  • Specific Accept Header for YAML Files: When retrieving file content, particularly for 'packit.yaml', the 'get_file_content' method now sends an 'Accept: application/yaml' header. This ensures that YAML content is correctly returned and parsed.
  • Header Customization in API Calls: The underlying API call functions (_call_project_api_raw and call_api_raw) have been updated to accept an optional 'header' dictionary, allowing for dynamic modification or addition of HTTP headers for specific requests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the ability to specify an Accept header for requests to Pagure, with the goal of correctly fetching YAML files from Fedora infrastructure. A default Accept: application/json header is added for API calls, and get_file_content is modified to request application/yaml.

My review found a critical issue in the implementation of header merging which would break all authenticated API calls. I've provided a suggestion to fix this. I also have a medium-severity comment about a potential design issue where a generic method is made specific, which could affect maintainability.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/f035e0e219ee499eaee37e3fff515e38

pre-commit NODE_FAILURE Node request 200-0008095230 failed in 0s
ogr-tests-pip-deps NODE_FAILURE Node request 200-0008095231 failed in 0s

@majamassarini
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds an Accept header to requests to Pagure to address an issue with Fedora infrastructure. The implementation correctly adds a default Accept: application/json header for API calls and allows overriding it, for example to application/yaml when fetching files. My review focuses on improving the robustness of the header handling logic and addressing a security concern with logging sensitive information. I've identified a few areas for improvement:

  • The logic for providing default or merged headers can be made more robust by checking for None instead of relying on the truthiness of dictionaries.
  • A generic method is being specialized for a specific use case, which could impact maintainability.
  • A new debug log statement is leaking authentication tokens, which is a security risk.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/18be1c5f6e5c4c188856243f032e5da4

pre-commit NODE_FAILURE Node request 200-0008095242 failed in 0s
ogr-tests-pip-deps NODE_FAILURE Node request 200-0008095243 failed in 0s

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/b66c497390ca4f7e9f08c08f5150d3dc

pre-commit NODE_FAILURE Node request 200-0008095244 failed in 0s
ogr-tests-pip-deps NODE_FAILURE Node request 200-0008095245 failed in 0s

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/900582aa6bd442ab953bb09b8c677ebb

pre-commit NODE_FAILURE Node request 200-0008095247 failed in 0s
ogr-tests-pip-deps NODE_FAILURE Node request 200-0008095248 failed in 0s

@majamassarini majamassarini force-pushed the add-accept-header branch 2 times, most recently from 0e2d156 to 7ad5d57 Compare November 24, 2025 10:52
@majamassarini
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds an Accept header to requests made to Pagure to ensure the correct content type is returned, which is a good improvement for robustness. A service-wide default of Accept: application/json is set, and this is correctly overridden to text/plain for raw file content requests. The changes correctly propagate the header parameter through the call stack. I've found one logical issue in how headers are handled in get_file_content when custom headers are provided, and I've included a suggestion to fix it. Otherwise, the changes are well-implemented.

@majamassarini
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for custom request headers, specifically setting a default Accept: application/json header for Pagure API calls and Accept: text/plain for raw file content requests. This is to address an issue with Fedora infrastructure. The changes are well-implemented by adding an optional header parameter to the relevant API call methods and correctly merging service-level and call-specific headers. I've added a suggestion to improve type hinting for better code clarity and consistency.

@softwarefactory-project-zuul
Copy link
Contributor

@majamassarini
Copy link
Member Author

merge before packit/packit#2663

@majamassarini
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the ability to specify an Accept header in requests, which is needed for Fedora infrastructure. The default Accept header is now set to application/json for API calls, and text/plain for file content retrieval. The mechanism for handling custom headers has also been improved.

The implementation is solid, but I've left a couple of comments with suggestions for improvement:

  • One regarding missing type hints and API consistency in get_file_content.
  • Another to improve the accuracy of a new debug log message for request headers.

Overall, good work on addressing the infrastructure requirement.

@softwarefactory-project-zuul
Copy link
Contributor

@softwarefactory-project-zuul
Copy link
Contributor

majamassarini and others added 2 commits November 24, 2025 15:22
Fedora infra needs it (otherwise packit is treated like any other AI bot and it is given back the Anubis page).

Co-authored-by: Nikola Forró <[email protected]>
Co-authored-by: Nikola Forró <[email protected]>
@majamassarini majamassarini added the mergeit Merge via Zuul label Nov 24, 2025
@softwarefactory-project-zuul
Copy link
Contributor

@majamassarini
Copy link
Member Author

/packit retest-failed

@majamassarini majamassarini merged commit 2a335c1 into packit:main Nov 24, 2025
39 of 41 checks passed
@github-project-automation github-project-automation bot moved this from new to done in Packit Kanban Board Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mergeit Merge via Zuul

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

3 participants