Skip to content

t1188: Add multi-repo TODO scanning and auto-dispatch eligibility to AI context#1801

Merged
marcusquinn merged 1 commit intomainfrom
feature/t1188-multi-repo-context
Feb 18, 2026
Merged

t1188: Add multi-repo TODO scanning and auto-dispatch eligibility to AI context#1801
marcusquinn merged 1 commit intomainfrom
feature/t1188-multi-repo-context

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 18, 2026

Summary

Enables the AI supervisor to see and assess tasks across all registered repos, not just the primary aidevops repo.

  • Multi-repo TODO scanning: build_ai_context() now iterates all distinct repos from the supervisor DB and includes each repo's TODO.md state. Previously only the primary repo was visible.
  • Auto-dispatch eligibility assessment: New build_autodispatch_eligibility_context() function (Section 3b) scans all repos for open tasks without #auto-dispatch and assesses each for candidacy based on estimate size, dependencies, and blocker statuses.
  • Blocker statuses: Recognizes human-action-required blockers that prevent auto-dispatch: account-needed, hosting-needed, login-needed, api-key-needed, clarification-needed, resources-needed, payment-needed.

Impact

The AI reasoner can now organically discover tasks in a managed project (and any future registered repo) and propose propose_auto_dispatch for eligible ones. The two-phase safety guard (propose → confirm) still applies.

Testing

  • bash -n: syntax check pass
  • shellcheck -x -s bash: zero new violations (only pre-existing SC2004 style warnings)
  • Single file change: .agents/scripts/supervisor/ai-context.sh (+140/-3 lines)

Closes #1796

Summary by CodeRabbit

  • New Features

    • Added Auto-Dispatch Eligibility Assessment to scan tasks across repositories, identify automation eligibility, and flag blockers or required breakdowns.
  • Improvements

    • Extended context aggregation to include TODO state across all registered repositories.
    • Enhanced context organization with repository name labels in headers.

…I context

The AI reasoning pipeline (ai-context.sh) previously only included the
primary repo's TODO.md. Tasks from other registered repos (e.g., awardsapp)
were invisible to the AI reasoner, preventing it from proposing auto-dispatch.

Changes:
- build_ai_context() now iterates all distinct repos from the supervisor DB
  and calls build_todo_context() for each, giving the AI full cross-project
  visibility
- build_todo_context() header now includes the repo name for disambiguation
- New build_autodispatch_eligibility_context() function scans all repos for
  open tasks without #auto-dispatch and assesses eligibility based on:
  - Estimate size (>4h needs breakdown)
  - Dependency blockers (blocked-by:)
  - Human-action-required blocker statuses: account-needed, hosting-needed,
    login-needed, api-key-needed, clarification-needed, resources-needed,
    payment-needed
- The eligibility assessment is included as Section 3b in the context
  snapshot, matching the 'Auto-Dispatch Eligibility Assessment' section
  referenced in the reasoning prompt
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

Walkthrough

The supervisor AI context builder now aggregates TODO.md state across all registered repositories instead of just the primary, and introduces a new Auto-Dispatch Eligibility Assessment section that evaluates task candidacy based on blocker status and completion records.

Changes

Cohort / File(s) Summary
Multi-repo TODO.md Aggregation
.agents/scripts/supervisor/ai-context.sh
build_todo_context function header updated to display repository name; logic now iterates through database-registered repositories to aggregate TODO.md context across all repos, ensuring primary repo inclusion.
Auto-Dispatch Eligibility Assessment
.agents/scripts/supervisor/ai-context.sh
New Section 3b added to evaluate task eligibility for auto-dispatch (t1188); scans repos for open tasks lacking #auto-dispatch tag, matches against blocker patterns and DB-filtered completed task IDs, flags tasks as eligible/blocked/needing breakdown, generates per-repo candidacy report.
Context Builder Integration
.agents/scripts/supervisor/ai-context.sh
build_ai_context function modified to conditionally append multi-repo TODO.md state and new Section 3b Eligibility Assessment before database state section.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🏗️ Supervisor peers through repo gates wide,
TODO wisdom gathered far and hide,
Eligibility assessed with blocker sight,
Tasks dispatched when conditions align just right! 🚀✨

🚥 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 The title clearly and specifically describes the main changes: adding multi-repo TODO scanning and auto-dispatch eligibility assessment to the AI context generation.
Linked Issues check ✅ Passed The pull request fully implements the coding requirement from #1796: multi-repo TODO.md scanning is now included in AI reasoning context via build_ai_context() iteration and build_todo_context() repo disambiguation.
Out of Scope Changes check ✅ Passed All changes are scoped to #1796 requirements. The auto-dispatch eligibility assessment (Section 3b) is a complementary enhancement that enables the AI to reason about task eligibility, which is directly related to the multi-repo scanning objective.
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 feature/t1188-multi-repo-context

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Feb 18 21:36:44 UTC 2026: Code review monitoring started
Wed Feb 18 21:36:45 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 26

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 26
  • VULNERABILITIES: 0

Generated on: Wed Feb 18 21:36:47 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

@marcusquinn marcusquinn merged commit 703ac6a into main Feb 18, 2026
10 of 11 checks passed
marcusquinn added a commit that referenced this pull request Feb 18, 2026
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

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/ai-context.sh (1)

67-102: ⚠️ Potential issue | 🟠 Major

Section 3b runs unconditionally, producing duplicate auto-dispatch content with Section 11 in full scope and bloating quick scope beyond the 50 K-token budget.

Line 68 calls build_autodispatch_eligibility_context with no scope guard, while the functionally overlapping Section 11 (build_auto_dispatch_eligibility_context) at line 101 is correctly guarded by [[ "$scope" == "full" ]]. The header comment on line 6 explicitly targets < 50K tokens; emitting two auto-dispatch eligibility sections for full scope (3b + 11) directly contradicts this design constraint and risks confusing the AI reasoner with two slightly different views of the same data.

Two options to resolve:

  • Option A (minimal) — guard Section 3b identically to Section 11.
  • Option B (preferred) — absorb the multi-repo scanning improvements from Section 3b directly into build_auto_dispatch_eligibility_context and remove the standalone 3b call entirely.
🛡️ Quick guard fix (Option A)
 	# Section 3b: Auto-Dispatch Eligibility Assessment (t1188)
-	context+="$(build_autodispatch_eligibility_context)\n\n"
+	if [[ "$scope" == "full" ]]; then
+		context+="$(build_autodispatch_eligibility_context)\n\n"
+	fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/supervisor/ai-context.sh around lines 67 - 102, Section 3b
unconditionally appends an auto-dispatch block via
build_autodispatch_eligibility_context causing duplication with the guarded
build_auto_dispatch_eligibility_context and bloating quick scope; fix by
removing the standalone call to build_autodispatch_eligibility_context and
instead merge its multi-repo scanning logic into
build_auto_dispatch_eligibility_context so all auto-dispatch content is produced
only when [[ "$scope" == "full" ]] (alternatively, if you want a minimal change,
wrap the existing context+="$(build_autodispatch_eligibility_context)\n\n" line
with the same [[ "$scope" == "full" ]] guard as used for
build_auto_dispatch_eligibility_context).
🧹 Nitpick comments (3)
.agents/scripts/supervisor/ai-context.sh (3)

510-511: Function name is inconsistent with the existing Section 11 counterpart.

build_autodispatch_eligibility_context (new, auto + dispatch merged) vs build_auto_dispatch_eligibility_context (existing, line 1190 — auto_dispatch separated by underscores). Both functions share a near-identical purpose; the naming divergence makes grepping and reasoning about them harder.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/supervisor/ai-context.sh around lines 510 - 511, Rename the
new function build_autodispatch_eligibility_context to match the existing naming
style by changing its name to build_auto_dispatch_eligibility_context; update
any calls/reference sites that use build_autodispatch_eligibility_context to the
new name (or add a thin forwarding alias function named
build_autodispatch_eligibility_context that calls
build_auto_dispatch_eligibility_context) so both implementations share the same
identifier and grepable symbol; ensure tests or invocations that referenced the
old name are updated to avoid duplicate definitions.

53-57: Dead code: repo_count is incremented but never used.

repo_count is declared on line 53 and incremented on line 57 but is never referenced anywhere — it carries no output, guards no condition, and contributes nothing to the context.

🧹 Suggested removal
 	if [[ -n "$all_context_repos" ]]; then
-		local repo_count=0
 		while IFS= read -r ctx_repo; do
 			[[ -z "$ctx_repo" || ! -d "$ctx_repo" ]] && continue
 			context+="$(build_todo_context "$ctx_repo")\n\n"
-			repo_count=$((repo_count + 1))
 		done <<<"$all_context_repos"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/supervisor/ai-context.sh around lines 53 - 57, Remove the
unused variable and its increment: delete the declaration "repo_count=0" and the
line that updates "repo_count=$((repo_count + 1))" since "repo_count" is never
read; leave the loop and the call to build_todo_context intact, and run a quick
grep for "repo_count" to confirm there are no other references before
committing.

517-517: blocker_pattern uses BRE \| alternation with grep -E; inconsistent with the ERE | used 2 lines later.

grep 'blue\|you' is BRE alternation syntax, while grep -E 'blue|you' is the correct ERE form. The blocker_pattern string uses \| (line 517) and is consumed via grep -qE (line 575), relying on a GNU grep extension that silently produces the intended alternation on Linux — but a shell script that works on a Linux machine might fail on macOS due to differences between GNU grep and BSD grep. Line 577 in the same function correctly uses bare | in an ERE pattern, making the pair inconsistent.

♻️ Proposed fix — consistent ERE alternation
-	local blocker_pattern="account-needed\|hosting-needed\|login-needed\|api-key-needed\|clarification-needed\|resources-needed\|payment-needed"
+	local blocker_pattern="account-needed|hosting-needed|login-needed|api-key-needed|clarification-needed|resources-needed|payment-needed"

Also applies to: 575-575

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/supervisor/ai-context.sh at line 517, The blocker_pattern
variable is defined using BRE alternation backslashes ("account-needed\|...")
but is later matched with grep -qE (ERE), causing inconsistent behavior across
platforms; update the blocker_pattern assignment in ai-context.sh to use
ERE-style alternation with plain pipes
("account-needed|hosting-needed|login-needed|api-key-needed|clarification-needed|resources-needed|payment-needed"),
ensure it remains quoted where used by grep -qE, and verify the call that uses
grep -qE (and any other grep -E uses) references blocker_pattern so the pattern
is portable to BSD grep as well as GNU grep.
🤖 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/ai-context.sh:
- Around line 60-62: The conditional that checks whether repo_path is already
present in all_context_repos uses "grep -qF" which allows substring matches and
can falsely skip the primary repo; update the check to use whole-line matching
(e.g., grep -qxF) so only exact path lines match, leaving the rest of the logic
(the context+="$(build_todo_context "$repo_path")\n\n" branch) unchanged; ensure
you keep proper quoting of variables (all_context_repos and repo_path) when
modifying the grep invocation.

---

Outside diff comments:
In @.agents/scripts/supervisor/ai-context.sh:
- Around line 67-102: Section 3b unconditionally appends an auto-dispatch block
via build_autodispatch_eligibility_context causing duplication with the guarded
build_auto_dispatch_eligibility_context and bloating quick scope; fix by
removing the standalone call to build_autodispatch_eligibility_context and
instead merge its multi-repo scanning logic into
build_auto_dispatch_eligibility_context so all auto-dispatch content is produced
only when [[ "$scope" == "full" ]] (alternatively, if you want a minimal change,
wrap the existing context+="$(build_autodispatch_eligibility_context)\n\n" line
with the same [[ "$scope" == "full" ]] guard as used for
build_auto_dispatch_eligibility_context).

---

Nitpick comments:
In @.agents/scripts/supervisor/ai-context.sh:
- Around line 510-511: Rename the new function
build_autodispatch_eligibility_context to match the existing naming style by
changing its name to build_auto_dispatch_eligibility_context; update any
calls/reference sites that use build_autodispatch_eligibility_context to the new
name (or add a thin forwarding alias function named
build_autodispatch_eligibility_context that calls
build_auto_dispatch_eligibility_context) so both implementations share the same
identifier and grepable symbol; ensure tests or invocations that referenced the
old name are updated to avoid duplicate definitions.
- Around line 53-57: Remove the unused variable and its increment: delete the
declaration "repo_count=0" and the line that updates "repo_count=$((repo_count +
1))" since "repo_count" is never read; leave the loop and the call to
build_todo_context intact, and run a quick grep for "repo_count" to confirm
there are no other references before committing.
- Line 517: The blocker_pattern variable is defined using BRE alternation
backslashes ("account-needed\|...") but is later matched with grep -qE (ERE),
causing inconsistent behavior across platforms; update the blocker_pattern
assignment in ai-context.sh to use ERE-style alternation with plain pipes
("account-needed|hosting-needed|login-needed|api-key-needed|clarification-needed|resources-needed|payment-needed"),
ensure it remains quoted where used by grep -qE, and verify the call that uses
grep -qE (and any other grep -E uses) references blocker_pattern so the pattern
is portable to BSD grep as well as GNU grep.

Comment on lines +60 to +62
if ! echo "$all_context_repos" | grep -qF "$repo_path"; then
context+="$(build_todo_context "$repo_path")\n\n"
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 | 🟡 Minor

grep -qF without -x risks a substring false-positive, silently dropping the primary repo.

grep -qF "$repo_path" matches anywhere in a line, not the full line. If the DB contains /home/user/aidevops-staging and $repo_path is /home/user/aidevops, the grep succeeds (substring match), and the primary repo's TODO.md is never included in the context — silently.

Fix: add the -x (whole-line) flag so only an exact path match counts.

🐛 Proposed fix
-		if ! echo "$all_context_repos" | grep -qF "$repo_path"; then
+		if ! echo "$all_context_repos" | grep -qxF "$repo_path"; then
📝 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
if ! echo "$all_context_repos" | grep -qF "$repo_path"; then
context+="$(build_todo_context "$repo_path")\n\n"
fi
if ! echo "$all_context_repos" | grep -qxF "$repo_path"; then
context+="$(build_todo_context "$repo_path")\n\n"
fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/supervisor/ai-context.sh around lines 60 - 62, The
conditional that checks whether repo_path is already present in
all_context_repos uses "grep -qF" which allows substring matches and can falsely
skip the primary repo; update the check to use whole-line matching (e.g., grep
-qxF) so only exact path lines match, leaving the rest of the logic (the
context+="$(build_todo_context "$repo_path")\n\n" branch) unchanged; ensure you
keep proper quoting of variables (all_context_repos and repo_path) when
modifying the grep invocation.

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.

t1188: Add multi-repo TODO.md scanning to AI reasoning context snapshot

1 participant