Skip to content

t1138: Add cycle-level action dedup to prevent repeated actions on same targets#1736

Merged
marcusquinn merged 3 commits intomainfrom
feature/t1138
Feb 18, 2026
Merged

t1138: Add cycle-level action dedup to prevent repeated actions on same targets#1736
marcusquinn merged 3 commits intomainfrom
feature/t1138

Conversation

@marcusquinn
Copy link
Owner

Summary

  • Adds enforcement mechanism to the AI supervisor action executor pipeline to prevent repeated actions on the same targets across reasoning cycles
  • New action_dedup_log SQLite table stores a rolling window of (cycle_id, action_type, target) tuples; before executing an action, the executor checks if the same pair was executed in the last N cycles (configurable via AI_ACTION_DEDUP_WINDOW, default: 5)
  • Duplicate actions are skipped with dedup_suppressed status, logged to both the action log and DB, and reported in the execution summary
  • New dedup-stats CLI subcommand for observability (ai-actions.sh dedup-stats)

Details

Problem: The supervisor self-reflection showed 10 targets receiving repeated actions across cycles — issues #1572 and #1463 acted on 3 times each, 8 tasks acted on 2 times each. The AI reasoning prompt asked the supervisor to avoid repetition, but there was no enforcement mechanism.

Solution: Implemented in the action executor pipeline (not the AI prompt) as specified:

  • Target extraction handles all 9 action types: comment_on_issue, flag_for_review, request_info, close_verifiedissue:N; adjust_priority, escalate_modeltask:tN; create_task, create_improvementtitle:...; create_subtaskstask:parent_id
  • Rolling window uses the N most recent distinct cycle IDs (not time-based) for accurate cycle-level dedup
  • Auto-prunes entries older than 7 days during ensure_db
  • Database migration added for existing installations

Ref #1709

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 25 minutes and 38 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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/t1138

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.

@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 introduces a crucial deduplication mechanism to the AI supervisor's action execution pipeline. Its primary purpose is to prevent the AI from repeatedly performing the same actions on the same targets across different reasoning cycles, addressing a noted inefficiency where the AI would act multiple times on the same issues or tasks. By implementing a cycle-based rolling window for action history and a dedicated database log, the system can now identify and suppress redundant actions, leading to more efficient AI operation and reduced unnecessary resource consumption.

Highlights

  • Action Deduplication Mechanism: Implemented a cycle-level action deduplication mechanism in the AI supervisor to prevent repeated actions on the same targets across reasoning cycles.
  • New action_dedup_log Database Table: Introduced a new action_dedup_log SQLite table to store (cycle_id, action_type, target) tuples, enabling historical tracking of executed actions.
  • Configurable Deduplication Window: Configured a rolling window (AI_ACTION_DEDUP_WINDOW, default 5 cycles) to check for duplicate actions, allowing the system to skip actions that were recently performed.
  • Duplicate Action Handling: Added logic to suppress duplicate actions, log their dedup_suppressed status, and report them in the execution summary for transparency.
  • Target Extraction for Deduplication: Developed a _extract_action_target function to correctly identify the target entity for nine different action types, ensuring accurate deduplication.
  • Observability with dedup-stats CLI: Included a new dedup-stats CLI subcommand (ai-actions.sh dedup-stats) to provide statistics and recent entries from the deduplication log.
  • Database Migration and Pruning: Provided a database migration to create the action_dedup_log table for existing installations and implemented automatic pruning of entries older than 7 days.
Changelog
  • .agents/scripts/supervisor/ai-actions.sh
    • Added AI_ACTION_DEDUP_WINDOW environment variable for configuring the deduplication window.
    • Introduced _extract_action_target function to parse action JSON and determine a unique target key.
    • Implemented _is_duplicate_action function to query the action_dedup_log and check for recent duplicates.
    • Added _record_action_dedup function to log executed or suppressed actions.
    • Modified execute_action_plan to incorporate the deduplication check before action execution.
    • Updated action logging and summary to include dedup_suppressed status.
    • Added dedup-stats subcommand to display deduplication statistics.
  • .agents/scripts/supervisor/database.sh
    • Added migration logic to create the action_dedup_log table if it doesn't exist.
    • Included a DELETE statement to prune action_dedup_log entries older than 7 days.
    • Defined the action_dedup_log table schema with cycle_id, action_type, target, status, and created_at columns, along with relevant indexes.
  • MODELS.md
    • Updated model performance statistics and pricing information.
  • TODO.md
    • Added a new TODO item (t1149) related to supervisor model tier cost-efficiency.
Activity
  • No human activity (comments, reviews) was detected on this pull request.
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.

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 introduces a robust deduplication mechanism to prevent the AI supervisor from performing repeated actions on the same targets, which is a great enhancement for efficiency and system behavior. The implementation is well-structured, with clear separation of concerns into target extraction, duplication checking, and recording logic. The addition of the dedup-stats CLI command is also a nice touch for observability.

My review focuses on improving robustness and maintainability. I've identified a few areas for improvement:

  • A recurring pattern of suppressing database errors, which violates the repository's style guide and can hide underlying issues.
  • A case where the action recording function can fail silently if the database is unavailable, which violates a repository rule regarding exit code propagation.
  • Minor opportunities to reduce code duplication in both the shell script and the database migration script, aligning with general maintainability principles.

Overall, this is a solid contribution that addresses an important problem. Addressing these points will make the implementation even more resilient.

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Feb 18 18:30:41 UTC 2026: Code review monitoring started
Wed Feb 18 18:30:42 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 24

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 24
  • VULNERABILITIES: 0

Generated on: Wed Feb 18 18:30:44 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

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

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

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 24
  • VULNERABILITIES: 0

Generated on: Wed Feb 18 18:37:48 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

marcusquinn added a commit that referenced this pull request Feb 18, 2026
…ith dead workers (t1145)

Phase 0.7 (pulse.sh): when a stale 'evaluating' task has a pr_url, route to
'pr_review' instead of re-queuing — the work is done, only the evaluation
process died. Previously, tasks with completed PRs were wastefully re-run.

supervisor-helper.sh: add 'evaluating:pr_review' to VALID_TRANSITIONS to
support the new Phase 0.7 routing path.

cleanup.sh: include 'evaluating' in stale PID file detection alongside
'running' and 'dispatched' for consistent cleanup.

Manual recovery applied to stale tasks found at time of fix:
- t1138: evaluating (dead PID 63748) + PR #1736 → pr_review
- t1139: running (dead PID 19930) + PR #1735 → pr_review (via evaluating)
- t1146: running (dead PID 12745) no PR → queued (retry)
- t1148: running (dead PID 14125) no PR → queued (retry)
- t1149: running (dead PID 15457) no PR → queued (retry)

DB now consistent: 1 running (t1145/self), 0 evaluating, 0 stale entries.
Supersedes t1140 and t1132.
…e targets (t1138)

Add enforcement mechanism to the AI supervisor action executor pipeline:
- New action_dedup_log table stores rolling window of (cycle_id, action_type, target) tuples
- Before executing an action, checks if same (action_type, target) pair was executed in last N cycles
- Duplicate actions are skipped with dedup_suppressed status and logged
- Configurable window via AI_ACTION_DEDUP_WINDOW env var (default: 5 cycles)
- Auto-prunes entries older than 7 days during ensure_db
- New dedup-stats CLI subcommand for observability
- Target extraction handles all 9 action types (issue-based, task-based, title-based)

Addresses supervisor self-reflection showing 10 targets receiving repeated actions
across cycles (issues acted on 3x each, tasks acted on 2x each).
@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, 24 code smells

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

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 24
  • VULNERABILITIES: 0

Generated on: Wed Feb 18 18:59:25 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

@marcusquinn marcusquinn merged commit 932290a into main Feb 18, 2026
11 checks passed
@marcusquinn marcusquinn deleted the feature/t1138 branch February 18, 2026 19:13
marcusquinn added a commit that referenced this pull request Feb 18, 2026
… with dead workers (#1771)

* chore: regenerate MODELS.md leaderboard (t1012, t1129)

* fix: resolve supervisor DB inconsistency — stale running/evaluating with dead workers (t1145)

Phase 0.7 (pulse.sh): when a stale 'evaluating' task has a pr_url, route to
'pr_review' instead of re-queuing — the work is done, only the evaluation
process died. Previously, tasks with completed PRs were wastefully re-run.

supervisor-helper.sh: add 'evaluating:pr_review' to VALID_TRANSITIONS to
support the new Phase 0.7 routing path.

cleanup.sh: include 'evaluating' in stale PID file detection alongside
'running' and 'dispatched' for consistent cleanup.

Manual recovery applied to stale tasks found at time of fix:
- t1138: evaluating (dead PID 63748) + PR #1736 → pr_review
- t1139: running (dead PID 19930) + PR #1735 → pr_review (via evaluating)
- t1146: running (dead PID 12745) no PR → queued (retry)
- t1148: running (dead PID 14125) no PR → queued (retry)
- t1149: running (dead PID 15457) no PR → queued (retry)

DB now consistent: 1 running (t1145/self), 0 evaluating, 0 stale entries.
Supersedes t1140 and t1132.
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