Skip to content

t1263: Fix false-positive claim detection and add verified skip in auto-pickup#1979

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/t1263-stale-claim-detection
Feb 19, 2026
Merged

t1263: Fix false-positive claim detection and add verified skip in auto-pickup#1979
marcusquinn merged 1 commit intomainfrom
bugfix/t1263-stale-claim-detection

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 19, 2026

Summary

  • Fix naive grep -qE '(assignee:|started:)' matching description text instead of metadata fields
  • Add verified to silent-skip status list (was only complete and cancelled)
  • Applied to all 3 grep locations (Strategy 1, Strategy 2, subtask pickup)

Root Cause

Tasks like t1113 contain worker_never_started:no_sentinel in their description. The old regex matched started: in that text and skipped the task as "already claimed". Similarly, t1263's description mentions assignee: and started: when explaining the stale-claim problem.

This caused 4 genuinely dispatchable aidevops tasks to be permanently skipped by auto-pickup, stalling the queue for 2+ days.

Fix

Tightened regex patterns:

  • assignee: must be followed by word characters (a username): assignee:[a-zA-Z0-9_-]+
  • started: must be followed by an ISO timestamp: started:[0-9]{4}-[0-9]{2}-[0-9]{2}T

Also added verified to the silent-skip list so verified tasks don't log noisy "already tracked" messages.

Testing

  • ShellCheck: zero errors
  • Manual auto-pickup: 4 tasks (t1113, t1190, t1248, t1263) now correctly picked up
  • Tasks with real assignee:username and started:2026-... fields still correctly skipped

Broader Context

This is the immediate regex fix. The broader self-healing improvement (AI-driven stale-claim detection, TODO/DB reconciliation) remains as the t1263 TODO entry for autonomous dispatch.

Closes #1978

Summary by CodeRabbit

  • Bug Fixes
    • Improved auto-pickup task filtering with more precise metadata field detection to prevent false matches in automated task processing
    • Extended terminal task status handling to recognize "verified" as a terminal state alongside completed and cancelled tasks, preventing further automated pickup

Three fixes to cmd_auto_pickup claim detection:

1. Tighten assignee:/started: regex to match metadata fields only,
   not description text. assignee: requires word chars after colon,
   started: requires ISO timestamp pattern. Previously, tasks with
   'worker_never_started:no_sentinel' in descriptions were falsely
   skipped as 'already claimed'.

2. Add 'verified' to the silent-skip status list alongside 'complete'
   and 'cancelled'. Previously, verified tasks logged noisy 'already
   tracked' messages instead of being silently skipped.

3. Applied same fixes to all three grep locations (Strategy 1,
   Strategy 2, and subtask pickup).
@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 critical issues in the task auto-pickup system by refining how tasks are identified as claimed or in progress. It prevents tasks from being erroneously skipped due to keywords appearing in their descriptions and streamlines the process by silently ignoring tasks that have already been verified. The changes ensure that the auto-pickup mechanism accurately dispatches available tasks, improving overall system efficiency and preventing task queue stalls.

Highlights

  • False-positive claim detection fixed: The naive grep -qE '(assignee:|started:)' logic, which incorrectly matched description text instead of metadata fields, has been corrected. This resolves an issue where tasks were being skipped as 'already claimed' due to keywords in their descriptions.
  • Verified status added to silent-skip list: The verified status has been added to the list of task statuses (along with complete and cancelled) that are silently skipped by the auto-pickup mechanism, preventing noisy 'already tracked' messages for verified tasks.
  • Regex patterns tightened: The regex patterns for assignee: and started: have been made more specific. assignee: now requires a username (word characters), and started: requires an ISO timestamp, ensuring accurate metadata matching.
  • Changes applied consistently: These fixes have been applied to all three relevant grep locations within the auto-pickup logic: Strategy 1, Strategy 2, and subtask pickup.
Changelog
  • .agents/scripts/supervisor/cron.sh
    • Updated the regex pattern used to detect assignee: and started: fields, ensuring it only matches actual metadata and not descriptive text.
    • Expanded the list of task statuses that are silently skipped during auto-pickup to include verified, alongside complete and cancelled.
Activity
  • No human activity has occurred on this pull request yet.
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 19, 2026

Walkthrough

This change refines the supervisor cron script's auto-pickup filtering logic by implementing stricter metadata-field pattern matching (replacing loose substring detection with specific regex patterns) and expanding terminal-status checks to recognize "verified" as a non-pickup state across multiple pickup strategies.

Changes

Cohort / File(s) Summary
Supervisor cron script filtering refinement
.agents/scripts/supervisor/cron.sh
Tightened assignee and started metadata field detection using explicit regex patterns instead of substring matching; added "verified" to terminal-status exclusion list alongside "complete" and "cancelled" across four pickup strategies and subtask processing paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • #1770: Both PRs modify .agents/scripts/supervisor/cron.sh and refine auto-pickup eligibility detection through improved metadata field matching and status evaluation logic.

Poem

🎯 Patterns grow precise, substrings fade away,
"Verified" joins the terminal ballet,
Four pathways aligned with stricter care,
Stale claims begone—fresh tasks in the air! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly and concisely summarizes the main changes: fixing false-positive claim detection via stricter regex matching and adding verified status skip.
Linked Issues check ✅ Passed PR implements immediate regex fix addressing false-positive claim detection described in #1978, though broader stale-claim auto-recovery remains TODO.
Out of Scope Changes check ✅ Passed All changes in the PR are scoped to the auto-pickup filtering logic and are directly related to fixing the claim detection issue documented in #1978.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/t1263-stale-claim-detection

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, 30 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Thu Feb 19 22:28:00 UTC 2026: Code review monitoring started
Thu Feb 19 22:28:01 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 30

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 30
  • VULNERABILITIES: 0

Generated on: Thu Feb 19 22:28:03 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 effectively addresses a critical false-positive bug in task claim detection by tightening the grep regular expressions. The more specific patterns for assignee: and started: will prevent incorrect matches in task descriptions, as explained in the PR description. Adding verified to the list of skippable statuses is also a sensible improvement.

My review includes a few suggestions to further enhance the code by using bash's built-in features for better performance and readability. Specifically, I've recommended replacing echo | grep with the [[ ... =~ ... ]] construct for regex matching, and using case statements for multi-condition status checks.

# Skip tasks with assignee: or started: metadata fields (t1062, t1263)
# Match actual metadata fields, not description text containing these words.
# assignee: must be followed by a username (word chars), started: by ISO timestamp.
if echo "$line" | grep -qE '(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)'; then

Choose a reason for hiding this comment

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

medium

For performance and to reduce reliance on external processes, consider using bash's built-in regular expression matching instead of piping to grep. This avoids creating a subshell and invoking another process.

Suggested change
if echo "$line" | grep -qE '(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)'; then
if [[ "$line" =~ (assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T) ]]; then

Comment on lines +560 to 562
if [[ "$existing" == "complete" || "$existing" == "cancelled" || "$existing" == "verified" ]]; then
continue
fi

Choose a reason for hiding this comment

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

medium

To improve readability and make it easier to add more statuses in the future, consider using a case statement instead of a chain of || operators.

Suggested change
if [[ "$existing" == "complete" || "$existing" == "cancelled" || "$existing" == "verified" ]]; then
continue
fi
case "$existing" in
complete|cancelled|verified) continue ;;
esac

# Skip tasks with assignee: or started: metadata fields (t1062, t1263)
# Match actual metadata fields, not description text containing these words.
# assignee: must be followed by a username (word chars), started: by ISO timestamp.
if echo "$line" | grep -qE '(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)'; then

Choose a reason for hiding this comment

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

medium

For performance and to reduce reliance on external processes, consider using bash's built-in regular expression matching instead of piping to grep. This avoids creating a subshell and invoking another process.

Suggested change
if echo "$line" | grep -qE '(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)'; then
if [[ "$line" =~ (assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T) ]]; then

Comment on lines +636 to 638
if [[ "$existing" == "complete" || "$existing" == "cancelled" || "$existing" == "verified" ]]; then
continue
fi

Choose a reason for hiding this comment

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

medium

To improve readability and make it easier to add more statuses in the future, consider using a case statement instead of a chain of || operators.

Suggested change
if [[ "$existing" == "complete" || "$existing" == "cancelled" || "$existing" == "verified" ]]; then
continue
fi
case "$existing" in
complete|cancelled|verified) continue ;;
esac

# Skip tasks with assignee: or started: fields
if echo "$sub_line" | grep -qE '(assignee:|started:)'; then
# Skip tasks with assignee: or started: metadata fields (t1263)
if echo "$sub_line" | grep -qE '(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)'; then

Choose a reason for hiding this comment

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

medium

For performance and to reduce reliance on external processes, consider using bash's built-in regular expression matching instead of piping to grep. This avoids creating a subshell and invoking another process.

Suggested change
if echo "$sub_line" | grep -qE '(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)'; then
if [[ "$sub_line" =~ (assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T) ]]; then

@marcusquinn marcusquinn merged commit 0d9a747 into main Feb 19, 2026
18 of 19 checks passed
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.agents/scripts/supervisor/cron.sh (1)

688-692: ⚠️ Potential issue | 🟡 Minor

"verified" silent-skip not applied to Strategy 3 (plan tasks) or the Strategy 4 subtask block.

Strategies 1 and 2 now silently skip "verified" tasks, but the identical status guards in Strategy 3 (line 688) and the Strategy 4 subtask path (line 784) still only check complete/cancelled. A verified task encountered by either of those code paths will fall through to the noisy log_info "... already tracked (status: verified)" log line instead of silently continuing — the exact behavior the PR set out to suppress.

The AI summary also lists "Strategy 3 (PLANS.md plan tasks)" as one of the updated paths, which is inconsistent with the code: no ~-annotated lines appear in that block.

🐛 Proposed fix — apply to both gaps

Line 688 (Strategy 3):

-			if [[ "$existing" == "complete" || "$existing" == "cancelled" ]]; then
+			if [[ "$existing" == "complete" || "$existing" == "cancelled" || "$existing" == "verified" ]]; then

Line 784 (Strategy 4 subtask):

-				if [[ "$existing" == "complete" || "$existing" == "cancelled" ]]; then
+				if [[ "$existing" == "complete" || "$existing" == "cancelled" || "$existing" == "verified" ]]; then

Also applies to: 784-789

🤖 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 688 - 692, In the Strategy 3
block that checks existing task status (the if that currently tests "$existing"
== "complete" || "$existing" == "cancelled" near where task_id is used) and in
the Strategy 4 subtask path that logs "already tracked (status: ...)", add
"$existing" == "verified" to the guard so verified tasks are silently continued;
update the conditional(s) that control the continue (and remove the noisy
log_info call for verified) so both the plan-task (Strategy 3) branch and the
subtask branch behave like Strategies 1/2 and skip verified without logging.
🧹 Nitpick comments (1)
.agents/scripts/supervisor/cron.sh (1)

543-548: Core false-positive fix is correct; consider adding a field-boundary anchor for full hardening.

The described bug (worker_never_started:no_sentinel matching the old started: substring grep) is definitively fixed by requiring an ISO timestamp suffix. Good change.

However, a compound token like not_started:2026-01-01T12:00:00Z or pre_assignee:marcus would still match because neither pattern has a boundary check before the field name. Adding (^|[[:space:]]) before each field name guards against this entire class without relying on \b (which has uneven support across BSD/GNU grep on macOS vs. Linux).

🔧 Proposed hardening for all three regex call sites
-if echo "$line" | grep -qE '(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)'; then
+if echo "$line" | grep -qE '(^|[[:space:]])(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)'; then

Apply the same diff to lines 623 and 770.

Also applies to: 620-626, 769-773

🤖 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 543 - 548, The current grep
pattern used to detect task metadata (the if echo "$line" | grep -qE
'(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)') can
false-positive on tokens like "pre_assignee:" or "not_started:"; update the
regex to require a field boundary by prefixing each alternative with
'(^|[[:space:]])' so it only matches standalone fields (i.e., change to
something like '(^|[[:space:]])assignee:...|(^|[[:space:]])started:...'), and
apply the same hardened pattern to the other two grep sites in this script where
similar checks occur; keep the surrounding logic (log_info "  $task_id: already
claimed..." and continue) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.agents/scripts/supervisor/cron.sh:
- Around line 688-692: In the Strategy 3 block that checks existing task status
(the if that currently tests "$existing" == "complete" || "$existing" ==
"cancelled" near where task_id is used) and in the Strategy 4 subtask path that
logs "already tracked (status: ...)", add "$existing" == "verified" to the guard
so verified tasks are silently continued; update the conditional(s) that control
the continue (and remove the noisy log_info call for verified) so both the
plan-task (Strategy 3) branch and the subtask branch behave like Strategies 1/2
and skip verified without logging.

---

Nitpick comments:
In @.agents/scripts/supervisor/cron.sh:
- Around line 543-548: The current grep pattern used to detect task metadata
(the if echo "$line" | grep -qE
'(assignee:[a-zA-Z0-9_-]+|started:[0-9]{4}-[0-9]{2}-[0-9]{2}T)') can
false-positive on tokens like "pre_assignee:" or "not_started:"; update the
regex to require a field boundary by prefixing each alternative with
'(^|[[:space:]])' so it only matches standalone fields (i.e., change to
something like '(^|[[:space:]])assignee:...|(^|[[:space:]])started:...'), and
apply the same hardened pattern to the other two grep sites in this script where
similar checks occur; keep the surrounding logic (log_info "  $task_id: already
claimed..." and continue) unchanged.

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.

t1263: Add self-healing TODO/DB reconciliation to supervisor pulse

1 participant