Skip to content

feat: pulse monitoring loop with agent routing labels#4573

Merged
marcusquinn merged 4 commits intomainfrom
feature/pulse-monitor-loop
Mar 14, 2026
Merged

feat: pulse monitoring loop with agent routing labels#4573
marcusquinn merged 4 commits intomainfrom
feature/pulse-monitor-loop

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Mar 14, 2026

Summary

  • Pulse as monitoring loop: Transform from one-shot dispatch to long-running session (up to 60 minutes). After initial dispatch, the LLM sleeps 60s, checks slots via ps, and backfills open slots immediately — eliminating the 125s cold-start penalty per backfill iteration that enforce_utilization_invariants() imposed.
  • Agent routing labels at task creation: All three task creation paths (/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.
  • Simplified pulse-wrapper.sh: 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

File Change
pulse.md Rewritten: "Initial Dispatch" + "Monitoring Loop" sections, todo-based drift prevention, agent routing from labels
new-task.md New Step 6.5: domain label evaluation with GitHub label application
save-todo.md Step 1b extended with agent domain tag table
define.md Step 1 classification extended with agent domain mapping
pulse-wrapper.sh enforce_utilization_invariants() → no-op stub, call removed from main()

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

    • Added model-tier tagging (thinking, simple, coding) and domain-based agent routing to direct tasks to specialist agents.
    • Introduced a continuous monitoring dispatch loop that fills and backfills worker slots on a regular cadence.
  • Documentation

    • Updated task classification guidance to require domain and tier labeling rules and guidance for when to omit labels.
    • Clarified dispatch, monitoring, and exit behaviors.
  • Chores

    • Deprecated legacy enforcement; wrapper now defers slot-filling to the monitoring loop.

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
@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!

@github-actions github-actions bot added the enhancement Auto-created from TODO.md tag label Mar 14, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 43 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dacbeccd-24a3-4b16-b06b-268e9aa57e8d

📥 Commits

Reviewing files that changed from the base of the PR and between a43fc14 and 9e2b1a4.

📒 Files selected for processing (1)
  • .agents/scripts/commands/pulse.md

Walkthrough

Adds 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 enforce_utilization_invariants() to a no-op log stub.

Changes

Cohort / File(s) Summary
Task classification & labeling
.agents/scripts/commands/define.md, .agents/scripts/commands/new-task.md, .agents/scripts/commands/save-todo.md
Adds agent domain tags and model-tier tags, guidance for when to omit tags (code/Build+), examples, and steps to generate/apply GitHub labels; includes bash snippet and safeguards for missing repo/task refs.
Pulse dispatch & monitoring
.agents/scripts/commands/pulse.md
Reworks pulse from periodic run to a long-running 60-minute monitoring loop with initial dispatch, continuous monitoring cadence (60s), immediate slot backfills, expanded dedup guards, routing from labels, model-tier precedence, new exit conditions, and many textual/flow clarifications.
Wrapper script changes
.agents/scripts/pulse-wrapper.sh
Deprecated enforce_utilization_invariants() to a logging no-op and removed its invocation; wrapper retains stale-threshold enforcement and documents that LLM pulse session handles continuous fill.

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)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

needs-review

Poem

🛰️ Pulse now hums, a steady beat through night and day,
Domains call specialists who know the perfect way.
Labels steer the lanes, tiers pick how minds should roam,
Wrapper sleeps, the loop keeps watch — the system brings it home. ✨

🚥 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 summarizes the primary changes: introducing a pulse monitoring loop with agent routing via labels. It directly reflects the two main architectural shifts (monitoring loop + label-based routing) evident across all modified files.
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 unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/pulse-monitor-loop
📝 Coding Plan
  • Generate coding plan for human review comments

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Mar 14 01:41:00 UTC 2026: Code review monitoring started
Sat Mar 14 01:41:01 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 414

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 414
  • VULNERABILITIES: 0

Generated on: Sat Mar 14 01:41:03 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

coderabbitai[bot]
coderabbitai bot previously requested changes Mar 14, 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

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between eccad3c and 072e2e4.

📒 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

Comment on lines +208 to +214
```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
```
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

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
@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, 414 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Mar 14 01:50:50 UTC 2026: Code review monitoring started
Sat Mar 14 01:50:51 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 414

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 414
  • VULNERABILITIES: 0

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.
@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, 414 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Mar 14 01:54:53 UTC 2026: Code review monitoring started
Sat Mar 14 01:54:54 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 414

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 414
  • VULNERABILITIES: 0

Generated on: Sat Mar 14 01:54:56 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@marcusquinn
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@marcusquinn marcusquinn dismissed coderabbitai[bot]’s stale review March 14, 2026 02:02

Feedback addressed in commit a43fc14 — label application now warns on failure instead of silently swallowing.

coderabbitai[bot]
coderabbitai bot previously requested changes Mar 14, 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: 2

🧹 Nitpick comments (2)
.agents/scripts/commands/new-task.md (1)

220-241: Defer REPO_SLUG lookup until labels are actually applicable.

Nice hardening overall. As a small cleanup, resolve REPO_SLUG only when task_ref exists and at least one of tier_label/domain_label is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 072e2e4 and a43fc14.

📒 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.
@marcusquinn marcusquinn dismissed coderabbitai[bot]’s stale review March 14, 2026 02:04

Both findings addressed: (1) model IDs replaced with tier resolver calls, (2) exit block marked as best-effort/opportunistic.

@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, 414 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Mar 14 02:04:43 UTC 2026: Code review monitoring started
Sat Mar 14 02:04:43 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 414

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 414
  • VULNERABILITIES: 0

Generated on: Sat Mar 14 02:04:46 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Auto-created from TODO.md tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant