feat: pulse monitoring loop with agent routing labels#4573
Conversation
Transform pulse from one-shot dispatch to long-running monitoring loop: - Pulse session runs up to 60 minutes, sleeping 60s between cycles - Each cycle checks slots via ps, dispatches to fill open slots - Todo-based drift prevention anchors each monitoring cycle - Eliminates 125s cold-start penalty per backfill iteration Add agent routing labels to all task creation paths: - new-task.md: Step 6.5 evaluates domain and applies GitHub labels - save-todo.md: Step 1b extended with domain tag evaluation - define.md: Step 1 classification includes agent domain mapping - pulse.md: Dispatch checks issue labels for agent routing Simplify pulse-wrapper.sh: - Remove enforce_utilization_invariants() backfill loop (redundant) - LLM session handles continuous slot filling internally - Wrapper watchdog still enforces 60-minute hard ceiling
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds domain and model-tier classification to task workflows and GitHub labeling, reframes pulse as a 60-minute continuous dispatch/monitor loop with explicit routing and exit rules, and deprecates the wrapper's Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Scheduler as Scheduler (Pulse)
participant Repo as GitHub Repo
participant Classifier as Task Classifier
participant Dispatcher as Worker Dispatcher
participant Worker as Worker/Agent
Note right of Scheduler: Initial Dispatch
Scheduler->>Repo: read open tasks / prefetch state
Scheduler->>Classifier: classify task (domain, model-tier)
Classifier->>Repo: apply labels (domain, tier) [if task_ref]
Scheduler->>Dispatcher: queue work with routing metadata
Dispatcher->>Worker: assign task (agent selected by domain/tier)
Worker->>Repo: create/update TODOs, lineage, results
Scheduler->>Scheduler: monitoring loop (sleep 60s, backfill, exit conditions)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Mar 14 01:41:03 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.agents/scripts/commands/save-todo.md (1)
50-66: Centralize the domain-routing matrix to avoid drift across command docs.This mapping is now duplicated in
.agents/scripts/commands/save-todo.md,.agents/scripts/commands/define.md, and.agents/scripts/commands/new-task.md. Consider referencing a single canonical table/file so future edits don’t create subtle routing mismatches.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.agents/scripts/commands/save-todo.md around lines 50 - 66, Create a single canonical source for the "Agent domain tags" mapping (e.g., a shared markdown/snippet or a constant named AGENT_DOMAIN_TAGS) and replace the duplicated tables in the save-todo, define, and new-task command docs with an include/reference to that canonical source; update the docs that currently contain the inline table (the ones whose content shows "Agent domain tags" and the domain-to-tag rows) to pull from AGENT_DOMAIN_TAGS, remove the duplicated tables, and ensure any docs or render/build pipelines that assemble commands support the include so the routing matrix stays authoritative and in one place.
🤖 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/commands/new-task.md:
- Around line 208-214: The script currently hides failures for gh label create
and gh issue edit by redirecting stderr and OR-ing with true; remove the
"2>/dev/null || true" silencing and instead check the exit status of those
commands (the gh label create and gh issue edit invocations) when task_ref and
domain_label are set, and handle failures explicitly—e.g., capture non-zero exit
codes and emit a clear error message including task_ref and domain_label to
stderr and/or exit non-zero so routing-label failures are visible and do not
silently fall back to default routing.
---
Nitpick comments:
In @.agents/scripts/commands/save-todo.md:
- Around line 50-66: Create a single canonical source for the "Agent domain
tags" mapping (e.g., a shared markdown/snippet or a constant named
AGENT_DOMAIN_TAGS) and replace the duplicated tables in the save-todo, define,
and new-task command docs with an include/reference to that canonical source;
update the docs that currently contain the inline table (the ones whose content
shows "Agent domain tags" and the domain-to-tag rows) to pull from
AGENT_DOMAIN_TAGS, remove the duplicated tables, and ensure any docs or
render/build pipelines that assemble commands support the include so the routing
matrix stays authoritative and in one place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a472ab12-3add-45ae-a6b1-bb3879abb9ca
📒 Files selected for processing (5)
.agents/scripts/commands/define.md.agents/scripts/commands/new-task.md.agents/scripts/commands/pulse.md.agents/scripts/commands/save-todo.md.agents/scripts/pulse-wrapper.sh
| ```bash | ||
| # Only if task_ref exists (issue was created) and domain is non-code | ||
| if [[ -n "$task_ref" && -n "$domain_label" ]]; then | ||
| gh label create "$domain_label" --repo "$(gh repo view --json nameWithOwner -q .nameWithOwner)" 2>/dev/null || true | ||
| gh issue edit "${task_ref#GH#}" --repo "$(gh repo view --json nameWithOwner -q .nameWithOwner)" --add-label "$domain_label" 2>/dev/null || true | ||
| fi | ||
| ``` |
There was a problem hiding this comment.
Don’t silently swallow routing-label failures.
On Line 211 and Line 212, 2>/dev/null || true hides labeling failures completely. If label application fails, tasks silently fall back to default routing and this PR’s specialist-routing behavior is lost.
Proposed hardening
if [[ -n "$task_ref" && -n "$domain_label" ]]; then
- gh label create "$domain_label" --repo "$(gh repo view --json nameWithOwner -q .nameWithOwner)" 2>/dev/null || true
- gh issue edit "${task_ref#GH#}" --repo "$(gh repo view --json nameWithOwner -q .nameWithOwner)" --add-label "$domain_label" 2>/dev/null || true
+ repo_slug="$(gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || true)"
+ if [[ -n "$repo_slug" ]]; then
+ gh label create "$domain_label" --repo "$repo_slug" >/dev/null 2>&1 || true
+ if ! gh issue edit "${task_ref#GH#}" --repo "$repo_slug" --add-label "$domain_label" >/dev/null 2>&1; then
+ echo "[new-task] WARN: failed to apply domain label '$domain_label' to ${task_ref}" >&2
+ fi
+ else
+ echo "[new-task] WARN: unable to resolve repo slug for domain label '$domain_label'" >&2
+ fi
fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.agents/scripts/commands/new-task.md around lines 208 - 214, The script
currently hides failures for gh label create and gh issue edit by redirecting
stderr and OR-ing with true; remove the "2>/dev/null || true" silencing and
instead check the exit status of those commands (the gh label create and gh
issue edit invocations) when task_ref and domain_label are set, and handle
failures explicitly—e.g., capture non-zero exit codes and emit a clear error
message including task_ref and domain_label to stderr and/or exit non-zero so
routing-label failures are visible and do not silently fall back to default
routing.
Add tier:thinking and tier:simple labels to task creation commands: - new-task.md: Step 6.5 evaluates reasoning complexity alongside domain - save-todo.md: Step 1b extended with model tier tag table - define.md: Step 1 classification includes model tier mapping Add model tier selection to pulse dispatch refinements: - Precedence: failure escalation > tier labels > bundle defaults > sonnet - tier:thinking -> opus for architecture/novel design - tier:simple -> haiku for docs/formatting/config - No label -> default round-robin (sonnet-tier) - Includes model-availability-helper.sh resolve for provider fallback
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Mar 14 01:50:53 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
Address CodeRabbit review feedback: label application failures (tier and domain labels) now emit warnings to stderr instead of being silently suppressed. Also validates repo slug resolution before attempting label operations.
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Mar 14 01:54:56 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Feedback addressed in commit a43fc14 — label application now warns on failure instead of silently swallowing.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.agents/scripts/commands/new-task.md (1)
220-241: DeferREPO_SLUGlookup until labels are actually applicable.Nice hardening overall. As a small cleanup, resolve
REPO_SLUGonly whentask_refexists and at least one oftier_label/domain_labelis non-empty to avoid an unnecessary GitHub API call on unlabeled/offline flows.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.agents/scripts/commands/new-task.md around lines 220 - 241, Move the REPO_SLUG resolution so we only call gh when labels might be applied: wrap the existing REPO_SLUG assignment (REPO_SLUG="$(gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || true)") inside the same conditional that checks task_ref and label presence, i.e., only evaluate REPO_SLUG when task_ref is non-empty and at least one of tier_label or domain_label is non-empty; keep the existing label-creation and gh issue edit logic (references: REPO_SLUG, task_ref, tier_label, domain_label) unchanged otherwise..agents/scripts/commands/save-todo.md (1)
50-76: Centralize routing/tier taxonomy to prevent drift.This table is now duplicated across multiple command docs. Consider defining one canonical mapping doc (or generated include) and referencing it here, so label/agent mappings stay consistent over time.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.agents/scripts/commands/save-todo.md around lines 50 - 76, The duplicate "Model tier tags" and "Agent domain tags" tables should be centralized into a single canonical taxonomy document (e.g., "Model tier tags" + "Agent domain tags" mapping file) and replaced here with a reference/include; create the canonical mapping doc, move the two tables into it, then update this command doc (save-todo.md) and all other command docs to import or link to that canonical mapping instead of duplicating the tables so label/agent mappings remain consistent over time.
🤖 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/commands/pulse.md:
- Around line 125-135: The post-exit commands
(~/.aidevops/agents/scripts/circuit-breaker-helper.sh record-success and
~/.aidevops/agents/scripts/session-miner-pulse.sh) are currently only run on
process exit (opportunistic) and can be lost if the wrapper hard-kills the
process; move any must-have state capture and telemetry writes into the main
loop as per-cycle checkpoints (e.g., call the circuit-breaker-helper and
session-miner-pulse logic at the end of each iteration or when important state
changes occur), or alternatively explicitly annotate this exit-only block in
pulse.md as “opportunistic only” so callers know it is not guaranteed — update
references to the two scripts in pulse.md and any helper functions to perform
idempotent, frequent saves instead of relying solely on the final exit hook.
- Around line 302-314: The section currently hardcodes provider/model IDs (e.g.,
`--model anthropic/claude-opus-4-6` / `--model
anthropic/claude-haiku-4-5-20251001`) and should instead dispatch via tier
aliases and the resolver: replace the concrete model flags with calls to
model-availability-helper.sh resolve <tier> (or use bundle-helper.sh get
model_defaults.implementation <repo-path> when bundle defaults apply) so the
supervisor flow (supervisor-helper.sh) remains the single source of truth; keep
the concrete IDs only as reference text in docs, not as runtime flags.
---
Nitpick comments:
In @.agents/scripts/commands/new-task.md:
- Around line 220-241: Move the REPO_SLUG resolution so we only call gh when
labels might be applied: wrap the existing REPO_SLUG assignment (REPO_SLUG="$(gh
repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || true)") inside
the same conditional that checks task_ref and label presence, i.e., only
evaluate REPO_SLUG when task_ref is non-empty and at least one of tier_label or
domain_label is non-empty; keep the existing label-creation and gh issue edit
logic (references: REPO_SLUG, task_ref, tier_label, domain_label) unchanged
otherwise.
In @.agents/scripts/commands/save-todo.md:
- Around line 50-76: The duplicate "Model tier tags" and "Agent domain tags"
tables should be centralized into a single canonical taxonomy document (e.g.,
"Model tier tags" + "Agent domain tags" mapping file) and replaced here with a
reference/include; create the canonical mapping doc, move the two tables into
it, then update this command doc (save-todo.md) and all other command docs to
import or link to that canonical mapping instead of duplicating the tables so
label/agent mappings remain consistent over time.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 20fc5e6c-7303-408b-8b69-f8f33004b644
📒 Files selected for processing (4)
.agents/scripts/commands/define.md.agents/scripts/commands/new-task.md.agents/scripts/commands/pulse.md.agents/scripts/commands/save-todo.md
Address CodeRabbit review: replace hardcoded provider/model IDs (anthropic/claude-opus-4-6, anthropic/claude-haiku-4-5-20251001) with model-availability-helper.sh resolve <tier> calls. This ensures dispatch respects provider backoff and cross-provider fallback chains. Also mark exit cleanup commands as best-effort/opportunistic since the wrapper's watchdog may hard-kill before they complete.
Both findings addressed: (1) model IDs replaced with tier resolver calls, (2) exit block marked as best-effort/opportunistic.
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Mar 14 02:04:46 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
ps, and backfills open slots immediately — eliminating the 125s cold-start penalty per backfill iteration thatenforce_utilization_invariants()imposed./new-task,/save-todo,/define) now evaluate domain and apply GitHub labels (seo,content,marketing, etc.). The pulse checks these labels at dispatch time to route workers to the correct specialist agent.enforce_utilization_invariants()replaced with a no-op stub — the LLM session handles continuous slot filling internally. The wrapper's watchdog still enforces the 60-minute hard ceiling.Changes
pulse.mdnew-task.mdsave-todo.mddefine.mdpulse-wrapper.shenforce_utilization_invariants()→ no-op stub, call removed frommain()Architecture
Each monitoring cycle costs ~3K tokens. At 200K context, that's ~65 iterations before context fills. The 55-minute exit condition ensures the session finishes before compaction triggers. The wrapper's watchdog (PULSE_STALE_THRESHOLD=3600s) is the hard safety net.
Summary by CodeRabbit
New Features
Documentation
Chores