Skip to content

Add issue trace links to generated merge requests - #863

Open
opohorel wants to merge 1 commit into
packit:mainfrom
opohorel:trace_mr
Open

opohorel wants to merge 1 commit into
packit:mainfrom
opohorel:trace_mr

Conversation

@opohorel

@opohorel opohorel commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Link each included Jira issue to all of its execution traces using the configured trace viewer URL. Cover all MR creation paths and document the behavior.

Resolves: PACKIT-5222

Assisted-by: OpenAI Codex

@qodo-for-packit

Copy link
Copy Markdown

PR Summary by Qodo

Link Jira execution traces in generated merge requests

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Add a trace-viewer link for each included Jira issue to generated MR descriptions.
• Cover backport, rebase, rebuild, reproducer, and consolidated MR creation paths.
• Test link formatting, duplicate issues, missing configuration, and consolidated descriptions.
Diagram

graph TD
  A["MR agents"] --> B["Shared footer"] --> C["MR description"]
  D["Jira issues"] --> B
  E["Viewer configuration"] --> F["Issue URL helper"] --> B
Loading
High-Level Assessment

Extending the existing shared footer and reusing the issue URL helper keeps link formatting consistent across MR paths. Generating links independently in each agent would duplicate behavior.

Files changed (9) +89 / -9

Enhancement (6) +16 / -8
backport_agent.pyPass the backport issue to both MR footer paths +2/-2

Pass the backport issue to both MR footer paths

• Both the inherited-change and standard backport paths now include the Jira issue when building the MR footer.

ymir/agents/backport_agent.py

constants.pyAdd issue trace links to the shared MR footer +10/-2

Add issue trace links to the shared MR footer

• The footer accepts one or more Jira issues and adds a link for each unique, nonempty issue when a trace viewer is configured. Without issues or viewer configuration, it retains the existing footer.

ymir/agents/constants.py

mr_consolidation_agent.pyInclude consolidated issues in trace links +1/-1

Include consolidated issues in trace links

• The consolidated MR description passes its included Jira issues to the shared footer.

ymir/agents/mr_consolidation_agent.py

rebase_agent.pyInclude rebase issues in trace links +1/-1

Include rebase issues in trace links

• Rebase MR creation passes the full set of consolidated issue keys to the shared footer.

ymir/agents/rebase_agent.py

rebuild_agent.pyInclude rebuild issues in trace links +1/-1

Include rebuild issues in trace links

• Rebuild MR creation passes its primary and consolidated issues to the shared footer.

ymir/agents/rebuild_agent.py

reproducer_agent.pyLink the reproducer issue from its MR +1/-1

Link the reproducer issue from its MR

• Reproducer MR descriptions now pass their Jira issue to the shared footer.

ymir/agents/reproducer_agent.py

Tests (3) +73 / -1
test_constants.pyTest trace-link footer behavior +47/-1

Test trace-link footer behavior

• Tests cover encoded issue URLs, ordered deduplication, empty issues, and missing or empty viewer configuration.

ymir/agents/tests/unit/test_constants.py

test_mr_jira_links.pyTest trace links in consolidated descriptions +16/-0

Test trace links in consolidated descriptions

• A consolidated-description test checks that links for all included issues appear while a source MR's existing trace link remains intact.

ymir/agents/tests/unit/test_mr_jira_links.py

test_reproducer_agent.pyTest reproducer MR trace link +10/-0

Test reproducer MR trace link

• A new test verifies that a reproducer description links to traces for its Jira issue.

ymir/agents/tests/unit/test_reproducer_agent.py

@qodo-for-packit

qodo-for-packit Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Reproducer trace links can point to another issue ✓ Resolved
Description
_build_mr_description passes result.jira_issue to the trace footer instead of the workflow's
input_data.jira_issue. When the agent returns a different issue key, MR creation still uses the
workflow issue for its clone and Jira handling, but the new trace link points to the returned key.
Code

ymir/agents/reproducer_agent.py[775]

+        f"{mr_description_footer(result.package, result.jira_issue)}"
Relevance

●●● Strong

Canonical workflow issue should drive generated links; historical reviews accept preserving
authoritative state across workflow paths.

PR-#589

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The output schema accepts an unconstrained issue string, and analysis only uppercases it. MR
creation uses state.jira_issue for the tests clone, while the changed footer call uses
result.jira_issue.

ymir/common/models.py[1509-1513]
ymir/agents/reproducer_agent.py[895-900]
ymir/agents/reproducer_agent.py[918-932]
ymir/agents/reproducer_agent.py[755-775]

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 reproducer's agent output can name a different issue from the one being processed, causing its new trace link to target the wrong issue.

## Fix Focus Areas
- ymir/agents/reproducer_agent.py[755-775]
- ymir/agents/tests/unit/test_reproducer_agent.py[52-61]

## Recommended Fix
Pass the authoritative input issue to the trace footer. Add a test where the output issue differs from the input issue and verify the trace link targets the input.

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


2. A crafted issue key can forge a trace link ✗ Dismissed
Description
mr_description_footer inserts issue directly into Markdown link text, although it encodes that
value for the link URL. If an issue value contains a closing bracket and link syntax, the generated
MR description can render a clickable destination other than the configured trace viewer.
Code

ymir/agents/constants.py[105]

+        f"- [View all traces for {issue}]({url})"
Relevance

●●● Strong

Security issue is deterministic; historical reviews accept validation and escaping of
attacker-controlled inputs.

PR-#571

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new footer interpolates the unescaped issue into a Markdown label. Reproducer output supplies an
unconstrained string to that footer, and trace_viewer_issue_url encodes only the URL component; a
value such as RHEL-1](https://evil.example) [other therefore forms an additional link in the
rendered text.

ymir/agents/constants.py[29-37]
ymir/agents/constants.py[101-109]
ymir/common/models.py[1509-1513]
ymir/agents/reproducer_agent.py[895-900]
ymir/agents/reproducer_agent.py[775-775]

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

## Issue description
An issue value containing Markdown link syntax can alter the rendered destination of a generated trace link.

## Fix Focus Areas
- ymir/agents/constants.py[101-109]
- ymir/agents/tests/unit/test_constants.py[22-47]

## Recommended Fix
Escape Markdown metacharacters in the issue label before interpolating it into the link, while retaining URL encoding for the destination. Add a test with a key containing closing-bracket and link syntax.

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


3. Some included issues lack trace links ✗ Dismissed
Description
_build_consolidated_description passes only jira_issues_collected to the trace footer, although
consolidation can select a source MR by an issue key found solely in its title or description. When
that key is absent from the source branch’s commit footers, the collection step drops it and the
consolidated MR gets no generated trace link for that issue.
Code

ymir/agents/mr_consolidation_agent.py[1805]

+    parts.append(mr_description_footer(package, jira_issues))
Relevance

●●● Strong

Finding matches the PR’s stated goal: every included Jira issue should receive a generated trace
link.

PR-#726
PR-#662

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Source resolution accepts an issue appearing in an MR title or description, but later replaces the
collected issue list with commit-footer results. The new footer call receives only that list.

ymir/agents/mr_consolidation_agent.py[350-361]
ymir/agents/mr_consolidation_agent.py[719-733]
ymir/agents/mr_consolidation_agent.py[1480-1490]
ymir/agents/constants.py[101-109]

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

## Issue description
Consolidated MRs can select source MRs by Jira keys in their titles or descriptions, but generated trace links use only keys collected from commit footers. A selected issue without a commit footer therefore has no generated trace link.

## Fix Focus Areas
- ymir/agents/mr_consolidation_agent.py[350-407]
- ymir/agents/mr_consolidation_agent.py[719-733]
- ymir/agents/mr_consolidation_agent.py[1805-1805]

## Recommended Fix
Retain the issue keys used to select source MRs and combine them, without duplicates, with commit-footer keys when building the trace-link footer. Add a test for a selected source issue absent from commit footers.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 5 rules
Review mode: Auto: ⚖️ Balanced: Behavioral footer logic spans multiple MR creation paths with real integration risk.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 2a9113a ⚖️ Balanced

Results up to commit f93d764 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Some included issues lack trace links ✗ Dismissed
Description
_build_consolidated_description passes only jira_issues_collected to the trace footer, although
consolidation can select a source MR by an issue key found solely in its title or description. When
that key is absent from the source branch’s commit footers, the collection step drops it and the
consolidated MR gets no generated trace link for that issue.
Code

ymir/agents/mr_consolidation_agent.py[1805]

+    parts.append(mr_description_footer(package, jira_issues))
Relevance

●●● Strong

Finding matches the PR’s stated goal: every included Jira issue should receive a generated trace
link.

PR-#726
PR-#662

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Source resolution accepts an issue appearing in an MR title or description, but later replaces the
collected issue list with commit-footer results. The new footer call receives only that list.

ymir/agents/mr_consolidation_agent.py[350-361]
ymir/agents/mr_consolidation_agent.py[719-733]
ymir/agents/mr_consolidation_agent.py[1480-1490]
ymir/agents/constants.py[101-109]

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

## Issue description
Consolidated MRs can select source MRs by Jira keys in their titles or descriptions, but generated trace links use only keys collected from commit footers. A selected issue without a commit footer therefore has no generated trace link.

## Fix Focus Areas
- ymir/agents/mr_consolidation_agent.py[350-407]
- ymir/agents/mr_consolidation_agent.py[719-733]
- ymir/agents/mr_consolidation_agent.py[1805-1805]

## Recommended Fix
Retain the issue keys used to select source MRs and combine them, without duplicates, with commit-footer keys when building the trace-link footer. Add a test for a selected source issue absent from commit footers.

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


Results up to commit 251b613 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. A crafted issue key can forge a trace link ✗ Dismissed
Description
mr_description_footer inserts issue directly into Markdown link text, although it encodes that
value for the link URL. If an issue value contains a closing bracket and link syntax, the generated
MR description can render a clickable destination other than the configured trace viewer.
Code

ymir/agents/constants.py[105]

+        f"- [View all traces for {issue}]({url})"
Relevance

●●● Strong

Security issue is deterministic; historical reviews accept validation and escaping of
attacker-controlled inputs.

PR-#571

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new footer interpolates the unescaped issue into a Markdown label. Reproducer output supplies an
unconstrained string to that footer, and trace_viewer_issue_url encodes only the URL component; a
value such as RHEL-1](https://evil.example) [other therefore forms an additional link in the
rendered text.

ymir/agents/constants.py[29-37]
ymir/agents/constants.py[101-109]
ymir/common/models.py[1509-1513]
ymir/agents/reproducer_agent.py[895-900]
ymir/agents/reproducer_agent.py[775-775]

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

## Issue description
An issue value containing Markdown link syntax can alter the rendered destination of a generated trace link.

## Fix Focus Areas
- ymir/agents/constants.py[101-109]
- ymir/agents/tests/unit/test_constants.py[22-47]

## Recommended Fix
Escape Markdown metacharacters in the issue label before interpolating it into the link, while retaining URL encoding for the destination. Add a test with a key containing closing-bracket and link syntax.

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


2. Reproducer trace links can point to another issue ✓ Resolved
Description
_build_mr_description passes result.jira_issue to the trace footer instead of the workflow's
input_data.jira_issue. When the agent returns a different issue key, MR creation still uses the
workflow issue for its clone and Jira handling, but the new trace link points to the returned key.
Code

ymir/agents/reproducer_agent.py[775]

+        f"{mr_description_footer(result.package, result.jira_issue)}"
Relevance

●●● Strong

Canonical workflow issue should drive generated links; historical reviews accept preserving
authoritative state across workflow paths.

PR-#589

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The output schema accepts an unconstrained issue string, and analysis only uppercases it. MR
creation uses state.jira_issue for the tests clone, while the changed footer call uses
result.jira_issue.

ymir/common/models.py[1509-1513]
ymir/agents/reproducer_agent.py[895-900]
ymir/agents/reproducer_agent.py[918-932]
ymir/agents/reproducer_agent.py[755-775]

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 reproducer's agent output can name a different issue from the one being processed, causing its new trace link to target the wrong issue.

## Fix Focus Areas
- ymir/agents/reproducer_agent.py[755-775]
- ymir/agents/tests/unit/test_reproducer_agent.py[52-61]

## Recommended Fix
Pass the authoritative input issue to the trace footer. Add a test where the output issue differs from the input issue and verify the trace link targets the input.

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


Grey Divider

Qodo Logo

Comment thread ymir/agents/mr_consolidation_agent.py Outdated
@opohorel

opohorel commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

/agentic_review

Comment thread ymir/agents/reproducer_agent.py Outdated
Comment thread ymir/agents/constants.py
@qodo-for-packit

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 251b613

Link each included Jira issue to all of its execution traces using the configured trace viewer URL. Add links to backport, rebase, rebuild, and reproducer MRs; consolidated MRs retain links through their source descriptions.

Resolves: PACKIT-5222

Assisted-by: OpenAI Codex
@opohorel

opohorel commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

/agentic_review

@qodo-for-packit

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2a9113a

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant