Skip to content

fix: blocked-by parser matches backtick-quoted code in task descriptions#2232

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/blocked-by-backtick-parse
Feb 24, 2026
Merged

fix: blocked-by parser matches backtick-quoted code in task descriptions#2232
marcusquinn merged 1 commit intomainfrom
bugfix/blocked-by-backtick-parse

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 24, 2026

Summary

  • blocked-by:[^ ]+ regex matches backticks from inline code in descriptions
  • Tasks t1311 and t1314 were falsely blocked by dependency `
  • Fix: require value to start with task ID pattern blocked-by:t[0-9]
  • Applied to all 5 affected files (cron.sh, ai-actions.sh, todo-sync.sh, sanity-check.sh, ai-context.sh)

Impact

  • t1311 and t1314 are now correctly picked up by auto-pickup
  • Already deployed and verified working

Summary by CodeRabbit

  • Bug Fixes
    • Refined task blocker dependency recognition to only match properly formatted task ID references. Task blockers will now be correctly identified when they follow the standard task ID format, preventing misidentification of non-standard blocker references.

The regex 'blocked-by:[^ ]+' matches any non-space chars after 'blocked-by:',
including backticks from inline code like `blocked-by:` in descriptions.
This caused t1311 and t1314 to be falsely blocked by dependency '`'.

Fix: require value to start with task ID pattern (t followed by digits).
Applied to all 5 files with the vulnerable pattern:
- cron.sh is_task_blocked()
- ai-actions.sh
- todo-sync.sh auto_unblock_resolved_tasks()
- sanity-check.sh
- ai-context.sh

issue-audit.sh already used stricter [A-Za-z0-9.,]+ — unaffected.
@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 an issue where the blocked-by task dependency parser was incorrectly identifying tasks as blocked due to matching backtick-quoted code snippets in task descriptions. By refining the regular expression to specifically look for task ID patterns (e.g., t[0-9]), the change ensures accurate dependency resolution, preventing tasks from being falsely blocked and improving the reliability of automated task management.

Highlights

  • Regex fix for blocked-by parser: Modified the blocked-by regex to specifically match task IDs (e.g., t123) to prevent false positives from backtick-quoted text in task descriptions.
  • Resolved false blocking: Tasks t1311 and t1314 were previously incorrectly identified as blocked due to the old regex matching backticks. This fix resolves that issue, allowing them to be correctly picked up by auto-pickup.
  • Broad application: The updated regex has been applied consistently across five supervisor scripts: cron.sh, ai-actions.sh, todo-sync.sh, sanity-check.sh, and ai-context.sh.
Changelog
  • .agents/scripts/supervisor/ai-actions.sh
    • Updated the blocked-by regex to blocked-by:t[0-9][^ ]*.
  • .agents/scripts/supervisor/ai-context.sh
    • Updated the blocked-by regex to blocked-by:t[0-9][^ ]*.
  • .agents/scripts/supervisor/cron.sh
    • Updated the blocked-by regex to blocked-by:t[0-9][^ ]* and added a clarifying comment.
  • .agents/scripts/supervisor/sanity-check.sh
    • Updated the blocked-by regex to blocked-by:t[0-9][^ ]*.
  • .agents/scripts/supervisor/todo-sync.sh
    • Updated the blocked-by regex to blocked-by:t[0-9][^ ]*.
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 24, 2026

Walkthrough

Five shell scripts in the supervisor automation suite were updated to standardize blocker field extraction patterns. The regex patterns for blocked-by and blocking-by fields were tightened across all scripts to exclusively match task ID format (t[0-9][^ ]*), replacing more permissive patterns that previously accepted any non-whitespace characters.

Changes

Cohort / File(s) Summary
Blocker Extraction Pattern Standardization
.agents/scripts/supervisor/ai-actions.sh, ai-context.sh, cron.sh, sanity-check.sh, todo-sync.sh
Updated regex patterns for blocker field extraction from permissive [^ ]* or [^ ]+ to strict t[0-9][^ ]* format, ensuring only task ID-formatted blockers are recognized. Consistent pattern applied across all supervisor scripts for unified blocker identification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

needs-review

Poem

🔍 Five scripts, one pattern refined,
Blockers now by task-IDs aligned,
From loose to tight, the regex flows,
t-numbered chains in every row,
Where automation's precision glows ✨

🚥 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 accurately describes the main change: fixing the blocked-by parser regex to exclude backtick-quoted code patterns, preventing false task dependencies.
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 (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/blocked-by-backtick-parse

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

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Feb 24 20:45:14 UTC 2026: Code review monitoring started
Tue Feb 24 20:45:14 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 58

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 58
  • VULNERABILITIES: 0

Generated on: Tue Feb 24 20:45:17 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

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 correctly addresses a bug where the blocked-by parser was too broad and could incorrectly match backticks in task descriptions. The fix, which makes the regex more specific by requiring the value to start with a task ID pattern (t[0-9]), has been consistently applied across all five affected files.

My review includes suggestions to further improve the robustness of this regex by restricting allowed characters to only those valid in a task ID list (digits, dots, and commas). Additionally, in some instances, I've suggested using tail -1 instead of head -1 for more robust metadata extraction, aligning with repository guidelines. Overall, this is a good fix that improves the reliability of task dependency parsing.

started=$(printf '%s' "$task_line" | grep -oE 'started:[^ ]+' || echo "")
local blocked
blocked=$(printf '%s' "$task_line" | grep -oE 'blocked-by:[^ ]+' || echo "")
blocked=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9][^ ]*' || echo "")

Choose a reason for hiding this comment

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

medium

While the new regex t[0-9][^ ]* correctly fixes the issue with backticks, it's still a bit permissive as [^ ]* can match any non-space characters. To make the pattern more robust and specific to the task ID format (which consists of t, digits, dots, and commas for lists), I suggest using t[0-9.,]+. This will prevent matching invalid characters that might appear adjacent to the blocked-by: field.

Suggested change
blocked=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9][^ ]*' || echo "")
blocked=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9.,]+' || echo "")

continue
fi
blocker=$(echo "$line" | grep -oE 'blocked-by:[^ ]+' | head -1)
blocker=$(echo "$line" | grep -oE 'blocked-by:t[0-9][^ ]*' | head -1)

Choose a reason for hiding this comment

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

medium

While the new regex t[0-9][^ ]* correctly fixes the issue with backticks, it's still a bit permissive as [^ ]* can match any non-space characters. To make the pattern more robust and specific to the task ID format (which consists of t, digits, dots, and commas for lists), I suggest using t[0-9.,]+. This will prevent matching invalid characters that might appear adjacent to the blocked-by: field. Additionally, for robustness when extracting metadata fields, tail -1 should be used instead of head -1.

Suggested change
blocker=$(echo "$line" | grep -oE 'blocked-by:t[0-9][^ ]*' | head -1)
blocker=$(echo "$line" | grep -oE 'blocked-by:t[0-9.,]+' | tail -1)
References
  1. When extracting metadata fields from a line using 'grep' and 'sed' in shell scripts, use 'tail -1' instead of 'head -1' to ensure robustness, especially when the field might appear multiple times or be at the end of the line.

# to avoid matching backtick-quoted mentions like `blocked-by:` in descriptions
local blocked_by
blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:[^ ]+' | sed 's/blocked-by://' || true)
blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9][^ ]*' | sed 's/blocked-by://' || true)

Choose a reason for hiding this comment

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

medium

While the new regex t[0-9][^ ]* correctly fixes the issue with backticks, it's still a bit permissive as [^ ]* can match any non-space characters. To make the pattern more robust and specific to the task ID format (which consists of t, digits, dots, and commas for lists), I suggest using t[0-9.,]+. This will prevent matching invalid characters that might appear adjacent to the blocked-by: field.

Suggested change
blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9][^ ]*' | sed 's/blocked-by://' || true)
blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9.,]+' | sed 's/blocked-by://' || true)

current_line=$(sed -n "${line_num}p" "$todo_file")
local blocked_by
blocked_by=$(printf '%s' "$current_line" | grep -oE 'blocked-by:[^ ]+' | head -1 | sed 's/blocked-by://' || echo "")
blocked_by=$(printf '%s' "$current_line" | grep -oE 'blocked-by:t[0-9][^ ]*' | head -1 | sed 's/blocked-by://' || echo "")

Choose a reason for hiding this comment

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

medium

While the new regex t[0-9][^ ]* correctly fixes the issue with backticks, it's still a bit permissive as [^ ]* can match any non-space characters. To make the pattern more robust and specific to the task ID format (which consists of t, digits, dots, and commas for lists), I suggest using t[0-9.,]+. This will prevent matching invalid characters that might appear adjacent to the blocked-by: field. Additionally, for robustness when extracting metadata fields, tail -1 should be used instead of head -1.

Suggested change
blocked_by=$(printf '%s' "$current_line" | grep -oE 'blocked-by:t[0-9][^ ]*' | head -1 | sed 's/blocked-by://' || echo "")
blocked_by=$(printf '%s' "$current_line" | grep -oE 'blocked-by:t[0-9.,]+' | tail -1 | sed 's/blocked-by://' || echo "")
References
  1. When extracting metadata fields from a line using 'grep' and 'sed' in shell scripts, use 'tail -1' instead of 'head -1' to ensure robustness, especially when the field might appear multiple times or be at the end of the line.

# Extract blocked-by dependencies
local blocked_by=""
blocked_by=$(printf '%s' "$line" | grep -oE 'blocked-by:[^ ]+' | head -1 | sed 's/blocked-by://' || echo "")
blocked_by=$(printf '%s' "$line" | grep -oE 'blocked-by:t[0-9][^ ]*' | head -1 | sed 's/blocked-by://' || echo "")

Choose a reason for hiding this comment

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

medium

While the new regex t[0-9][^ ]* correctly fixes the issue with backticks, it's still a bit permissive as [^ ]* can match any non-space characters. To make the pattern more robust and specific to the task ID format (which consists of t, digits, dots, and commas for lists), I suggest using t[0-9.,]+. This will prevent matching invalid characters that might appear adjacent to the blocked-by: field. Additionally, for robustness when extracting metadata fields, tail -1 should be used instead of head -1.

Suggested change
blocked_by=$(printf '%s' "$line" | grep -oE 'blocked-by:t[0-9][^ ]*' | head -1 | sed 's/blocked-by://' || echo "")
blocked_by=$(printf '%s' "$line" | grep -oE 'blocked-by:t[0-9.,]+' | tail -1 | sed 's/blocked-by://' || echo "")
References
  1. When extracting metadata fields from a line using 'grep' and 'sed' in shell scripts, use 'tail -1' instead of 'head -1' to ensure robustness, especially when the field might appear multiple times or be at the end of the line.

@marcusquinn marcusquinn merged commit 5859f3c into main Feb 24, 2026
15 of 16 checks passed
@marcusquinn marcusquinn deleted the bugfix/blocked-by-backtick-parse branch February 24, 2026 20:47
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/scripts/supervisor/cron.sh:
- Around line 392-395: The current extraction for blocked_by can match
backtick-quoted inline code and trailing punctuation; update the grep/sed
pattern used to populate blocked_by (the variable derived from task_line) to
require a start-or-whitespace boundary before "blocked-by:" (e.g.
(^|[[:space:]])blocked-by:) and to only capture one or more comma-separated task
IDs that strictly match t[0-9]+ with a clear end boundary (comma, whitespace or
end-of-string) so punctuation/backticks are excluded; apply the identical
tightened regex logic to the other scripts you modified to keep parsing
consistent.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 995e5c9 and 5b80bcc.

📒 Files selected for processing (5)
  • .agents/scripts/supervisor/ai-actions.sh
  • .agents/scripts/supervisor/ai-context.sh
  • .agents/scripts/supervisor/cron.sh
  • .agents/scripts/supervisor/sanity-check.sh
  • .agents/scripts/supervisor/todo-sync.sh

Comment on lines +392 to +395
# Extract blocked-by: field — require value to start with a task ID (tNNN)
# to avoid matching backtick-quoted mentions like `blocked-by:` in descriptions
local blocked_by
blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:[^ ]+' | sed 's/blocked-by://' || true)
blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9][^ ]*' | sed 's/blocked-by://' || true)
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

Harden blocked‑by parsing to ignore backtick‑quoted inline code

Line 395 can still match blocked-by:t123 inside inline code because the pattern doesn’t require a whitespace/start boundary and allows trailing punctuation. That can reintroduce false blockers. Consider anchoring on whitespace/start and limiting to comma‑separated task IDs; apply the same pattern across the other updated scripts for consistency.

🔧 Suggested regex tightening
- blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9][^ ]*' | sed 's/blocked-by://' || true)
+ blocked_by=$(printf '%s' "$task_line" |
+   grep -oE '(^|[[:space:]])blocked-by:t[0-9]+(\.[0-9]+)*(,[[:space:]]*t[0-9]+(\.[0-9]+)*)*' |
+   sed -E 's/^[[:space:]]*blocked-by://' || true)
📝 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
# Extract blocked-by: field — require value to start with a task ID (tNNN)
# to avoid matching backtick-quoted mentions like `blocked-by:` in descriptions
local blocked_by
blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:[^ ]+' | sed 's/blocked-by://' || true)
blocked_by=$(printf '%s' "$task_line" | grep -oE 'blocked-by:t[0-9][^ ]*' | sed 's/blocked-by://' || true)
# Extract blocked-by: field — require value to start with a task ID (tNNN)
# to avoid matching backtick-quoted mentions like `blocked-by:` in descriptions
local blocked_by
blocked_by=$(printf '%s' "$task_line" |
grep -oE '(^|[[:space:]])blocked-by:t[0-9]+(\.[0-9]+)*(,[[:space:]]*t[0-9]+(\.[0-9]+)*)*' |
sed -E 's/^[[:space:]]*blocked-by://' || true)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/supervisor/cron.sh around lines 392 - 395, The current
extraction for blocked_by can match backtick-quoted inline code and trailing
punctuation; update the grep/sed pattern used to populate blocked_by (the
variable derived from task_line) to require a start-or-whitespace boundary
before "blocked-by:" (e.g. (^|[[:space:]])blocked-by:) and to only capture one
or more comma-separated task IDs that strictly match t[0-9]+ with a clear end
boundary (comma, whitespace or end-of-string) so punctuation/backticks are
excluded; apply the identical tightened regex logic to the other scripts you
modified to keep parsing consistent.

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