Skip to content

🤖 CodeRabbit AI Integration - Comprehensive Code Review Setup#1

Merged
marcusquinn merged 2 commits intomainfrom
coderabbit-integration-review
Nov 9, 2025
Merged

🤖 CodeRabbit AI Integration - Comprehensive Code Review Setup#1
marcusquinn merged 2 commits intomainfrom
coderabbit-integration-review

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Nov 9, 2025

🤖 CodeRabbit AI-Powered Code Review Integration

This PR sets up comprehensive CodeRabbit AI code review integration for our zero-technical-debt DevOps framework.

What's Included:

🔧 CodeRabbit Configuration (.coderabbit.yaml)

  • Comprehensive review instructions tailored for DevOps automation
  • Path-specific guidance for providers, automation scripts, and templates
  • Security-focused analysis with emphasis on credential handling
  • Shell script quality standards (error handling, variable usage, ShellCheck compliance)
  • Architecture review focus on modularity and consistency

📊 Quality Metrics Update

  • ZERO TECHNICAL DEBT ACHIEVEMENT documented in README
  • 100% issue resolution (349 → 0 issues) across all platforms
  • 100% technical debt elimination (805 → 0 minutes)
  • Multi-platform excellence status updated

🚀 Code Quality Showcase

  • Enhanced documentation in setup-wizard-helper.sh
  • Comprehensive header with usage instructions
  • Demonstrates our systematic approach to code quality

🎯 Review Focus Areas:

CodeRabbit will analyze:

  • Shell Script Quality: Error handling, variable usage, security
  • Architecture & Design: Modularity, consistency, abstraction
  • Documentation: Clarity, completeness, maintainability
  • Security: Credential handling, input validation, safe operations
  • DevOps Best Practices: Automation reliability, CI/CD effectiveness

📈 Framework Achievements:

  • 18,000+ lines of production-ready DevOps automation
  • 25+ service integrations (hosting, DNS, security, monitoring)
  • Zero security vulnerabilities across all platforms
  • A-grade ratings on SonarCloud, CodeFactor, and Codacy
  • 100% documentation coverage with AI-optimized guides

🔍 Expected CodeRabbit Analysis:

This PR will trigger CodeRabbit's comprehensive AI review of our entire codebase, providing insights on:

  • Code quality and maintainability
  • Security best practices adherence
  • Architecture and design patterns
  • Documentation completeness
  • DevOps automation effectiveness

Ready for AI-powered code review! 🚀


Pull Request opened by Augment Code with guidance from the PR author

Summary by CodeRabbit

  • Documentation

    • Updated README metrics and status badge to show configured AI review and zero technical debt.
    • Expanded docs with CodeRabbit CLI usage and improved shell script best-practices guidance.
    • Added header documentation to provider helper and updated setup next-steps to include CLI install/setup.
  • New Features

    • Added an interactive CLI wrapper for CodeRabbit with install/setup/review/analyze/status commands.
  • Chores

    • Added optional pre-commit review step and integrated CLI checks into quality-check workflow via non-blocking checks.
  • Configuration

    • Added comprehensive CodeRabbit configuration for AI-assisted reviews and path-specific rules.

✅ CODERABBIT CONFIGURATION:
- Added comprehensive .coderabbit.yaml configuration
- Defined review focus areas for DevOps framework
- Configured path-specific review instructions
- Enabled security, performance, and best practices analysis

✅ QUALITY METRICS UPDATE:
- Updated README with ZERO TECHNICAL DEBT achievement
- Documented 100% issue resolution (349 → 0 issues)
- Highlighted 100% technical debt elimination (805 → 0 minutes)
- Updated CodeRabbit integration status

✅ CODE QUALITY SHOWCASE:
- Enhanced setup-wizard-helper.sh documentation
- Added comprehensive header with usage instructions
- Demonstrated adherence to documentation standards
- Showcased systematic code quality improvements

🎯 PURPOSE: Trigger comprehensive CodeRabbit AI review
📊 ACHIEVEMENT: Zero technical debt across 18,000+ lines of code
🚀 INTEGRATION: Multi-platform quality assurance (SonarCloud + CodeFactor + CodeRabbit)
🔍 FOCUS: Security, maintainability, and DevOps best practices analysis
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Caution

Review failed

The pull request is closed.

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Expected boolean, received object at "reviews.request_changes_workflow"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Adds CodeRabbit integration: a new .coderabbit.yaml config, CLI helper script and docs, pre-commit/quality-check hooks to call the CLI, README metric updates, a documentation header in a helper script, and setup instructions updated to include CodeRabbit CLI steps.

Changes

Cohort / File(s) Change Summary
CodeRabbit configuration
.coderabbit.yaml
New CodeRabbit config defining review rules, path-specific guidance for shell scripts, language settings (ShellCheck-style), enabled review features, exclusion patterns, and workflow preferences (auto-approve disabled, request_changes_workflow enabled).
CLI integration & hooks
.agent/scripts/coderabbit-cli.sh, .agent/scripts/pre-commit-hook.sh, .agent/scripts/quality-check.sh
Added coderabbit-cli.sh (install/setup/review/analyze/status/help workflows, API key management, colored output). Pre-commit hook optionally runs the CLI review if configured. quality-check.sh gains check_coderabbit_cli() and invokes it from main.
Documentation & guides
AGENTS.md, README.md, setup.sh
AGENTS.md documents CodeRabbit CLI usage and shell-script best practices. README.md updated: adds CodeRabbit PR Reviews badge, replaces previous metric lines with "ZERO TECHNICAL DEBT ACHIEVED" and "100% Technical Debt Elimination", and marks CodeRabbit as configured. setup.sh Next Steps reordered to include CLI install/setup step.
Script header docs
providers/setup-wizard-helper.sh
Prepended a comprehensive header comment block (usage, commands, author/version/license). No functional changes.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer / CI
    participant Local as coderabbit-cli.sh
    participant CR as coderabbit (CLI/API)
    rect `#DFF5E1`
        Dev->>Local: bash .agent/scripts/coderabbit-cli.sh setup
        Local->>CR: install / configure (downloads, saves API key)
        CR-->>Local: install & token confirmation
        Local-->>Dev: success/info messages
    end
    rect `#F0F7FF`
        Dev->>Local: bash .agent/scripts/coderabbit-cli.sh review
        Local->>CR: coderabbit review <target>
        CR-->>Local: review results (stdout/json)
        Local-->>Dev: prints results / exit code
    end
    Note over Local,CR: Pre-commit/quality-check call the Local script when present
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas to focus:
    • .agent/scripts/coderabbit-cli.sh — verify secure API key handling, permission bits, error paths, and idempotency of install/setup flows.
    • .agent/scripts/pre-commit-hook.sh and .agent/scripts/quality-check.sh — confirm non-blocking behavior and correct integration when CLI absent.
    • .coderabbit.yaml — validate YAML syntax, path globs, and that exclusion rules don't omit desired files.
    • README.md — ensure metric claims are accurate and intentional.

Possibly related PRs

Poem

🐰 I hopped into scripts at dawn,
Wrote keys and badges on the lawn.
Reviews now hum, the CLI sings,
Zero debt and helpful things.
Hop, review, and carry on! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title includes an emoji (🤖) which adds noise, and is overly broad. While it describes the general topic (CodeRabbit integration), it doesn't clearly highlight the primary change or distinguish this PR from other potential integration work. Remove the emoji and make the title more specific about the key change. For example: 'Add CodeRabbit AI review configuration with shell script analysis' or 'Configure CodeRabbit with comprehensive code review rules.'
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2730b9a and 6903f6f.

📒 Files selected for processing (6)
  • .agent/scripts/coderabbit-cli.sh (1 hunks)
  • .agent/scripts/pre-commit-hook.sh (1 hunks)
  • .agent/scripts/quality-check.sh (2 hunks)
  • AGENTS.md (1 hunks)
  • README.md (3 hunks)
  • setup.sh (1 hunks)

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.

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: 5

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7a00f6 and 2730b9a.

📒 Files selected for processing (3)
  • .coderabbit.yaml (1 hunks)
  • README.md (2 hunks)
  • providers/setup-wizard-helper.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
providers/setup-wizard-helper.sh (1)

3-18: Clean documentation enhancement. The comprehensive header adds valuable usage guidance without altering functionality. Well-structured comments following shell script conventions.

README.md (1)

461-462: Verify metric accuracy before publication. The updated metrics claim complete resolution (349 → 0 issues, 805 → 0 minutes debt), a significant improvement that should be validated against actual analysis tool outputs (SonarCloud, CodeFactor, Codacy) to confirm reproducibility and prevent misleading claims about code quality.

Comment on lines +1 to +108
# CodeRabbit Configuration for AI-Assisted DevOps Framework
# https://docs.coderabbit.ai/guides/review-instructions

# Review Instructions
reviews:
# High-level review focus areas
high_level_summary: true

# Specific areas of focus for this DevOps framework
review_instructions: |
This is an AI-Assisted DevOps Framework with comprehensive automation tools.

Please focus on:

**Shell Script Quality:**
- Proper error handling and return statements
- Consistent variable naming and local variable usage
- Security best practices (no hardcoded credentials)
- Proper quoting and parameter expansion
- ShellCheck compliance

**Architecture & Design:**
- Modular design and separation of concerns
- Consistent patterns across provider helpers
- Clear function responsibilities
- Proper abstraction levels

**Documentation & Maintainability:**
- Clear function and script documentation
- Consistent coding style
- Meaningful variable and function names
- Proper commenting for complex logic

**Security & Best Practices:**
- No sensitive data in code
- Proper input validation
- Safe file operations
- Secure API interactions

**DevOps Automation:**
- Quality assurance automation
- CI/CD pipeline effectiveness
- Multi-platform compatibility
- Error handling in automation scripts

# Auto-approve simple changes
auto_approve:
enabled: false # Keep manual review for this critical framework

# Request changes for critical issues
request_changes_workflow:
enabled: true

# Path-specific instructions
path_instructions:
- path: "providers/*.sh"
instructions: |
Provider helper scripts - focus on:
- Consistent API patterns
- Proper error handling
- Security of credential handling
- Input validation

- path: ".agent/scripts/*.sh"
instructions: |
Automation scripts - focus on:
- Reliability and robustness
- Clear logging and feedback
- Proper exit codes
- Error recovery mechanisms

- path: "templates/*.sh"
instructions: |
Template scripts - focus on:
- Security (prompt injection protection)
- Flexibility and reusability
- Clear documentation
- Safe defaults

# Language-specific settings
language_settings:
shell:
# Enable ShellCheck-style analysis
enable_static_analysis: true
# Focus on common shell pitfalls
focus_areas:
- "error_handling"
- "variable_quoting"
- "parameter_expansion"
- "security"

# Exclude certain files from review
exclude_paths:
- ".agent/tmp/*"
- ".agent/memory/*"
- "*.log"
- "*.tmp"

# Enable specific review features
features:
# Enable security-focused reviews
security_review: true
# Enable performance analysis
performance_review: true
# Enable best practices checking
best_practices: true
# Enable documentation review
documentation_review: true
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Restructure configuration for schema compliance. The file requires restructuring to align with CodeRabbit's YAML schema. Key issues: (1) request_changes_workflow must be boolean, (2) language_settings should be removed (use tools.shellcheck), (3) exclude_paths should be path_filters under reviews, (4) features is non-standard and should be removed.

Here's a corrected and simplified configuration that aligns with the schema:

# CodeRabbit Configuration for AI-Assisted DevOps Framework
# https://docs.coderabbit.ai/guides/review-instructions

reviews:
  # High-level review focus areas
  high_level_summary: true
  
  # Specific areas of focus for this DevOps framework
  review_instructions: |
    This is an AI-Assisted DevOps Framework with comprehensive automation tools.
    
    Please focus on:
    
    **Shell Script Quality:**
    - Proper error handling and return statements
    - Consistent variable naming and local variable usage
    - Security best practices (no hardcoded credentials)
    - Proper quoting and parameter expansion
    - ShellCheck compliance
    
    **Architecture & Design:**
    - Modular design and separation of concerns
    - Consistent patterns across provider helpers
    - Clear function responsibilities
    - Proper abstraction levels
    
    **Documentation & Maintainability:**
    - Clear function and script documentation
    - Consistent coding style
    - Meaningful variable and function names
    - Proper commenting for complex logic
    
    **Security & Best Practices:**
    - No sensitive data in code
    - Proper input validation
    - Safe file operations
    - Secure API interactions
    
    **DevOps Automation:**
    - Quality assurance automation
    - CI/CD pipeline effectiveness
    - Multi-platform compatibility
    - Error handling in automation scripts
  
  # Keep manual review for this critical framework
  auto_approve: false
  
  # Request changes for critical issues
  request_changes_workflow: true
  
  # Exclude certain files from review
  path_filters:
    - "!.agent/tmp/**"
    - "!.agent/memory/**"
    - "!*.log"
    - "!*.tmp"
  
  # Path-specific instructions
  path_instructions:
    - path: "providers/*.sh"
      instructions: |
        Provider helper scripts - focus on:
        - Consistent API patterns
        - Proper error handling
        - Security of credential handling
        - Input validation
    
    - path: ".agent/scripts/*.sh"
      instructions: |
        Automation scripts - focus on:
        - Reliability and robustness
        - Clear logging and feedback
        - Proper exit codes
        - Error recovery mechanisms
    
    - path: "templates/*.sh"
      instructions: |
        Template scripts - focus on:
        - Security (prompt injection protection)
        - Flexibility and reusability
        - Clear documentation
        - Safe defaults

# Enable specific analysis tools
tools:
  shellcheck:
    enabled: true
🤖 Prompt for AI Agents
In .coderabbit.yaml lines 1-108: convert request_changes_workflow from an object
to a boolean (e.g., request_changes_workflow: true), remove the
language_settings block and instead add tools.shellcheck: enabled: true under
top-level tools, move exclude_paths into reviews.path_filters (use
repository-style globs like "!.agent/tmp/**", "!.agent/memory/**", "!*.log",
"!*.tmp"), and remove the non-standard features section; ensure the rest of the
reviews and path_instructions remain under reviews.

Comment on lines +51 to +52
request_changes_workflow:
enabled: true
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 | 🔴 Critical

Critical schema validation error: request_changes_workflow structure. According to the CodeRabbit schema, request_changes_workflow must be a boolean value, not an object with an enabled property. The current nested structure will cause configuration parsing to fail.

Apply this fix:

  # Request changes for critical issues
-  request_changes_workflow:
-    enabled: true
+  request_changes_workflow: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
request_changes_workflow:
enabled: true
request_changes_workflow: true
🤖 Prompt for AI Agents
In .coderabbit.yaml around lines 51 to 52, request_changes_workflow is currently
defined as an object with an enabled property which violates the schema; replace
the object with a plain boolean by removing the nested enabled key and setting
request_changes_workflow: true (or false if you want it disabled) so the value
is a top-level boolean as required.

Comment on lines +81 to +90
language_settings:
shell:
# Enable ShellCheck-style analysis
enable_static_analysis: true
# Focus on common shell pitfalls
focus_areas:
- "error_handling"
- "variable_quoting"
- "parameter_expansion"
- "security"
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 | 🔴 Critical

Non-standard configuration keys not in CodeRabbit schema. Lines 81-90 define language_settings and shell sections that don't exist in the CodeRabbit configuration schema. To enable ShellCheck-style analysis, use the tools.shellcheck configuration instead.

Replace this section with schema-compliant configuration:

-# Language-specific settings
-language_settings:
-  shell:
-    # Enable ShellCheck-style analysis
-    enable_static_analysis: true
-    # Focus on common shell pitfalls
-    focus_areas:
-      - "error_handling"
-      - "variable_quoting"
-      - "parameter_expansion"
-      - "security"
+# Enable static analysis tools
+tools:
+  shellcheck:
+    enabled: true

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In .coderabbit.yaml around lines 81 to 90, remove the non-standard
language_settings -> shell block and replace it with a schema-compliant
tools.shellcheck section; specifically add a tools.shellcheck: enabled: true
entry and move your analysis preferences into that section (for example as a
checks or args list — e.g. focus areas like error_handling, variable_quoting,
parameter_expansion, security should be expressed under tools.shellcheck as a
checks/args array consistent with the CodeRabbit schema). Ensure no leftover
language_settings.shell keys remain.

Comment on lines +93 to +97
exclude_paths:
- ".agent/tmp/*"
- ".agent/memory/*"
- "*.log"
- "*.tmp"
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 | 🔴 Critical

Invalid key exclude_paths — use path_filters instead. The configuration uses exclude_paths which is not recognized by CodeRabbit's schema. The correct key is path_filters (under reviews), which supports both inclusion and exclusion patterns using glob syntax with ! prefix for negation.

Replace this section:

-# Exclude certain files from review
-exclude_paths:
-  - ".agent/tmp/*"
-  - ".agent/memory/*"
-  - "*.log"
-  - "*.tmp"
+# Exclude certain files from review (under reviews section)
+  path_filters:
+    - "!.agent/tmp/**"
+    - "!.agent/memory/**"
+    - "!*.log"
+    - "!*.tmp"

Note: Move this inside the reviews: block (before line 5 or after request_changes_workflow).

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
.coderabbit.yaml lines 93-97: the file uses an invalid top-level key
`exclude_paths`; move these patterns into the `reviews:` block as `path_filters`
and convert exclusion entries to negated globs (prefix with `!`). Replace the
`exclude_paths` block with a `path_filters:` list inside `reviews:` (place
before line 5 or after `request_changes_workflow`) and change each pattern like
".agent/tmp/*" to a negated entry "! .agent/tmp/*" (and similarly for
".agent/memory/*", "*.log", "*.tmp") so the schema-recognized `path_filters`
handles exclusions correctly.

Comment on lines +100 to +108
features:
# Enable security-focused reviews
security_review: true
# Enable performance analysis
performance_review: true
# Enable best practices checking
best_practices: true
# Enable documentation review
documentation_review: true
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 | 🔴 Critical

Non-standard features section not in schema. Lines 100-108 define a features section with security_review, performance_review, etc., which don't correspond to CodeRabbit's configuration schema. These review features are controlled by the tools section and individual review settings.

Remove this section and rely on CodeRabbit's default tooling. If you need specific review features, configure them under tools (e.g., tools.semgrep, tools.gitleaks for security) or enable built-in features like pre_merge_checks. The current features block will be silently ignored.

-# Enable specific review features
-features:
-  # Enable security-focused reviews
-  security_review: true
-  # Enable performance analysis
-  performance_review: true
-  # Enable best practices checking
-  best_practices: true
-  # Enable documentation review
-  documentation_review: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
features:
# Enable security-focused reviews
security_review: true
# Enable performance analysis
performance_review: true
# Enable best practices checking
best_practices: true
# Enable documentation review
documentation_review: true
🤖 Prompt for AI Agents
.coderabbit.yaml around lines 100 to 108: the file contains a non-standard
top-level features section (security_review, performance_review, best_practices,
documentation_review) that is not part of CodeRabbit's schema and will be
ignored; remove the entire features block and instead configure desired checks
under the tools section (for example enable security scanners with tools.semgrep
or tools.gitleaks, enable performance or best-practices tooling via their
respective tool entries, or enable built-in toggles like pre_merge_checks) so
the configuration uses supported keys and has effect.

✅ COMPREHENSIVE CLI INTEGRATION:
- Added complete CodeRabbit CLI wrapper script (.agent/scripts/coderabbit-cli.sh)
- Secure API key management with local-only storage
- Full command suite: install, setup, review, analyze, status, help
- Proper error handling and user-friendly output

✅ WORKFLOW INTEGRATION:
- Integrated into quality-check.sh for comprehensive analysis
- Added to pre-commit-hook.sh for automated reviews
- Updated setup.sh with CodeRabbit CLI installation steps
- Enhanced AGENTS.md with detailed usage instructions

✅ SECURITY & BEST PRACTICES:
- API key stored securely in ~/.config/coderabbit/api_key (600 permissions)
- No API keys committed to repository (placeholder-only approach)
- Clear documentation for API key acquisition and setup
- Local-only configuration with organization-level access

✅ DOCUMENTATION UPDATES:
- Added CodeRabbit badge to README.md
- Updated quality metrics to reflect zero technical debt achievement
- Comprehensive CLI usage examples in AGENTS.md
- Integration instructions in setup workflow

✅ MULTI-PLATFORM QUALITY ASSURANCE:
- SonarCloud: Zero issues (100% resolution)
- CodeFactor: A- rating maintained
- CodeRabbit: AI-powered review integration ready
- Comprehensive quality pipeline with automated checks

🎯 ACHIEVEMENT: Complete AI-powered code review integration
🔧 TOOLS: CLI automation + secure API key management
🚀 WORKFLOW: Seamless integration into existing DevOps pipeline
🔒 SECURITY: Zero API keys in repository, local-only configuration
@marcusquinn marcusquinn merged commit 87aac74 into main Nov 9, 2025
3 of 5 checks passed
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 9, 2025

marcusquinn added a commit that referenced this pull request Dec 22, 2025
- Add yaml-language-server schema reference
- Move path_instructions under reviews (was at root level)
- Change path_filters from object to array of strings with ! prefix
- Move review_instructions to tone_instructions (correct field name)
- Add TypeScript path instructions

Addresses feedback from PR #1, #3, #5 about unrecognized properties
marcusquinn added a commit that referenced this pull request Feb 10, 2026
- Fix model priority: Nano Banana Pro (Gemini 3.0) promoted to #1 from #6
  Based on Higgsfield's own docs: native 4K, best text rendering, <10s generation
- Add REST API client for cloud.higgsfield.ai (separate credit pool from web UI)
  - apiGenerateImage(): text-to-image via API with polling and auto-download
  - apiGenerateVideo(): image-to-video via API with file upload support
  - apiUploadFile(): pre-signed URL upload for local images/videos
  - apiPollStatus(): exponential backoff polling matching Python SDK pattern
  - apiStatus(): credential validation and connectivity check
  - apiRequest(): authenticated fetch with retry on transient errors (408/429/5xx)
- Add --api flag: route image/video through REST API with Playwright fallback
- Add --api-only flag: API-only mode, fail without fallback
- Add api-status command: verify API credentials and connectivity
- Add 17 API model ID mappings (7 image, 8 video, 1 edit, 1 reference)
- Fix pre-existing syntax error: missing closing brace for batchLipsync()
- Self-tests: 78 passing (up from 44), covering all new API logic
marcusquinn added a commit that referenced this pull request Feb 10, 2026
* feat: add Higgsfield Cloud API client and fix model priority ranking

- Fix model priority: Nano Banana Pro (Gemini 3.0) promoted to #1 from #6
  Based on Higgsfield's own docs: native 4K, best text rendering, <10s generation
- Add REST API client for cloud.higgsfield.ai (separate credit pool from web UI)
  - apiGenerateImage(): text-to-image via API with polling and auto-download
  - apiGenerateVideo(): image-to-video via API with file upload support
  - apiUploadFile(): pre-signed URL upload for local images/videos
  - apiPollStatus(): exponential backoff polling matching Python SDK pattern
  - apiStatus(): credential validation and connectivity check
  - apiRequest(): authenticated fetch with retry on transient errors (408/429/5xx)
- Add --api flag: route image/video through REST API with Playwright fallback
- Add --api-only flag: API-only mode, fail without fallback
- Add api-status command: verify API credentials and connectivity
- Add 17 API model ID mappings (7 image, 8 video, 1 edit, 1 reference)
- Fix pre-existing syntax error: missing closing brace for batchLipsync()
- Self-tests: 78 passing (up from 44), covering all new API logic

* refactor: extract API helpers to reduce cyclomatic complexity

Extract shared logic from apiGenerateImage/apiGenerateVideo into:
- apiSubmitAndPoll(): submit + poll pattern
- apiDownloadImages(): image download + sidecar
- apiDownloadVideo(): video download + sidecar
- requireApiCredentials(): credential validation
- logApiPrompt(): truncated prompt logging

Addresses CodeFactor 'Complex Method' notices.
marcusquinn added a commit that referenced this pull request Feb 18, 2026
…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
marcusquinn added a commit that referenced this pull request Feb 18, 2026
…ts own failures (#1671)

* chore: regenerate MODELS.md leaderboard (t1012)

* feat: add AI self-reflection context — feed execution history to reasoning 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
marcusquinn added a commit that referenced this pull request Feb 19, 2026
…al checkpoint (t1256)

Root cause analysis of 114 Phase 0.7 recovery events (30 days):
- worker_rate_limited: 33 events (29%) — immediate re-dispatch into same rate limit
- eval_process_died: 30 events (26%) — pulse killed mid-evaluation, imprecise diagnosis
- worker_failed_before_eval: 27 events (24%) — worker crashes before evaluation
- worker_oom_killed: 12 events (11%) — OOM kills

Fixes:
1. Rate limit cooldown (t1256): Phase 0.7 now sets rate_limit_until = now+5min when
   recovering a worker_rate_limited task. cmd_next() skips tasks until cooldown expires,
   preventing immediate re-dispatch into the same rate limit. Addresses #1 root cause.
   Configurable via SUPERVISOR_RATE_LIMIT_COOLDOWN_SECONDS (default: 300s).

2. Eval checkpoint file (t1256): evaluate_with_ai() writes a checkpoint file at eval
   start, removed on completion. If the pulse is killed mid-eval, the checkpoint
   persists. _diagnose_stale_root_cause() now detects 'pulse_killed_mid_eval' vs
   the generic 'eval_process_died', enabling more precise observability.

3. DB schema: Added rate_limit_until column to tasks table (migration + schema).

4. Stale GC report: Added rate limit cooldown section showing currently deferred tasks.
marcusquinn added a commit that referenced this pull request Feb 19, 2026
…al checkpoint (t1256) (#1963)

Root cause analysis of 114 Phase 0.7 recovery events (30 days):
- worker_rate_limited: 33 events (29%) — immediate re-dispatch into same rate limit
- eval_process_died: 30 events (26%) — pulse killed mid-evaluation, imprecise diagnosis
- worker_failed_before_eval: 27 events (24%) — worker crashes before evaluation
- worker_oom_killed: 12 events (11%) — OOM kills

Fixes:
1. Rate limit cooldown (t1256): Phase 0.7 now sets rate_limit_until = now+5min when
   recovering a worker_rate_limited task. cmd_next() skips tasks until cooldown expires,
   preventing immediate re-dispatch into the same rate limit. Addresses #1 root cause.
   Configurable via SUPERVISOR_RATE_LIMIT_COOLDOWN_SECONDS (default: 300s).

2. Eval checkpoint file (t1256): evaluate_with_ai() writes a checkpoint file at eval
   start, removed on completion. If the pulse is killed mid-eval, the checkpoint
   persists. _diagnose_stale_root_cause() now detects 'pulse_killed_mid_eval' vs
   the generic 'eval_process_died', enabling more precise observability.

3. DB schema: Added rate_limit_until column to tasks table (migration + schema).

4. Stale GC report: Added rate limit cooldown section showing currently deferred tasks.
marcusquinn added a commit that referenced this pull request Feb 19, 2026
…t1258)

Three bugs causing 100% of tasks to route through Phase 0.7 stale recovery
instead of completing normally:

1. Check ordering bug: worker_failed_before_eval fired BEFORE the heartbeat
   check in _diagnose_stale_root_cause(). Tasks actively evaluating (heartbeat
   fresh) were incorrectly recovered if their log contained WORKER_FAILED from
   a previous retry's REPROMPT METADATA header. Fix: move heartbeat check first.

2. Wrong log file for ai_eval_timeout: the check searched the worker log for
   'evaluate_with_ai' — a supervisor function that never appears in worker logs.
   This check never matched, masking ai_eval_timeout diagnoses. Fix: search the
   supervisor log (SUPERVISOR_LOG) instead, scoped to the task ID.

3. Log tail scope for worker_failed_before_eval: full-log grep caused false
   positives from REPROMPT METADATA headers embedding previous failure content.
   Fix: only check last 20 lines (actual execution status, not embedded history).

4. Phase 0.7 recovery routing: running tasks with a PR URL were re-queued
   unnecessarily (e.g., worker_oom_killed after creating PR). Fix: extend the
   evaluating+PR fast-path to all states — any stale task with a PR routes to
   pr_review regardless of whether it was in running or evaluating state.

Root cause data (last 2 days, 124 events):
  worker_rate_limited:     38 (30.6%) — rate limit cooldown already handles
  eval_process_died:       30 (24.2%) — fix #1 prevents false recoveries
  worker_failed_before_eval: 30 (24.2%) — fix #1+#3 prevent false positives
  worker_oom_killed:       13 (10.5%) — fix #4 routes to pr_review when PR exists
  pulse_killed_after_pr_persist: 8 (6.5%) — already handled by fast-path
  ai_eval_timeout:          3 (2.4%) — fix #2 enables correct diagnosis
marcusquinn added a commit that referenced this pull request Feb 19, 2026
…t1258) (#1966)

Three bugs causing 100% of tasks to route through Phase 0.7 stale recovery
instead of completing normally:

1. Check ordering bug: worker_failed_before_eval fired BEFORE the heartbeat
   check in _diagnose_stale_root_cause(). Tasks actively evaluating (heartbeat
   fresh) were incorrectly recovered if their log contained WORKER_FAILED from
   a previous retry's REPROMPT METADATA header. Fix: move heartbeat check first.

2. Wrong log file for ai_eval_timeout: the check searched the worker log for
   'evaluate_with_ai' — a supervisor function that never appears in worker logs.
   This check never matched, masking ai_eval_timeout diagnoses. Fix: search the
   supervisor log (SUPERVISOR_LOG) instead, scoped to the task ID.

3. Log tail scope for worker_failed_before_eval: full-log grep caused false
   positives from REPROMPT METADATA headers embedding previous failure content.
   Fix: only check last 20 lines (actual execution status, not embedded history).

4. Phase 0.7 recovery routing: running tasks with a PR URL were re-queued
   unnecessarily (e.g., worker_oom_killed after creating PR). Fix: extend the
   evaluating+PR fast-path to all states — any stale task with a PR routes to
   pr_review regardless of whether it was in running or evaluating state.

Root cause data (last 2 days, 124 events):
  worker_rate_limited:     38 (30.6%) — rate limit cooldown already handles
  eval_process_died:       30 (24.2%) — fix #1 prevents false recoveries
  worker_failed_before_eval: 30 (24.2%) — fix #1+#3 prevent false positives
  worker_oom_killed:       13 (10.5%) — fix #4 routes to pr_review when PR exists
  pulse_killed_after_pr_persist: 8 (6.5%) — already handled by fast-path
  ai_eval_timeout:          3 (2.4%) — fix #2 enables correct diagnosis
@marcusquinn marcusquinn added the needs-review Flagged for human review by AI supervisor label Feb 22, 2026
@marcusquinn
Copy link
Owner Author

Flagged for Human Review

Reason: t011 (Evaluate Tambo AI generative UI SDK) has ~8h estimate with no subtasks and is not registered in supervisor DB (cross-repo collision risk). Needs manual DB registration before subtasking, or manual breakdown by @marcus. Cannot safely create_subtasks without DB entry.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

@marcusquinn
Copy link
Owner Author

marcusquinn commented Feb 22, 2026

Flagged for Human Review

Reason: a managed private repo t011 (Evaluate Tambo AI generative UI SDK) has ~8h estimate with no subtasks and is not registered in supervisor DB — cannot safely create subtasks due to cross-repo collision risk. Human should either: (1) register t011 in supervisor DB via claim-task-id.sh, then break into subtasks, or (2) manually add subtasks to a managed private repo TODO.md with safe IDs.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

@marcusquinn
Copy link
Owner Author

marcusquinn commented Feb 22, 2026

Flagged for Human Review

Reason: t011 (a managed private repo) has ~8h estimate exceeding auto-dispatch threshold but is marked 'not-in-db' — cannot safely create subtasks due to cross-repo collision risk. Human needs to register this task in supervisor DB before it can be broken down and dispatched.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

@marcusquinn
Copy link
Owner Author

marcusquinn commented Feb 22, 2026

Flagged for Human Review

Reason: t011 (a managed private repo) has ~8h estimate with no subtasks and is flagged 'not-in-db' — cannot safely create subtasks due to cross-repo collision risk. Needs manual registration in supervisor DB before it can be broken down and dispatched.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

@marcusquinn
Copy link
Owner Author

Flagged for Human Review

Reason: t1311 has malformed blocked-by field (blocked-by:`) — dependency cannot be resolved. Needs manual correction in TODO.md to either remove the blocker or specify the correct task ID.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

@marcusquinn
Copy link
Owner Author

marcusquinn commented Feb 22, 2026

Flagged for Human Review

Reason: a managed private repo t011 (Evaluate Tambo AI generative UI SDK) has estimate >4h and needs subtasking, but is flagged as 'not-in-db: task not registered in supervisor DB — cannot create subtasks safely (cross-repo collision risk)'. Human needs to register this task in the supervisor DB before it can be broken down and dispatched. Current estimate is ~8h with no subtasks.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

@marcusquinn
Copy link
Owner Author

marcusquinn commented Feb 23, 2026

Flagged for Human Review

Reason: a managed private repo t011 (Evaluate Tambo AI generative UI SDK) needs subtasking (~8h estimate, no subtasks) but is flagged as not-in-db with cross-repo collision risk. Human action needed: register t011 in supervisor DB for a managed private repo repo before subtasks can be safely created. After registration, break into 2-3 subtasks (~2-4h each) for auto-dispatch.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

@marcusquinn
Copy link
Owner Author

Flagged for Human Review

Reason: Task t1311 has a malformed blocked-by dependency (blocked-by:` — literal backtick). This prevents dispatch despite being marked eligible. A human should edit TODO.md to either remove the invalid blocker or set the correct dependency.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

@marcusquinn
Copy link
Owner Author

Flagged for Human Review

Reason: 4 medium-severity audit findings (3 closed_issue_audit + 1 orphan_pr_audit) need human review. The audit details are not included in the snapshot, so the specific issues/PRs cannot be identified programmatically. Run code-audit-helper.sh report to see full details and determine if any require action.

This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action.


Flagged by AI Supervisor (automated reasoning cycle)

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

Labels

needs-review Flagged for human review by AI supervisor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant