Skip to content

feat(ask): make the ask heading configurable - #2823

Merged
IsmaelMartinez merged 7 commits into
The-PR-Agent:mainfrom
oleksii-tumanov:feature/configurable-ask-heading
Aug 27, 2026
Merged

IsmaelMartinez merged 7 commits into
The-PR-Agent:mainfrom
oleksii-tumanov:feature/configurable-ask-heading

Conversation

@oleksii-tumanov

@oleksii-tumanov oleksii-tumanov commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2038 (Part 3)

Summary

  • add pr_questions.ask_heading for top-level /ask answers
  • preserve literal headings on Markdown providers without leaking escape characters into plain-text converters
  • reject logical line separators so configured headings remain one line across providers
  • keep the Answer section and /ask_line replies unchanged
  • use the shared heading validation introduced by the earlier /review and /improve changes

Result

ask_heading = "Architecture Question" renders:

### **Architecture Question** ❓

Testing

  • focused ask, provider, and shared-heading suites: 139 passed
  • full unit suite: 2522 passed, 1 skipped, 1 xfailed

@github-actions github-actions Bot added the feature 💡 label Aug 26, 2026
@oleksii-tumanov
oleksii-tumanov marked this pull request as ready for review August 26, 2026 18:46
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Make top-level /ask headings configurable

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds configurable top-level /ask headings while preserving existing Markdown and emoji
 formatting.
• Reuses review-heading validation, trimming values and falling back to Ask when invalid.
• Documents configuration and verifies custom, default, and invalid heading behavior.
Diagram

graph TD
  Docs["Ask Documentation"] --> Repo["Repository Config"] --> Settings["Question Settings"] --> Helper["Heading Formatter"] --> Ask["Ask Tool"] --> Comment["Answer Comment"]
  Defaults["Default Config"] --> Settings
  Tests["Unit Tests"] --> Helper
Loading
High-Level Assessment

The selected approach is appropriate: centralizing heading validation avoids duplicating the review-heading rules, while a dedicated formatter preserves /ask Markdown structure and keeps /ask_line and the Answer section unchanged. Direct formatting inside PRQuestions was considered but would duplicate fallback logic and weaken consistency.

Files changed (6) +61 / -12

Enhancement (2) +19 / -8
utils.pyShare heading validation and format ask headers +17/-6

Share heading validation and format ask headers

• Extracts reusable validation and fallback handling from review-header formatting. Adds a formatter for top-level '/ask' headings that trims valid values and renders the fixed Markdown and emoji.

pr_agent/algo/utils.py

pr_questions.pyRender configured headings in ask responses +2/-2

Render configured headings in ask responses

• Replaces the hard-coded 'Ask' header with the shared question-header formatter. The question body and 'Answer' section remain unchanged.

pr_agent/tools/pr_questions.py

Tests (1) +26 / -4
test_pr_questions_helpers.pyCover ask heading formatting and fallbacks +26/-4

Cover ask heading formatting and fallbacks

• Strengthens the default response assertion and adds coverage for custom trimmed headings. Parameterized tests verify fallback behavior for missing, blank, multiline, carriage-return, and non-string values.

tests/unittest/test_pr_questions_helpers.py

Documentation (1) +11 / -0
ask.mdDocument configurable top-level ask headings +11/-0

Document configurable top-level ask headings

• Documents the setting's default, rendered format, and scope. Adds a custom 'Architecture Question' example and clarifies that '/ask_line' and the Answer heading remain unchanged.

docs/docs/tools/ask.md

Other (2) +5 / -0
.pr_agent.tomlConfigure the repository's default ask heading +3/-0

Configure the repository's default ask heading

• Adds a repository-level 'pr_questions.ask_heading' example set to 'Ask'. This demonstrates the new option without changing current output.

.pr_agent.toml

configuration.tomlDefine the default ask heading setting +2/-0

Define the default ask heading setting

• Adds 'pr_questions.ask_heading' with 'Ask' as the default and explains that Markdown and emoji are applied automatically.

pr_agent/settings/configuration.toml

@qodo-code-review

qodo-code-review Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. Gerrit drops heading punctuation ✓ Resolved 🐞 Bug ≡ Correctness
Description
Marking Gerrit as not supporting heading escapes sends the raw configured text through
adopt_to_gerrit_message(), which indiscriminately removes every * and #; valid headings such
as Architecture **Question** or C# therefore become Architecture Question or C instead of
the configured plain text. This contradicts the feature's literal-text behavior and is not covered
by the new Gerrit test because it only uses punctuation that the converter preserves.
Code

pr_agent/git_providers/gerrit_provider.py[315]

+            "markdown_backslash_escapes",
Relevance

●●● Strong

Recent accepted correctness precedents favor fixing provider-specific data loss; no close rejection
precedent exists.

PR-#2314
PR-#2618

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The helper treats punctuation-bearing strings as valid literal headings, while Gerrit's conversion
removes punctuation globally: line 117 removes every asterisk, and line 127 removes every hash from
any heading line. The new provider capability at line 315 selects the raw, unescaped path, so those
configured characters reach and are deleted by this converter.

pr_agent/algo/utils.py[103-108]
pr_agent/git_providers/gerrit_provider.py[112-135]
tests/unittest/test_pr_questions_helpers.py[151-171]
tests/unittest/test_pr_questions_helpers.py[192-208]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Gerrit's opt-out from Markdown backslash escapes causes raw configured heading punctuation to be consumed by the provider's Markdown-to-plaintext converter.

## Issue Context
`adopt_to_gerrit_message()` removes all asterisks and all hashes on heading lines, including characters belonging to the configured heading rather than the surrounding Markdown. Preserve literal configured punctuation while still removing the generated heading markup, and add coverage for `*` and `#` headings.

## Fix Focus Areas
- pr_agent/git_providers/gerrit_provider.py[112-135]
- pr_agent/git_providers/gerrit_provider.py[309-319]
- tests/unittest/test_pr_questions_helpers.py[192-208]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. ask_heading missing root mirror 📘 Rule violation ≡ Correctness ⭐ New
Description
The new pr_questions.ask_heading setting is defined only in
pr_agent/settings/configuration.toml, while the root .pr_agent.toml has no matching key. This
violates the required synchronization of configuration keys across both locations.
Code

pr_agent/settings/configuration.toml[161]

+ask_heading = "Ask"
Relevance

●●● Strong

Recent accepted configuration findings enforce synchronized defaults and consistent settings
definitions across configuration files.

PR-#2528
PR-#2490

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2694685 requires changed configuration keys to exist consistently in the root and settings TOML
files. The PR adds ask_heading = "Ask" under [pr_questions] in the settings file, while the root
.pr_agent.toml contains no pr_questions section or ask_heading key.

Rule 2694685: Keep .pr_agent.toml and pr_agent/settings/*.toml configuration in sync on behavior changes
pr_agent/settings/configuration.toml[157-161]
.pr_agent.toml[1-27]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new `pr_questions.ask_heading` configuration key is missing from the root `.pr_agent.toml`.

## Issue Context
PR Compliance ID 2694685 requires configuration keys and intended defaults to remain synchronized between `.pr_agent.toml` and `pr_agent/settings/*.toml` when behavior changes.

## Fix Focus Areas
- .pr_agent.toml[23-27]
- pr_agent/settings/configuration.toml[160-161]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Unicode separators split headings ✓ Resolved 🐞 Bug ≡ Correctness ⭐ New
Description
format_pr_questions_header() accepts configured headings containing line boundaries other than
\n or \r, such as U+2028, and embeds them into the generated header. Gerrit's splitlines()
then divides that header before its special conversion can match it, publishing a malformed
multi-line heading instead of the configured top-level heading.
Code

pr_agent/algo/utils.py[R103-105]

+def format_pr_questions_header(*, escape_markdown: bool = True) -> str:
+    """Return the visible heading for top-level /ask answers."""
+    heading = _get_configured_heading("pr_questions.ask_heading", "Ask")
Relevance

●●● Strong

Recent accepted findings consistently harden Unicode and malformed-input boundaries in utilities;
this is a deterministic downstream-splitting bug.

PR-#2618
PR-#2772

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new /ask formatter passes the configured value through _get_configured_heading, whose
validation rejects only CR and LF. Gerrit's downstream adapter uses splitlines(), so an accepted
value such as "Architecture\u2028Question" becomes two lines and no longer matches the
generated-heading prefix/suffix conversion.

pr_agent/algo/utils.py[80-108]
pr_agent/git_providers/gerrit_provider.py[121-140]
pr_agent/tools/pr_questions.py[131-135]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Configured `/ask` headings containing separators recognized by `str.splitlines()` can bypass the current CR/LF-only validation and become malformed provider output.

## Issue Context
The shared heading validator checks only `\n` and `\r`, while Gerrit's message adapter splits on the broader set of Python line boundaries. Preserve the existing fallback behavior for any heading that is not exactly one logical line.

## Fix Focus Areas
- pr_agent/algo/utils.py[80-108]
- tests/unittest/test_pr_questions_helpers.py[139-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Escapes leak on plaintext providers ✓ Resolved 🐞 Bug ≡ Correctness
Description
format_pr_questions_header() inserts Markdown backslash escapes into the shared answer before
provider-specific conversion, but CodeCommit and Gerrit do not remove those escapes. Valid
punctuation-bearing headings therefore display literal backslashes on those providers instead of the
configured plain text.
Code

pr_agent/algo/utils.py[R106-107]

+    escaped_heading = heading.translate(_MARKDOWN_PUNCTUATION_ESCAPE_TABLE)
+    return f"### **{escaped_heading}**❓"
Relevance

●●● Strong

Recent accepted precedents favor provider-specific correctness fixes and escaped-output regressions
in shared formatting paths.

PR-#2622
PR-#2618
PR-#2689

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The formatter adds backslashes to every ASCII punctuation character, and _prepare_pr_answer()
sends that generated string through the selected provider. CodeCommit's comment cleanup and Gerrit's
adopt_to_gerrit_message() conversion do not decode Markdown backslash escapes, so those newly
added characters remain visible in their plaintext output.

pr_agent/algo/utils.py[103-107]
pr_agent/tools/pr_questions.py[72-79]
pr_agent/tools/pr_questions.py[120-134]
pr_agent/git_providers/codecommit_provider.py[169-184]
pr_agent/git_providers/codecommit_provider.py[408-430]
pr_agent/git_providers/gerrit_provider.py[112-129]
pr_agent/git_providers/gerrit_provider.py[376-379]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The shared `/ask` heading is escaped as Markdown before provider dispatch, so plaintext conversion paths for CodeCommit and Gerrit preserve visible backslashes in punctuation-bearing configured headings.

## Issue Context
Keep the heading as plain text until output formatting, or ensure non-Markdown provider converters decode the added escapes without weakening the fixed heading structure on Markdown providers.

## Fix Focus Areas
- pr_agent/algo/utils.py[103-107]
- pr_agent/git_providers/codecommit_provider.py[169-184]
- pr_agent/git_providers/gerrit_provider.py[112-129]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (2)
5. Heading breaks fixed Markdown ✓ Resolved 🐞 Bug ≡ Correctness
Description
format_pr_questions_header() interpolates every single-line string directly between **
delimiters, so an accepted value containing Markdown such as Architecture **Question terminates or
unbalances the bold span and changes the rendered heading structure. This contradicts the documented
guarantee that Markdown formatting remains fixed and can produce malformed /ask headings.
Code

pr_agent/algo/utils.py[R101-102]

+    heading = _get_configured_heading("pr_questions.ask_heading", "Ask")
+    return f"### **{heading}**❓"
Relevance

●●● Strong

Clear Markdown-injection correctness bug; recent repository history accepts defensive fixes
preventing malformed rendered output.

PR-#2622
PR-#2772

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The shared validator rejects only non-strings, blank strings, and line breaks, then the /ask
formatter places the accepted text directly inside bold delimiters. The documentation explicitly
states that Markdown formatting remains fixed, so a value containing ** is accepted despite being
able to alter that formatting.

pr_agent/algo/utils.py[76-88]
pr_agent/algo/utils.py[99-102]
docs/docs/tools/ask.md[69-75]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Configured `/ask` headings are inserted unescaped inside fixed Markdown delimiters. Valid single-line values containing Markdown control characters can break the promised heading format.

## Issue Context
Keep whitespace trimming and fallback behavior, but ensure accepted heading text cannot alter the surrounding `### **...**❓` structure. Add coverage for values containing `**` or other supported Markdown syntax.

## Fix Focus Areas
- pr_agent/algo/utils.py[76-102]
- tests/unittest/test_pr_questions_helpers.py[137-147]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Comment lacks imperative phrasing ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new ask_heading configuration comment is a descriptive noun phrase rather than an imperative
instruction. This violates the required phrasing convention for newly added comments.
Code

pr_agent/settings/configuration.toml[160]

+# Visible base heading for top-level /ask answer comments. Markdown and emoji are added automatically.
Relevance

●●● Strong

Recent same-file precedents explicitly accept rewriting configuration comments into imperative
phrasing.

PR-#2796
PR-#2797

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2694688 requires imperative phrasing for newly added comments. The added comment
starts with the descriptive fragment Visible base heading and contains no imperative verb.

Rule 2694688: Docstrings and comments must use imperative phrasing
pr_agent/settings/configuration.toml[160-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Rewrite the new `ask_heading` configuration comment in imperative mood, for example: `# Set the visible base heading for top-level /ask answer comments; Markdown and emoji are added automatically.`

## Issue Context
PR Compliance ID 2694688 requires newly added comments that describe behavior to use imperative phrasing.

## Fix Focus Areas
- pr_agent/settings/configuration.toml[160-160]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


  • Author self-review: I have reviewed the code review findings, and addressed the relevant ones.

Grey Divider

Context sources
✅ Compliance rules (platform): 34 rules
Review mode: ⚖️ Balanced

Grey Divider

Tip of the day
💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 15ba4a2

Results up to commit d99fcef ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 📜 Skill insights (0)


Remediation recommended
1. Heading breaks fixed Markdown ✓ Resolved 🐞 Bug ≡ Correctness
Description
format_pr_questions_header() interpolates every single-line string directly between **
delimiters, so an accepted value containing Markdown such as Architecture **Question terminates or
unbalances the bold span and changes the rendered heading structure. This contradicts the documented
guarantee that Markdown formatting remains fixed and can produce malformed /ask headings.
Code

pr_agent/algo/utils.py[R101-102]

+    heading = _get_configured_heading("pr_questions.ask_heading", "Ask")
+    return f"### **{heading}**❓"
Relevance

●●● Strong

Clear Markdown-injection correctness bug; recent repository history accepts defensive fixes
preventing malformed rendered output.

PR-#2622
PR-#2772

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The shared validator rejects only non-strings, blank strings, and line breaks, then the /ask
formatter places the accepted text directly inside bold delimiters. The documentation explicitly
states that Markdown formatting remains fixed, so a value containing ** is accepted despite being
able to alter that formatting.

pr_agent/algo/utils.py[76-88]
pr_agent/algo/utils.py[99-102]
docs/docs/tools/ask.md[69-75]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Configured `/ask` headings are inserted unescaped inside fixed Markdown delimiters. Valid single-line values containing Markdown control characters can break the promised heading format.

## Issue Context
Keep whitespace trimming and fallback behavior, but ensure accepted heading text cannot alter the surrounding `### **...**❓` structure. Add coverage for values containing `**` or other supported Markdown syntax.

## Fix Focus Areas
- pr_agent/algo/utils.py[76-102]
- tests/unittest/test_pr_questions_helpers.py[137-147]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Comment lacks imperative phrasing ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new ask_heading configuration comment is a descriptive noun phrase rather than an imperative
instruction. This violates the required phrasing convention for newly added comments.
Code

pr_agent/settings/configuration.toml[160]

+# Visible base heading for top-level /ask answer comments. Markdown and emoji are added automatically.
Relevance

●●● Strong

Recent same-file precedents explicitly accept rewriting configuration comments into imperative
phrasing.

PR-#2796
PR-#2797

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2694688 requires imperative phrasing for newly added comments. The added comment
starts with the descriptive fragment Visible base heading and contains no imperative verb.

Rule 2694688: Docstrings and comments must use imperative phrasing
pr_agent/settings/configuration.toml[160-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Rewrite the new `ask_heading` configuration comment in imperative mood, for example: `# Set the visible base heading for top-level /ask answer comments; Markdown and emoji are added automatically.`

## Issue Context
PR Compliance ID 2694688 requires newly added comments that describe behavior to use imperative phrasing.

## Fix Focus Areas
- pr_agent/settings/configuration.toml[160-160]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 9d6bede ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 📜 Skill insights (0)


Remediation recommended
1. Escapes leak on plaintext providers ✓ Resolved 🐞 Bug ≡ Correctness
Description
format_pr_questions_header() inserts Markdown backslash escapes into the shared answer before
provider-specific conversion, but CodeCommit and Gerrit do not remove those escapes. Valid
punctuation-bearing headings therefore display literal backslashes on those providers instead of the
configured plain text.
Code

pr_agent/algo/utils.py[R106-107]

+    escaped_heading = heading.translate(_MARKDOWN_PUNCTUATION_ESCAPE_TABLE)
+    return f"### **{escaped_heading}**❓"
Relevance

●●● Strong

Recent accepted precedents favor provider-specific correctness fixes and escaped-output regressions
in shared formatting paths.

PR-#2622
PR-#2618
PR-#2689

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The formatter adds backslashes to every ASCII punctuation character, and _prepare_pr_answer()
sends that generated string through the selected provider. CodeCommit's comment cleanup and Gerrit's
adopt_to_gerrit_message() conversion do not decode Markdown backslash escapes, so those newly
added characters remain visible in their plaintext output.

pr_agent/algo/utils.py[103-107]
pr_agent/tools/pr_questions.py[72-79]
pr_agent/tools/pr_questions.py[120-134]
pr_agent/git_providers/codecommit_provider.py[169-184]
pr_agent/git_providers/codecommit_provider.py[408-430]
pr_agent/git_providers/gerrit_provider.py[112-129]
pr_agent/git_providers/gerrit_provider.py[376-379]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The shared `/ask` heading is escaped as Markdown before provider dispatch, so plaintext conversion paths for CodeCommit and Gerrit preserve visible backslashes in punctuation-bearing configured headings.

## Issue Context
Keep the heading as plain text until output formatting, or ensure non-Markdown provider converters decode the added escapes without weakening the fixed heading structure on Markdown providers.

## Fix Focus Areas
- pr_agent/algo/utils.py[103-107]
- pr_agent/git_providers/codecommit_provider.py[169-184]
- pr_agent/git_providers/gerrit_provider.py[112-129]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 64cf0bd ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 📜 Skill insights (0)


Action required
1. Gerrit drops heading punctuation ✓ Resolved 🐞 Bug ≡ Correctness
Description
Marking Gerrit as not supporting heading escapes sends the raw configured text through
adopt_to_gerrit_message(), which indiscriminately removes every * and #; valid headings such
as Architecture **Question** or C# therefore become Architecture Question or C instead of
the configured plain text. This contradicts the feature's literal-text behavior and is not covered
by the new Gerrit test because it only uses punctuation that the converter preserves.
Code

pr_agent/git_providers/gerrit_provider.py[315]

+            "markdown_backslash_escapes",
Relevance

●●● Strong

Recent accepted correctness precedents favor fixing provider-specific data loss; no close rejection
precedent exists.

PR-#2314
PR-#2618

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The helper treats punctuation-bearing strings as valid literal headings, while Gerrit's conversion
removes punctuation globally: line 117 removes every asterisk, and line 127 removes every hash from
any heading line. The new provider capability at line 315 selects the raw, unescaped path, so those
configured characters reach and are deleted by this converter.

pr_agent/algo/utils.py[103-108]
pr_agent/git_providers/gerrit_provider.py[112-135]
tests/unittest/test_pr_questions_helpers.py[151-171]
tests/unittest/test_pr_questions_helpers.py[192-208]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Gerrit's opt-out from Markdown backslash escapes causes raw configured heading punctuation to be consumed by the provider's Markdown-to-plaintext converter.

## Issue Context
`adopt_to_gerrit_message()` removes all asterisks and all hashes on heading lines, including characters belonging to the configured heading rather than the surrounding Markdown. Preserve literal configured punctuation while still removing the generated heading markup, and add coverage for `*` and `#` headings.

## Fix Focus Areas
- pr_agent/git_providers/gerrit_provider.py[112-135]
- pr_agent/git_providers/gerrit_provider.py[309-319]
- tests/unittest/test_pr_questions_helpers.py[192-208]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@oleksii-tumanov

Copy link
Copy Markdown
Contributor Author

Changes relates to #2820 and #2630.

@oleksii-tumanov
oleksii-tumanov force-pushed the feature/configurable-ask-heading branch from 67491c1 to d99fcef Compare August 26, 2026 19:11
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit d99fcef

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 9d6bede

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 64cf0bd

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 3b7ceb9

@IsmaelMartinez IsmaelMartinez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nearly there, one thing to fix. Thanks for turning parts 2 and 3 round this fast.

A heading that ends in punctuation still loses its bold. I put seven through GitHub's own markdown API: five come back with literal asterisks, including your own Architecture **Question** example, plus Ask!, Ask (v2), C++ and C#. Plain Ask and Q&A are fine.

A space before the emoji fixes all seven. It is not a one-liner though, and I measured why: two source lines plus twelve exact-string assertions in tests/unittest/test_pr_questions_helpers.py. Detail inline.

The provider split is a good answer to the escape leak and the Gerrit round-trip holds. Two unrelated one-liners inline, both clickable. CI is red on one timing test that has nothing to do with this change, so it wants a re-run.

Comment thread pr_agent/algo/utils.py Outdated
heading = _get_configured_heading("pr_questions.ask_heading", "Ask")
if escape_markdown:
heading = heading.translate(_MARKDOWN_PUNCTUATION_ESCAPE_TABLE)
return f"### **{heading}**❓"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here is the measurement. Each heading went through GitHub's markdown API, checking whether a <strong> tag comes back:

heading today with a space
Ask bold bold
Q&A bold bold
Ask! literal ** bold
Ask (v2) literal ** bold
C++ literal ** bold
C# literal ** bold
Architecture **Question** literal ** bold

The closing ** ends up between punctuation and a non-space character, so it never closes. That also makes the line in ask.md about keeping "the surrounding formatting and ❓ emoji fixed" not quite true yet.

No suggestion attached, on purpose. Changing this line on its own turns CI red: _ASK_HEADING_SUFFIX in the Gerrit converter has to move with it, or the heading stops matching and falls back to the generic stripper. I ran both edits against your branch merged onto main: 12 tests fail, all exact-string assertions in tests/unittest/test_pr_questions_helpers.py, and they need the new spacing too.

Comment thread docs/docs/tools/ask.md Outdated
extra_instructions = "Do not answer questions that ask to rate PR quality on a scale of 1 to 10."
```

The heading above renders as <code>### **Architecture Question**❓</code>.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The ** inside <code> is still processed, so this line renders as ### <strong>Architecture Question</strong>❓ rather than the literal form you are documenting. Backticks keep it verbatim.

Suggested change
The heading above renders as <code>### **Architecture Question**❓</code>.
The heading above renders as `### **Architecture Question**❓`.

Comment thread .pr_agent.toml Outdated
Comment on lines 10 to 13
[pr_questions]
ask_heading = "Ask"

[github_app]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This file's header says it is read by Qodo's hosted bot, not by the pr-agent in this repo, and the value is the default anyway, so these three lines do nothing. #2797 left review_heading out of it for the same reason. #2820 has the same three lines to drop.

Suggested change
[pr_questions]
ask_heading = "Ask"
[github_app]
[github_app]

@oleksii-tumanov
oleksii-tumanov force-pushed the feature/configurable-ask-heading branch from 3b7ceb9 to 624f33e Compare August 27, 2026 15:07
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 624f33e

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit a2d2cfc

@IsmaelMartinez IsmaelMartinez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All fixed, approving.

The bold now survives every case I tested: Ask!, Ask (v2), C++, C# and Architecture **Question** all come back with real emphasis from GitHub's renderer, and the Gerrit suffix moved with it.

The splitlines() guard is a nice catch and better than what I asked for. It rejects U+2028, U+2029, \v, \f and \x85, which the old \n/\r check let through. I probed eleven legitimate headings including tabs and non-Latin text and none is wrongly rejected.

One thing before this can go in, and it is my doing rather than yours: I merged #2820 a moment ago and it has put this into conflict in pr_agent/algo/utils.py. Both hunks are additive, so please do not take either side wholesale. Main now carries a second copy of _get_configured_heading with the old \n/\r check, and yours with the splitlines() guard is the one to keep. The other hunk wants both functions, format_pr_code_suggestions_header from main and your format_pr_questions_header.

Rebase and I will merge. Happy to do the rebase myself if you would rather, just say so, as you seem to be mid-push and I did not want to force-push over you.

@oleksii-tumanov
oleksii-tumanov force-pushed the feature/configurable-ask-heading branch from a2d2cfc to 15ba4a2 Compare August 27, 2026 15:57
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 15ba4a2

@oleksii-tumanov

Copy link
Copy Markdown
Contributor Author

addressed comments and rebased PR. It seems clean now.

@IsmaelMartinez
IsmaelMartinez merged commit cdac1c8 into The-PR-Agent:main Aug 27, 2026
5 checks passed
@IsmaelMartinez

Copy link
Copy Markdown
Collaborator

merged. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Configurable Comment Heading

2 participants