Skip to content

Comments

fix: prevent pre-dispatch false positives from substring and non-completion matches#807

Merged
marcusquinn merged 1 commit intomainfrom
hotfix/pre-dispatch-false-positives
Feb 9, 2026
Merged

fix: prevent pre-dispatch false positives from substring and non-completion matches#807
marcusquinn merged 1 commit intomainfrom
hotfix/pre-dispatch-false-positives

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 9, 2026

Summary

Hotfix for PR #806's pre-dispatch verification which was too aggressive, causing false cancellations.

Bugs fixed:

  1. Substring matching: t020 matched t020.6 commits. Added boundary pattern task_id([^.0-9]|$) to prevent parent IDs matching subtask commits
  2. Non-completion commits: chore: add t194 matched because chore was in the evidence pattern. Now requires PR merge reference (#NNN) and excludes add/claim/queue/blocked commits
  3. GitHub PR search: Added quotes around task ID to prevent substring matches

Impact: 4 tasks (t020.4, t020.5, t020.6, t194) were falsely cancelled. Will re-queue after merge.

Summary by CodeRabbit

  • Bug Fixes
    • Improved accuracy of task completion detection by implementing stricter matching criteria for task references in commit messages and pull requests, preventing partial or substring matches from incorrectly identifying completed tasks.
    • Enhanced search precision to require exact task matches, reducing false positive identification of task references and preventing erroneous task status updates.

…letion matches

Three bugs fixed in check_task_already_done():
1. Substring matching: t020 was matching t020.6 commits. Added word boundary
   pattern that prevents parent task IDs from matching subtask commits.
2. Non-completion commits: 'chore: add t194' matched because 'chore' was in
   the completion evidence pattern. Now requires PR merge reference (#NNN)
   and excludes add/claim/queue/blocked commits.
3. GitHub PR search: added quotes around task ID to prevent substring matches.

Root cause: the pre-dispatch check (PR #806) was too aggressive, cancelling
4 tasks (t020.4-6, t194) that were NOT actually done.
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, 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 provides a hotfix to address false positives in the pre-dispatch verification system, which were causing incorrect task cancellations. The changes focus on increasing the precision of task completion detection by refining how task IDs are matched in commit messages and GitHub PR titles, and by establishing stricter criteria for what constitutes a valid completion commit. This ensures that the system accurately identifies truly completed tasks, thereby preventing premature cancellations and improving overall task management reliability.

Highlights

  • Improved Task ID Matching: Implemented a custom regex boundary pattern (task_id([^.0-9]|$)) to prevent parent task IDs (e.g., 't020') from incorrectly matching subtask commits (e.g., 't020.6') in commit message searches.
  • Refined Completion Verification Logic: Enhanced the criteria for identifying completion commits by requiring a PR merge reference (e.g., '(#NNN)') and explicitly excluding non-completion commit types such as 'add', 'claim', 'mark blocked', or 'queue' from being considered as completion evidence.
  • Exact GitHub PR Search: Modified the GitHub CLI PR search command to enclose the task ID in quotes (e.g., '"$task_id" in:title'), ensuring an exact match in PR titles and preventing false positives from substring matches.
Changelog
  • .agents/scripts/supervisor-helper.sh
    • Introduced escaped_task_regex and boundary_pattern variables to create a precise regex for matching task IDs, preventing substring matches like 't020' matching 't020.6'.
    • Updated the commit_count calculation to use the new boundary_pattern for more accurate commit filtering.
    • Modified the completion_evidence check to include the boundary_pattern, require a PR merge reference ((#NNN)|PR #[0-9]+ merged), and explicitly exclude non-completion commit types (add, claim, mark, queue, blocked).
    • Changed the gh pr list command's search parameter from "$task_id in:title" to "\"$task_id\" in:title" to enforce exact matching of the task ID in PR titles.
Activity
  • The author, marcusquinn, created this pull request as a hotfix for issues stemming from a previous PR (feat: add pre-dispatch verification to prevent dispatching already-done tasks #806).
  • The PR description clearly outlines three specific bugs related to pre-dispatch verification and their impact on four falsely cancelled tasks (t020.4, t020.5, t020.6, t194).
  • The author has stated that the falsely cancelled tasks will be re-queued after this merge, indicating a clear plan for remediation.
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Updated .agents/scripts/supervisor-helper.sh to enhance task completion detection accuracy. Added regex boundary-aware pattern matching to prevent false positive substring matches when identifying task IDs in commits, and tightened GitHub PR title search to require exact task ID matching with quoted search syntax.

Changes

Cohort / File(s) Summary
Task Completion Detection Enhancement
.agents/scripts/supervisor-helper.sh
Refined check_task_already_done() to use boundary-aware regex for commit message task ID detection (preventing matches like "add tNNN"), and updated GitHub PR search to use exact title matching syntax ("$task_id" in:title).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🎯 Boundaries set with regex care,
False positives exit with a fare,
Quotes now guard the GitHub shore,
Task precision—fortified once more! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/pre-dispatch-false-positives

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 61 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Mon Feb 9 20:42:44 UTC 2026: Code review monitoring started
Mon Feb 9 20:42:45 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 61

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 61
  • VULNERABILITIES: 0

Generated on: Mon Feb 9 20:42:47 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

@marcusquinn marcusquinn merged commit af93667 into main Feb 9, 2026
9 of 10 checks passed
Copy link

@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 introduces several important fixes to the pre-dispatch verification logic to prevent false positives. The changes correctly add boundary matching for task IDs in git logs and exact matching for GitHub PR searches. My review confirms the new regex patterns are robust. I've identified a couple of instances where an unescaped task ID is used in a regex, which could lead to incorrect behavior for subtasks. The proposed suggestions will fix these issues and also resolve a ShellCheck violation for an unused variable, in line with the repository's style guide.

# grep -w uses word boundaries but dots aren't word chars, so for subtask IDs
# like t020.1 we need a custom boundary: task_id followed by non-digit or EOL.
# This prevents t020 from matching t020.1, t020.2, etc.
local boundary_pattern="${task_id}([^.0-9]|$)"

Choose a reason for hiding this comment

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

high

The boundary_pattern is constructed using the unescaped $task_id. If the task ID contains special regex characters (like a dot in t020.1), it will be misinterpreted by grep -E, leading to incorrect matches. The escaped_task_regex variable was correctly created for this purpose but is not used.

Using the escaped variable will fix the bug and also resolve a ShellCheck violation (SC2034), adhering to the repository's style guide.

Suggested change
local boundary_pattern="${task_id}([^.0-9]|$)"
local boundary_pattern="${escaped_task_regex}([^.0-9]|$)"
References
  1. The repository style guide (line 14) requires zero ShellCheck violations. The unused escaped_task_regex variable would trigger a ShellCheck warning (SC2034). Using it as suggested resolves this violation. (link)

| grep -iE "(feat|fix|refactor|chore|perf|test).*${task_id}|${task_id}.*(\(#[0-9]+\)|PR #[0-9]+|merged)" \
| grep -E "$boundary_pattern" \
| grep -iE "\(#[0-9]+\)|PR #[0-9]+ merged" \
| grep -ivE "add ${task_id}|claim ${task_id}|mark ${task_id}|queue ${task_id}|blocked" \

Choose a reason for hiding this comment

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

high

Similar to the issue with boundary_pattern, the unescaped $task_id is used in this grep pattern. If the task ID contains a dot, it will act as a wildcard, which could cause the filter to behave incorrectly. You should use the escaped_task_regex variable here for correct and safe matching.

Suggested change
| grep -ivE "add ${task_id}|claim ${task_id}|mark ${task_id}|queue ${task_id}|blocked" \
| grep -ivE "add ${escaped_task_regex}|claim ${escaped_task_regex}|mark ${escaped_task_regex}|queue ${escaped_task_regex}|blocked" \

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