Skip to content

feat: AI-powered build failure diagnosis system for deployment - #47

Draft
Lftobs wants to merge 2 commits into
devfrom
feat/ai-build-fix
Draft

Lftobs wants to merge 2 commits into
devfrom
feat/ai-build-fix

Conversation

@Lftobs

@Lftobs Lftobs commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Description

This pull request introduces a comprehensive AI-powered build failure diagnosis system for deployment logs, supporting multiple providers (OpenAI, Gemini, Grok, Claude). It adds core logic for extracting error context from logs, provider-agnostic diagnosis orchestration, and provider-specific HTTP clients. The implementation is covered by detailed tests.

The most important changes are:

AI Diagnosis Core Logic:

  • Implements the diagnoseDeploymentFailure function, which orchestrates log retrieval, error context extraction, provider selection, AI call, response parsing, and diagnosis persistence. The logic is provider-agnostic and supports custom prompts and models.
  • Adds resolveProviderConfig to select the AI provider, model, and API key from user input, settings, or environment, with robust error handling.

Provider Integrations:

  • Introduces provider-specific HTTP clients: callOpenAi, callGemini, callGrok, and callClaude, each handling request/response formats and error handling for their respective APIs. [1] [2] [3] [4]

Log Error Context Extraction:

  • Implements extractBuildErrorContext to clean, filter, and summarize deployment logs, stripping ANSI codes and focusing on relevant error lines for LLM input.

Testing:

  • Adds a comprehensive test suite in ai.test.ts covering log extraction, provider config resolution, all provider clients, connection testing, and diagnosis parsing.

Exports and Types:

  • Re-exports all relevant AI module functions and types from a central index for easy consumption.

These changes lay the foundation for robust, multi-provider AI-driven build failure analysis in the deployment platform.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • CI / Build / Tooling
  • Other (please describe):

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • Existing tests pass (bun test in apps/api/)
  • New tests added (if applicable)
  • Manual testing performed (describe steps)

Checklist

  • My code follows the project's code style (no comments, named exports, functional components, etc.)
  • I have read the contributing guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the documentation (if applicable)
  • My changes generate no new warnings or lint errors
  • I have run bun test in apps/api/ and all tests pass
  • I have synced the VERSION file if needed (bun run sync-versions)

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

@Lftobs Lftobs changed the title Add multi-provider build failure diagnosis and resolution assistant feat: AI-powered build failure diagnosis system for deployment Sep 12, 2026
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