Skip to content

Specify more the relates tag rules in log agent prompt#708

Merged
TomasKorbar merged 1 commit into
packit:mainfrom
TomasKorbar:bind_consolidate_fix
Jul 24, 2026
Merged

Specify more the relates tag rules in log agent prompt#708
TomasKorbar merged 1 commit into
packit:mainfrom
TomasKorbar:bind_consolidate_fix

Conversation

@TomasKorbar

Copy link
Copy Markdown
Collaborator

No description provided.

@qodo-for-packit

Copy link
Copy Markdown

PR Summary by Qodo

Clarify when to include Resolves/Related lines in log agent changelog entries

✨ Enhancement 📝 Documentation 🕐 Less than 5 minutes

Grey Divider

AI Description

• Define rules for adding "- Resolves:" based on the last non-agent changelog entry.
• Skip changelog entries authored by packaging agents when determining prior style.
• Omit Resolves/Related lines when the last human entry did not include them.
Diagram

graph TD
  A(["Log agent"]) --> B["instructions.j2"] --> C[["add_changelog_entry tool"]] --> D[("Spec changelog")]
  B --> E["Last non-agent entry"] --> F{"Include Resolves/Related?"}
  F -->|"yes"| D
  F -->|"no"| D
  subgraph Legend
    direction LR
    _agent(["Agent"]) ~~~ _file["Prompt/file"] ~~~ _tool[["Tool"]] ~~~ _db[("Changelog")] ~~~ _dec{"Decision"}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Move Resolves/Related logic into the changelog tool
  • ➕ Enforces consistent behavior regardless of prompt wording
  • ➕ Reduces prompt complexity and risk of LLM misinterpretation
  • ➖ Requires tool/API changes and test coverage
  • ➖ Less flexible if projects want different per-repo conventions
2. Add a repo-level changelog style config
  • ➕ Makes the rule explicit and easily editable without prompt changes
  • ➕ Supports different conventions across packages
  • ➖ Introduces additional configuration surface area
  • ➖ Still requires the agent/tool to correctly interpret the config

Recommendation: This prompt clarification is a good low-cost improvement and likely sufficient if the main failure mode is inconsistent LLM formatting. If recurring inconsistencies persist, prefer moving the rule into add_changelog_entry (or a shared helper) so the formatting decision is deterministic and not prompt-dependent.

Files changed (1) +4 / -0

Documentation (1) +4 / -0
instructions.j2Clarify Resolves/Related inclusion rules for changelog entries +4/-0

Clarify Resolves/Related inclusion rules for changelog entries

• Adds guidance to decide whether to include a "- Resolves:" line by inspecting the last changelog entry not authored by Ymir-related agents. The prompt now explicitly mirrors prior human-authored style (include Resolves/Related only if the last non-agent entry had one).

ymir/agents/prompts/log/instructions.j2

@qodo-for-packit

qodo-for-packit Bot commented Jul 23, 2026

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 7 rules

Grey Divider


Remediation recommended

1. Ambiguous Resolves/Related rules ✓ Resolved 🐞 Bug ≡ Correctness
Description
The new instruction says to include/omit a "- Resolves:" line based on the last non-Ymir entry, but
it doesn’t clearly override the later default guidance that tells the agent to use "- Resolves:
<JIRA_ISSUES>", leaving precedence ambiguous. It also only references "- Resolves:"/"- Related:"
while the repo already contains valid changelog styles like indented "  Resolves:", so the agent may
mis-detect existing style and choose the wrong tag/format.
Code

ymir/agents/prompts/log/instructions.j2[R15-18]

+   To decide whether to include a "- Resolves:" line, find the last changelog
+   entry that was NOT authored by Ymir (skip entries by "RHEL Packaging Agent"
+   or "redhat-ymir-agent"). If that entry includes a "- Resolves:" or
+   "- Related:" line, include one in your entry. If it does not, omit it.
Relevance

⭐⭐⭐ High

Team previously fixed brittle Resolves/Related matching and accepts prompt wording clarifications to
avoid ambiguous/contradictory guidance.

PR-#477
PR-#655

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The prompt now adds a conditional include/omit rule for a "- Resolves:" line, but the same template
later still tells the agent to use "- Resolves: <JIRA_ISSUES>" by default, which makes the effective
rule unclear. Separately, the repo’s own unit tests show a valid changelog style using an indented
Resolves: line (not a - Resolves: bullet), demonstrating that the new instruction’s literal
matching is too narrow.

ymir/agents/prompts/log/instructions.j2[13-32]
ymir/agents/tests/unit/test_mr_consolidation.py[833-845]
PR-#477

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 log agent instructions added in `log/instructions.j2` introduce a new rule for including a Resolves/Related line, but:
1) It’s unclear whether this new rule overrides the later default instruction to use `- Resolves: <JIRA_ISSUES>` when writing a new entry.
2) The detection criterion is too literal (`- Resolves:` / `- Related:`) and does not cover existing formats in the repo such as indented `  Resolves:`.

This ambiguity can cause inconsistent changelog output across runs and packages.

## Issue Context
The log agent is expected to "use the same style" as existing spec changelog entries, including whether it uses `Resolves:` or `Related:` and how those lines are formatted.

## Fix Focus Areas
- ymir/agents/prompts/log/instructions.j2[13-32]

## Suggested fix approach
- Rewrite the new rule to explicitly state precedence (e.g., “This historical-style check overrides the default `- Resolves:` guidance below”).
- Broaden the style detection language to recognize `Resolves:`/`Related:` lines regardless of indentation/bullet marker (e.g., `Resolves:` / `Related:` with optional leading whitespace and optional `- `).
- When a prior entry contains `Related:` (not `Resolves:`), instruct the agent to emit the same tag (`Related:`) and formatting style, not just “include one.”

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


Grey Divider

Qodo Logo

Comment thread ymir/agents/prompts/log/instructions.j2 Outdated
@TomasKorbar
TomasKorbar force-pushed the bind_consolidate_fix branch from 3f3f172 to f2f4630 Compare July 24, 2026 07:29
@TomasKorbar
TomasKorbar merged commit aaf55e9 into packit:main Jul 24, 2026
11 checks passed
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.

2 participants