Skip to content

t1085: Remove artificial pulse counter from Phase 14, use natural guards#1641

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/t1085-pulse-every-cycle
Feb 18, 2026
Merged

t1085: Remove artificial pulse counter from Phase 14, use natural guards#1641
marcusquinn merged 1 commit intomainfrom
bugfix/t1085-pulse-every-cycle

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 18, 2026

Summary

  • Removes the pulse counter (every 15th pulse = ~30 min) from Phase 14 AI reasoning
  • AI reasoning now attempts on every pulse cycle, gated by natural guards:
    1. should_run_ai_reasoning()has_actionable_work() pre-flight (skip if nothing to reason about)
    2. Time-based cooldown via SUPERVISOR_AI_COOLDOWN (default 300s = 5 min) replaces SUPERVISOR_AI_INTERVAL
    3. Lock file in run_ai_reasoning() prevents concurrent AI sessions
  • Net -9 lines: simpler code, no artificial throttling, faster response to actionable work

Why

The pulse counter created 30-minute blind spots where the supervisor couldn't reason even when actionable work appeared. The natural guards (actionable work check + cooldown + lock file) already prevent waste — the counter was redundant throttling on top of them.

Config change

  • Removed: SUPERVISOR_AI_INTERVAL (pulse count, default 15)
  • Added: SUPERVISOR_AI_COOLDOWN (seconds, default 300)

Existing deployments using SUPERVISOR_AI_INTERVAL will silently ignore it and use the new 5-minute cooldown default.

Summary by CodeRabbit

  • Bug Fixes

    • Improved AI reasoning cooldown mechanism with timestamp-based tracking, replacing interval-based scheduling and providing a configurable 300-second default.
  • Improvements

    • Enhanced AI execution to dynamically check for actionable work on each cycle.
    • Updated logging to display elapsed vs. cooldown timing.
    • Introduced better repo path discovery for AI operations.

…s (t1085)

Phase 14 AI reasoning now attempts on every pulse cycle instead of
every 15th. Natural guards prevent waste:
- should_run_ai_reasoning() checks has_actionable_work() pre-flight
- Time-based cooldown (SUPERVISOR_AI_COOLDOWN, default 300s) replaces
  pulse-count interval (SUPERVISOR_AI_INTERVAL)
- Lock file in run_ai_reasoning() prevents concurrent sessions

The pulse counter was redundant throttling on top of these guards,
causing 30-minute blind spots where the supervisor couldn't reason
even when actionable work appeared.
@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 refactors the AI supervisor's reasoning trigger mechanism to remove an artificial pulse-based throttling system. The change aims to enhance the supervisor's responsiveness to actionable work by allowing it to attempt reasoning on every pulse cycle, while relying on more efficient, natural guards such as a time-based cooldown and a check for actionable tasks. This leads to a simpler, more effective, and less wasteful AI reasoning process.

Highlights

  • Removed Artificial Throttling: The artificial pulse counter (every 15th pulse, approximately 30 minutes) for Phase 14 AI reasoning has been removed, eliminating previous blind spots.
  • Enhanced AI Responsiveness: AI reasoning now attempts to run on every pulse cycle, allowing for faster response to actionable work.
  • Implemented Natural Guards: New guarding mechanisms include a pre-flight check for actionable work (has_actionable_work()), a time-based cooldown via SUPERVISOR_AI_COOLDOWN (default 300 seconds), and a lock file to prevent concurrent AI sessions.
  • Configuration Change: The SUPERVISOR_AI_INTERVAL configuration variable has been removed, and SUPERVISOR_AI_COOLDOWN has been added to manage the time-based cooldown.
  • Code Simplification: The changes resulted in a net reduction of 9 lines of code, simplifying the AI reasoning logic.
Changelog
  • .agents/scripts/supervisor/ai-reason.sh
    • Updated comments to reflect the new AI reasoning trigger conditions, including SUPERVISOR_AI_ENABLED, has_actionable_work(), and SUPERVISOR_AI_COOLDOWN.
    • Replaced the interval variable, previously derived from SUPERVISOR_AI_INTERVAL, with a cooldown variable based on SUPERVISOR_AI_COOLDOWN.
    • Modified the time-elapsed check to use the new cooldown value instead of a calculated interval_seconds.
  • .agents/scripts/supervisor/pulse.sh
    • Removed the logic for reading, incrementing, and resetting the ai_pulse_count and ai_pulse_count_file.
    • Updated the descriptive comments for Phase 14 to detail the new natural guards: SUPERVISOR_AI_ENABLED, should_run_ai_reasoning(), and the lock file in run_ai_reasoning().
    • Removed the ai_interval and ai_pulse_count_file variable declarations.
    • Changed the log_info message for AI supervisor reasoning to remove pulse count details.
    • Modified the log_verbose message for skipped AI pipeline to indicate "no actionable work or cooldown active" instead of remaining pulses.
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 18, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

The pull request replaces an interval-based AI reasoning cadence system with a timestamp-driven cooldown mechanism. Changes affect AI gating logic in the supervisor scripts, removing pulse-count tracking and introducing elapsed-time checks against a configurable 300-second default cooldown, with optional force-bypass capability.

Changes

Cohort / File(s) Summary
AI Reasoning Gating Logic
.agents/scripts/supervisor/ai-reason.sh
Updated should_run_ai_reasoning function to use last-run timestamp elapsed checks instead of interval counters. New SUPERVISOR_AI_COOLDOWN default (300s) replaces interval*120 calculation. Expanded header comments document the three natural guards: enabled switch, actionable-work pre-flight, and time-based cooldown. Force parameter now bypasses cooldown instead of interval checks. Logging format updated to show (elapsed / cooldown).
AI Cadence and Invocation
.agents/scripts/supervisor/pulse.sh
Replaced per-15-pulse AI cadence with heuristic gating on every pulse via should_run_ai_reasoning. Introduces ai_repo_path discovery through DB query with fallback to current directory. Removes reliance on ai-pulse-count file and ai-interval counter. Adds dedicated AI logging with timestamps and summary metrics (executed, failed, skipped) parsed from JSON. Executes run_ai_actions_pipeline when gate conditions permit; logs skipped status when actionable work or cooldown conditions unmet.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

⏰ Time-tick replaces pulse-tick today,
Cooldown clocks now show the way—
Elapsed checks dance with guardian gates,
Resource wisdom celebrates! ✨

🚥 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 main change: removing an artificial pulse counter and replacing it with natural guards for AI reasoning gating.
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/t1085-pulse-every-cycle

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Feb 18 14:10:18 UTC 2026: Code review monitoring started
Wed Feb 18 14:10:18 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 23

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 23
  • VULNERABILITIES: 0

Generated on: Wed Feb 18 14:10:21 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

The pull request successfully refactors the AI reasoning trigger mechanism by removing the artificial pulse counter and implementing a more robust system based on natural guards: checking for actionable work, a time-based cooldown, and a lock file for concurrency control. This change simplifies the code and allows for a more responsive AI supervisor. The updated comments and logging messages accurately reflect the new logic. However, a potential issue was identified where a function argument ($2) is not being correctly captured into a local variable, which could lead to incorrect behavior in downstream function calls.

# Arguments:
# $1 - (optional) force: "true" to skip interval check
# $1 - (optional) force: "true" to skip cooldown check
# $2 - (optional) repo_path

Choose a reason for hiding this comment

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

high

The comment on this line indicates that $2 is repo_path. However, the should_run_ai_reasoning function's implementation does not explicitly capture this second argument into a local variable. This means that the has_actionable_work function, which is called within should_run_ai_reasoning and expects repo_path as an argument, will likely receive an empty or unset variable, potentially leading to incorrect behavior. Please update the function body to capture $2 into a local repo_path variable.

@marcusquinn marcusquinn merged commit 4079848 into main Feb 18, 2026
11 of 12 checks passed
@marcusquinn marcusquinn deleted the bugfix/t1085-pulse-every-cycle branch February 21, 2026 01:59
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