Skip to content

fix(t021): prevent false positive task marking in auto-complete#216

Merged
marcusquinn merged 1 commit intomainfrom
fix/t021-false-positive-marking
Jan 25, 2026
Merged

fix(t021): prevent false positive task marking in auto-complete#216
marcusquinn merged 1 commit intomainfrom
fix/t021-false-positive-marking

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Jan 25, 2026

Summary

Fixes false positive task marking in the auto-complete feature from PR #208.

Problem

The original implementation extracted ALL task IDs from any commit containing completion keywords like "done". This caused false positives when tasks were merely mentioned in the same commit but not actually completed.

Example problematic commit:

chore: update TODO.md - mark t004, t048, t069 done, add t007 QuickFile Skill plan

This would incorrectly mark t007 as complete (it was being added to the plan, not completed).

Solution

Refined task ID extraction to only match explicit completion patterns:

  1. Conventional commits with task scope: feat(t001):, fix(t002):
  2. Mark...done pattern: mark t001, t002 done (extracts only tasks between "mark" and "done")
  3. Complete/closes keyword: complete t003, closes t004
  4. Task before completion word: t005 done, t006 finished

Testing

# Before fix: extracted t007 (false positive)
# After fix: only extracts t004, t021, t037, t048, t069 (all legitimate)
.agent/scripts/version-manager.sh list-task-ids

Follow-up to #208

Summary by CodeRabbit

  • Chores
    • Improved task ID extraction from commit messages to recognize conventional commits format and completion-oriented patterns, enabling more reliable automated version management and release tracking across varied commit message formats.

✏️ Tip: You can customize this high-level summary in your review settings.

Refine task ID extraction to only match explicit completion patterns:
- Conventional commits with task scope: feat(t001):, fix(t002):
- Mark...done pattern: 'mark t001, t002 done'
- Complete/closes keyword: 'complete t003', 'closes t004'
- Task before completion word: 't005 done'

Previously extracted ALL task IDs from any commit containing 'done',
causing false positives when tasks were merely mentioned.
@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 addresses a critical bug in the auto-complete feature where tasks were incorrectly marked as complete due to overly broad commit message parsing. The changes introduce a more precise method for extracting task IDs, ensuring that only explicitly completed tasks are identified, thereby improving the accuracy and reliability of task status tracking.

Highlights

  • Refined Task ID Extraction Logic: The mechanism for identifying completed tasks from commit messages has been significantly updated to prevent false positives in the auto-complete feature.
  • Specific Completion Patterns Implemented: Task IDs are now extracted only when they match explicit completion indicators, including conventional commit scopes (e.g., feat(t001):), 'mark ... done' phrases, 'complete/closes tXXX', or 'tXXX done/finished' patterns.
  • Improved Accuracy of Task Status: This change ensures that tasks are marked as complete only when explicitly intended by the commit message, leading to more accurate and reliable task status tracking.
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 Jan 25, 2026

Walkthrough

The extract_task_ids_from_commits function in the version manager script is enhanced to recognize four distinct patterns for parsing task IDs from commit messages: conventional commits with task scope, "mark done/complete" directives, "complete/closes task" patterns, and ID-before-completion-word formats. Results are aggregated, deduplicated, and validated against the tXXX format.

Changes

Cohort / File(s) Summary
Task ID Extraction Enhancement
\.agent/scripts/version-manager.sh
Replaced simple grep-based extraction with multi-pattern loop-based logic supporting conventional commits, completion markers, and varied message formats. Implements deduplication and format validation (tXXX with optional digit suffixes). Lines: +46/-4

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🤖 Four patterns dance where once was one,
Task IDs parse beneath the DevOps sun,
From "mark done" to scope so clean,
The finest extraction ever seen,
Zero debt, A-grade automation won! ⭐

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main fix: preventing false positive task marking in auto-complete by narrowing extraction logic to explicit completion patterns.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@sonarqubecloud
Copy link

@github-actions
Copy link

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Sun Jan 25 17:26:12 UTC 2026: Code review monitoring started
Sun Jan 25 17:26:12 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 447
Sun Jan 25 17:26:12 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Sun Jan 25 17:26:14 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 447
  • VULNERABILITIES: 0

Generated on: Sun Jan 25 17:27:39 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@marcusquinn marcusquinn merged commit a0b08f3 into main Jan 25, 2026
8 of 9 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 effectively addresses the issue of false positive task marking by replacing a broad regex with a more nuanced, pattern-based approach to extracting task IDs from commit messages. The new implementation iterates through commits and applies specific rules for conventional commits, "mark...done" phrases, and other completion keywords. This is a great improvement in correctness. I've added a suggestion to refactor the loop for better efficiency and readability by using more of bash's built-in features and optimizing command chains.

Comment on lines +551 to +586
while IFS= read -r commit; do
[[ -z "$commit" ]] && continue

# Pattern 1: Conventional commits with task ID in scope
# e.g., feat(t001):, fix(t002):, docs(t003.1):, refactor(t004):
if [[ "$commit" =~ ^(feat|fix|docs|refactor|perf|test|chore|style|build|ci)\(t[0-9]{3}(\.[0-9]+)*\): ]]; then
local id
id=$(echo "$commit" | grep -oE '\(t[0-9]{3}(\.[0-9]+)*\)' | tr -d '()')
task_ids="$task_ids $id"
fi

# Pattern 2: "mark tXXX done/complete" - extract task IDs between "mark" and "done/complete"
# e.g., "mark t004, t048, t069 done" -> t004, t048, t069
if [[ "$commit" =~ mark[[:space:]]+(.*)[[:space:]]+(done|complete) ]]; then
local segment="${BASH_REMATCH[1]}"
local ids
ids=$(echo "$segment" | grep -oE '\bt[0-9]{3}(\.[0-9]+)*\b')
task_ids="$task_ids $ids"
fi

# Pattern 3: "complete/completes/closes tXXX" - task ID immediately after keyword
# e.g., "complete t037", "closes t001"
local ids
ids=$(echo "$commit" | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
if [[ -n "$ids" ]]; then
task_ids="$task_ids $ids"
fi

# Pattern 4: "tXXX complete/done/finished" - task ID before completion word
# e.g., "t001 complete", "t002 done"
ids=$(echo "$commit" | grep -oE 't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
if [[ -n "$ids" ]]; then
task_ids="$task_ids $ids"
fi

done <<< "$commits"

Choose a reason for hiding this comment

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

medium

This while loop is a great improvement for correctness. It can be further optimized for efficiency and readability.

  1. Efficiency: The loop currently spawns multiple processes (echo, grep, tr) for each commit, which can be slow if there are many commits. You can make this more efficient by using bash's built-in regex matching (BASH_REMATCH) for pattern 1, and combining grep pipes with sed for patterns 3 and 4.
  2. Readability: The local declarations for id and ids are scattered and re-declared, which can be confusing. It's better practice to declare all loop-specific variables once at the top of the loop.

Here's a suggested refactoring of the loop that addresses these points:

    while IFS= read -r commit; do
        local id segment ids
        [[ -z "$commit" ]] && continue
        
        # Pattern 1: Conventional commits with task ID in scope (more efficient)
        if [[ "$commit" =~ ^(feat|fix|docs|refactor|perf|test|chore|style|build|ci)\((t[0-9]{3}(\.[0-9]+)*)\): ]]; then
            id="${BASH_REMATCH[2]}"
            task_ids="$task_ids $id"
        fi
        
        # Pattern 2: "mark tXXX done/complete" - extract task IDs between "mark" and "done/complete"
        # e.g., "mark t004, t048, t069 done" -> t004, t048, t069
        if [[ "$commit" =~ mark[[:space:]]+(.*)[[:space:]]+(done|complete) ]]; then
            segment="${BASH_REMATCH[1]}"
            ids=$(echo "$segment" | grep -oE '\bt[0-9]{3}(\.[0-9]+)*\b')
            task_ids="$task_ids $ids"
        fi
        
        # Pattern 3: "complete/completes/closes tXXX" - task ID immediately after keyword (more efficient)
        # e.g., "complete t037", "closes t001"
        ids=$(echo "$commit" | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' | sed -E 's/.*[[:space:]]+//')
        if [[ -n "$ids" ]]; then
            task_ids="$task_ids $ids"
        fi
        
        # Pattern 4: "tXXX complete/done/finished" - task ID before completion word (more efficient)
        # e.g., "t001 complete", "t002 done"
        ids=$(echo "$commit" | grep -oE 't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' | sed -E 's/[[:space:]]+(complete|done|finished)$//')
        if [[ -n "$ids" ]]; then
            task_ids="$task_ids $ids"
        fi
        
    done <<< "$commits"

@augmentcode
Copy link

augmentcode bot commented Jan 25, 2026

🤖 Augment PR Summary

Summary: Refines task auto-completion so tasks are only marked complete when the commit subject explicitly indicates completion.

Changes:

  • Replaced broad task-ID extraction with a per-commit parser that applies explicit “completion” patterns
  • Added support for conventional-commit task scopes (e.g., fix(t021):) and explicit phrases (e.g., mark t001 done)
  • Handles several completion keyword shapes (keyword-before-ID and ID-before-keyword)

Technical Notes: Output remains a de-duplicated, sorted list of task IDs for consumption by auto_mark_tasks_complete.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

fi

# Pattern 3: "complete/completes/closes tXXX" - task ID immediately after keyword
# e.g., "complete t037", "closes t001"
Copy link

Choose a reason for hiding this comment

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

The regex mark[[:space:]]+(.*)[[:space:]]+(done|complete) can match inside other words (e.g. remark) and the greedy (.*) can extend to the last done/complete, potentially pulling in task IDs from unrelated trailing text. That could reintroduce false-positive task completions in some commit subjects that contain multiple done/complete words.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

# Pattern 4: "tXXX complete/done/finished" - task ID before completion word
# e.g., "t001 complete", "t002 done"
ids=$(echo "$commit" | grep -oE 't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
if [[ -n "$ids" ]]; then
Copy link

Choose a reason for hiding this comment

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

Pattern 3 doesn’t require a word boundary around (completes?|closes?), so subjects like incomplete t021 or encloses t021 could still match and incorrectly mark a task as completed. Consider requiring a clear token boundary/separator around the completion keyword to avoid substring matches.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

# e.g., "complete t037", "closes t001"
local ids
ids=$(echo "$commit" | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
if [[ -n "$ids" ]]; then
Copy link

Choose a reason for hiding this comment

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

grep -oE '\bt[0-9]{3}(\.[0-9]+)*\b' relies on \b acting like a word boundary, but in many grep -E implementations it’s treated as a backspace escape, which can make extraction inconsistent across environments. If this script runs on BSD/macOS grep, task ID detection here may silently fail or behave unexpectedly.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.agent/scripts/version-manager.sh:
- Around line 588-589: The current pipeline that deduplicates task IDs (echo
"$task_ids" | tr ' ' '\n' | grep -E '^t[0-9]{3}' | sort -u) allows partial
matches like t0012 or t001foo; update the grep pattern to strictly match the
task-id format used by the script by anchoring the end and allowing optional
sub-tasks, e.g. replace the grep -E pattern with one that enforces start and end
anchors and optional dot-separated numeric subparts (use
'^t[0-9]{3}(\\.[0-9]+)*$') so only valid IDs from the task_ids variable pass to
sort -u.
- Around line 562-584: Pattern 3 and Pattern 4 regexes can match substrings
inside larger words; update the grep -oE invocations that populate the local
variable ids so they require word boundaries: for the completes?/closes? pattern
used to set ids (the line assigning ids from echo "$commit" | grep -oE
'(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' ...) add a left-side word
boundary (e.g., '\b(completes?|closes?)[[:space:]]+t...') and for the tXXX
before completion pattern (the line assigning ids from echo "$commit" | grep -oE
't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' ...) add a right-side
word boundary on the completion words (e.g.,
'...([[:space:]]+(complete|done|finished)\b)') so that the populated ids and
appended task_ids only match whole words.

Comment on lines +562 to +584
# Pattern 2: "mark tXXX done/complete" - extract task IDs between "mark" and "done/complete"
# e.g., "mark t004, t048, t069 done" -> t004, t048, t069
if [[ "$commit" =~ mark[[:space:]]+(.*)[[:space:]]+(done|complete) ]]; then
local segment="${BASH_REMATCH[1]}"
local ids
ids=$(echo "$segment" | grep -oE '\bt[0-9]{3}(\.[0-9]+)*\b')
task_ids="$task_ids $ids"
fi

# Pattern 3: "complete/completes/closes tXXX" - task ID immediately after keyword
# e.g., "complete t037", "closes t001"
local ids
ids=$(echo "$commit" | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
if [[ -n "$ids" ]]; then
task_ids="$task_ids $ids"
fi

# Pattern 4: "tXXX complete/done/finished" - task ID before completion word
# e.g., "t001 complete", "t002 done"
ids=$(echo "$commit" | grep -oE 't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
if [[ -n "$ids" ]]; then
task_ids="$task_ids $ids"
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the file and the specific function
cat -n .agent/scripts/version-manager.sh | head -100

Repository: marcusquinn/aidevops

Length of output: 3633


🏁 Script executed:

# Look at the extract_task_ids_from_commits function around lines 532-590
sed -n '530,595p' .agent/scripts/version-manager.sh

Repository: marcusquinn/aidevops

Length of output: 2854


🏁 Script executed:

# Test grep \b behavior in ERE mode to verify the claim
echo "Test 1: Does \\b work as word boundary in grep -E?"
printf 't001 test\n' | grep -oE '\bt[0-9]{3}\b' && echo "Match found" || echo "No match"

echo -e "\nTest 2: Does \\b work without explicit escape?"
printf 't001 test\n' | grep -oE '\\bt[0-9]{3}\\b' && echo "Match found" || echo "No match"

echo -e "\nTest 3: Test false positive - does 'remark' match?"
printf 'remark t001\n' | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' && echo "False positive: matched 'remark'" || echo "Correctly rejected"

echo -e "\nTest 4: Test false positive - does 'incomplete' match?"
printf 'incomplete t021\n' | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' && echo "False positive: matched 'incomplete'" || echo "Correctly rejected"

echo -e "\nTest 5: Test mark pattern with \\b"
printf 'mark t004 done\n' | grep -oE '\bt[0-9]{3}(\.[0-9]+)*\b' && echo "Mark pattern match found" || echo "Mark pattern: No match"

Repository: marcusquinn/aidevops

Length of output: 427


🏁 Script executed:

# Test if the patterns within complete/closes word actually match
echo -e "\nTest 6: Does 'completest004' match (boundary issue)?"
printf 'completest004 something\n' | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' && echo "Matched inside word" || echo "Correctly rejected with space requirement"

echo -e "\nTest 7: What about 'complete t004' (should match)"
printf 'complete t004\n' | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' && echo "Matched correctly" || echo "No match"

Repository: marcusquinn/aidevops

Length of output: 242


🏁 Script executed:

# Let's also check what the actual final filter looks like by searching for it
grep -n "final filter\|^t\[0-9\]\{3\}" .agent/scripts/version-manager.sh | head -20

Repository: marcusquinn/aidevops

Length of output: 46


🏁 Script executed:

# Look at the complete extract_task_ids_from_commits function
sed -n '532,610p' .agent/scripts/version-manager.sh

Repository: marcusquinn/aidevops

Length of output: 3288


🏁 Script executed:

# Test Pattern 4 boundary issue
echo "Test Pattern 4 boundary: does 't001 completely' match?"
printf 't001 completely\n' | grep -oE 't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' && echo "Matched (false positive)" || echo "Correctly rejected"

echo -e "\nTest additional: 'refactor t005 incomplete' - should NOT match"
printf 'refactor t005 incomplete\n' | grep -oE 't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' && echo "Matched (false positive)" || echo "Correctly rejected"

echo -e "\nTest word boundary with alternation: Does '(completes?|closes?) \b' format help?"
printf 'incomplete t021\n' | grep -oE '(^|[^[:alnum:]_])(completes?|closes?)[[:space:]]+t[0-9]{3}' && echo "With boundary: Matched" || echo "With boundary: Correctly rejected"

Repository: marcusquinn/aidevops

Length of output: 355


🏁 Script executed:

# Verify final output format to ensure deduplication works correctly
echo -e "\nTest final filter output quality:"
printf 't001\nt001\nt002\nincomplet\nfragment\nt003' | grep -E '^t[0-9]{3}' | sort -u

Repository: marcusquinn/aidevops

Length of output: 113


Review contains incorrect technical analysis—\b word boundaries work correctly, but real boundary issues exist in Patterns 3 and 4.

The \b assertion is incorrect: testing confirms \b in grep -E functions properly as a word boundary. Pattern 2 (mark…done) works as designed.

However, two genuine reliability issues remain:

  1. Pattern 3 ((completes?|closes?)[[:space:]]+t[0-9]{3}…): Lacks left word boundary. "incomplete t021" incorrectly matches "complete" within the word.
  2. Pattern 4 (t[0-9]{3}…[[:space:]]+(complete|done|finished)): Lacks right word boundary. "t001 completely" incorrectly matches "complete" within the word.

For automation script reliability (per coding guidelines), add word boundaries:

🔧 Suggested fix (correct boundaries)
         # Pattern 3: "complete/completes/closes tXXX" - task ID immediately after keyword
         # e.g., "complete t037", "closes t001"
         local ids
-        ids=$(echo "$commit" | grep -oE '(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
+        ids=$(echo "$commit" | grep -oE '(^|[^[:alnum:]_])(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
         if [[ -n "$ids" ]]; then
             task_ids="$task_ids $ids"
         fi
         
         # Pattern 4: "tXXX complete/done/finished" - task ID before completion word
         # e.g., "t001 complete", "t002 done"
         ids=$(echo "$commit" | grep -oE 't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
+        ids=$(echo "$commit" | grep -oE 't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)($|[^[:alnum:]_])' | grep -oE 't[0-9]{3}(\.[0-9]+)*')
🤖 Prompt for AI Agents
In @.agent/scripts/version-manager.sh around lines 562 - 584, Pattern 3 and
Pattern 4 regexes can match substrings inside larger words; update the grep -oE
invocations that populate the local variable ids so they require word
boundaries: for the completes?/closes? pattern used to set ids (the line
assigning ids from echo "$commit" | grep -oE
'(completes?|closes?)[[:space:]]+t[0-9]{3}(\.[0-9]+)*' ...) add a left-side word
boundary (e.g., '\b(completes?|closes?)[[:space:]]+t...') and for the tXXX
before completion pattern (the line assigning ids from echo "$commit" | grep -oE
't[0-9]{3}(\.[0-9]+)*[[:space:]]+(complete|done|finished)' ...) add a right-side
word boundary on the completion words (e.g.,
'...([[:space:]]+(complete|done|finished)\b)') so that the populated ids and
appended task_ids only match whole words.

Comment on lines +588 to +589
# Deduplicate and sort
echo "$task_ids" | tr ' ' '\n' | grep -E '^t[0-9]{3}' | sort -u
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Test 1: Verify regex behavior with the original pattern
echo "=== Testing original pattern: ^t[0-9]{3} ==="
printf '%s\n' "t001" "t0012" "t001foo" "t001.1" | grep -E '^t[0-9]{3}' && echo "---" && echo "Pattern matched above"

echo ""
echo "=== Testing suggested pattern: ^t[0-9]{3}(\.[0-9]+)*$ ==="
printf '%s\n' "t001" "t0012" "t001foo" "t001.1" | grep -E '^t[0-9]{3}(\.[0-9]+)*$' && echo "---" && echo "Pattern matched above"

Repository: marcusquinn/aidevops

Length of output: 257


🏁 Script executed:

# Examine the actual file at lines 588-589
sed -n '580,600p' .agent/scripts/version-manager.sh | cat -n

Repository: marcusquinn/aidevops

Length of output: 944


🏁 Script executed:

# Search for task ID patterns and usage in the script
rg 't[0-9]{3}' .agent/scripts/version-manager.sh -A 2 -B 2 | head -50

Repository: marcusquinn/aidevops

Length of output: 1935


🏁 Script executed:

# Check what task IDs actually look like in the codebase
rg '\bt[0-9]{3}' --type sh -A 1 -B 1 | head -40

Repository: marcusquinn/aidevops

Length of output: 3106


Anchor the final task-id filter to prevent partial-ID matches.

The pattern ^t[0-9]{3} accepts unwanted matches: t0012 (4 digits instead of 3) and t001foo (text after ID). Since task IDs follow the strict format t[0-9]{3}(\.[0-9]+)*, add end-of-line anchor and optional sub-task support to enforce correctness at the deduplication stage.

Suggested fix
-    echo "$task_ids" | tr ' ' '\n' | grep -E '^t[0-9]{3}' | sort -u
+    echo "$task_ids" | tr ' ' '\n' | grep -E '^t[0-9]{3}(\.[0-9]+)*$' | sort -u
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Deduplicate and sort
echo "$task_ids" | tr ' ' '\n' | grep -E '^t[0-9]{3}' | sort -u
# Deduplicate and sort
echo "$task_ids" | tr ' ' '\n' | grep -E '^t[0-9]{3}(\.[0-9]+)*$' | sort -u
🤖 Prompt for AI Agents
In @.agent/scripts/version-manager.sh around lines 588 - 589, The current
pipeline that deduplicates task IDs (echo "$task_ids" | tr ' ' '\n' | grep -E
'^t[0-9]{3}' | sort -u) allows partial matches like t0012 or t001foo; update the
grep pattern to strictly match the task-id format used by the script by
anchoring the end and allowing optional sub-tasks, e.g. replace the grep -E
pattern with one that enforces start and end anchors and optional dot-separated
numeric subparts (use '^t[0-9]{3}(\\.[0-9]+)*$') so only valid IDs from the
task_ids variable pass to sort -u.

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