Skip to content

fix(tickets): skip date prefixes in branch issue numbers - #4959

Merged
IsmaelMartinez merged 1 commit into
The-PR-Agent:mainfrom
oleksii-tumanov:fix/branch-issue-date-prefix
Nov 15, 2026
Merged

IsmaelMartinez merged 1 commit into
The-PR-Agent:mainfrom
oleksii-tumanov:fix/branch-issue-date-prefix

Conversation

@oleksii-tumanov

@oleksii-tumanov oleksii-tumanov commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

User description

A PR from a date-named branch such as release/2026-11-15 or deploy/2025-03 matched the default branch issue pattern. With extract_issue_from_branch on by default, /review fetched issue #2026 or #2025 and checked the PR against an unrelated ticket.

The default pattern now skips a year (19xx or 20xx) followed by a month (01-12) at the start of a branch segment, also when a /, . or _ follows, as in deploy/2025-03/eu. Everything else keeps the documented rule: 123-fix, feature/42-2026-11-15 and 2026-11/123-fix still link #123, #42 and #123, and an ambiguous name such as 2024-upgrade-deps still links #2024. A custom branch_issue_regex is not affected. The configuration comment and the generated reference mention the exception.

The open GitLab branch inference in #4911 uses its own pattern, so it would need the same exception if it lands. That PR also edits the branch_issue_regex comment, so whichever merges second has a small text conflict there.

Validation:

  • New cases in tests/unittest/test_extract_issue_from_branch.py: five date branches return no issue, and four non-date branches keep their issue. The date cases fail on main.
  • PYTHONPATH=. uv run pytest -q tests/unittest: 18,581 passed, 66 skipped.
  • Ruff and changed-file pre-commit hooks: passed.

PR Type

Bug fix, Tests, Documentation


Description

  • Exclude date prefixes from branch issue extraction.

  • Preserve valid issue numbers and custom patterns.

  • Add regression tests and update configuration documentation.


File Walkthrough

Relevant files
Bug fix
ticket_pr_compliance_check.py
Exclude date prefixes from default branch issue matching 

pr_agent/commands/ticket_pr_compliance_check.py

  • Exclude 19xx and 20xx year prefixes followed by valid months from the
    default branch issue pattern.
  • Recognize date boundaries at hyphens, slashes, dots, underscores, or
    branch end.
  • Document date-prefix exclusion while leaving custom regex handling
    unchanged.
+5/-3     
Tests
test_extract_issue_from_branch.py
Cover date exclusions and preserved branch issue extraction

tests/unittest/test_extract_issue_from_branch.py

  • Add five parameterized cases excluding date-prefixed branches.
  • Add four cases preserving ambiguous years, invalid months, and
    legitimate issue numbers.
  • Verify extraction continues after a skipped date segment.
+24/-0   
Documentation
configuration_reference.md
Document date-prefix exclusion in the configuration reference

docs/docs/usage-guide/configuration_reference.md

  • Update the branch_issue_regex reference to document default
    date-prefix exclusion.
+1/-1     
configuration.toml
Clarify default branch issue pattern configuration comments

pr_agent/settings/configuration.toml

  • Clarify that the default branch_issue_regex pattern skips date
    prefixes.
  • Retain the existing GitHub-only scope and configuration value.
+2/-1     


⚙️ Agent run details
  • Model: openai/gpt-6.1-sol
  • Tokens: 7,036 in / 448 out / 7,484 total
  • Time cost: 9.4s
  • AI calls: 1

A branch such as release/2026-11-15 or deploy/2025-03 matched the default
branch pattern, so /review fetched issue The-PR-Agent#2026 or The-PR-Agent#2025 and checked the PR
against an unrelated ticket. The default pattern now skips a year followed
by a month. Other numbers keep the documented rule, including ambiguous
ones such as 2024-upgrade-deps.
@the-pr-agent-bot

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ❌

2026 - Not compliant

Non-compliant requirements:

  • Add Dependabot configuration.
  • Enable automated dependency-update pull requests.

Requires further human verification:

  • Confirm maintainer control over dependency-update reviews and merges.
  • Confirm this ticket is intended to be associated with this unrelated branch-extraction fix.

2025 - Not compliant

Non-compliant requirements:

  • Add Slack notifications.
  • Support notifications across git providers.
  • Minimize provider API calls for notifications.
  • Provide adaptable notification messages.
  • Add a disabled-by-default enable flag.

Requires further human verification:

  • Confirm this ticket is intended to be associated with this unrelated branch-extraction fix.

123 - Not compliant

Non-compliant requirements:

  • Fix preservation of existing pull-request labels.

Requires further human verification:

  • Confirm this ticket is intended to be associated with this unrelated branch-extraction fix.
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

⚙️ Agent run details
  • Model: openai/gpt-6.1-sol
  • Tokens: 12,543 in / 536 out / 13,079 total
  • Time cost: 8.2s
  • AI calls: 1

@the-pr-agent-bot

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.


⚙️ Agent run details
  • Model: openai/gpt-6.1-sol
  • Tokens: 6,629 in / 78 out / 6,707 total
  • Time cost: 3.3s
  • AI calls: 1

@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.

Thanks for fixing date-named branches being read as issue numbers: I confirmed the new date cases fail on main and pass here, that 2024-upgrade-deps, feature/42-2026-11-15 and 2026-11/123-fix keep their documented issues, and that the added lookahead stays linear when I double adversarial inputs.

@IsmaelMartinez
IsmaelMartinez merged commit de3dc62 into The-PR-Agent:main Nov 15, 2026
19 checks passed
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.

2 participants