t1118: Add AI self-reflection context — supervisor can now diagnose its own failures#1671
Conversation
…oning engine (t1118) The supervisor AI couldn't diagnose its own failures because it never saw its action execution results. This adds: 1. Section 10 in ai-context.sh (build_self_reflection_context): - Execution summary across last 5 cycles (executed/failed/skipped rates) - Recurring skip reasons with counts (reveals prompt/validator mismatches) - Recurring failures with counts - Action repetition detection (same targets across cycles) - Pipeline errors from ai-supervisor.log 2. Analysis area #9 in reasoning prompt (ai-reason.sh): - Instructs AI to review self-reflection data and create improvement tasks for its own recurring failures 3. Added adjust_priority example to output format: - The AI kept omitting new_priority because no example showed the field - This was the #1 skip reason (10 skips across 5 cycles) The AI can now self-diagnose issues like: - 'adjust_priority skipped 10x: missing new_priority' -> fix own output - 'create_improvement skipped 6x: invalid type' -> flag deployment gap - 'issue #1601 acted on 3x across 5 cycles' -> stop repeating - 'jq compile errors in pipeline' -> create fix task
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request introduces AI self-reflection capabilities (t1118) that feed execution history back to the reasoning engine. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
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 |
Summary of ChangesHello @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 significantly enhances the AI supervisor's autonomy and effectiveness by enabling it to self-diagnose and learn from its past actions. By integrating a new self-reflection mechanism, the AI now receives detailed feedback on its execution history, including skipped actions, recurring failures, repeated tasks, and pipeline errors. This newfound awareness allows the AI to proactively identify and address issues in its prompts, execution logic, and overall strategy, leading to a more robust and continuously improving system. Highlights
Changelog
Using Gemini Code AssistThe 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
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 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
|
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
🔍 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: Wed Feb 18 15:44:50 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
build_self_reflection_context) toai-context.sh— feeds the AI its own action execution history so it can identify and fix recurring failuresai-reason.shadjust_priorityexample to the output format (was the only action type without an example)Problem
The supervisor AI couldn't self-diagnose because it never saw its own execution results:
adjust_prioritywas skipped 10 times across 5 cycles because the AI didn't includenew_priority(no example in the prompt)create_improvementwas skipped 6 times as "invalid type" (deployment gap — the AI would have flagged this)set -euo pipefailerror handling to scripts missing it #1572) were flagged 3 times each across cycles (redundant work)Solution
The self-reflection section provides:
Testing
Tested standalone — produces clean output from real action logs:
Context size: 20KB (well within 50K budget)
Closes #1670
Summary by CodeRabbit
New Features
Documentation