AI Build Troubleshooter
Relevant source files
The following files were used as context for generating this wiki page:
The AI Build Troubleshooter scans kernel compilation logs to identify GKI/KMI compatibility issues, failed patch hooks, and missing dependencies. It serves as an integrated diagnostic tool within the KernelForge dashboard to reduce debugging time for Android kernel developers.
Sources: README.md:12-14, src/components/dashboard/AITroubleshooter.tsx:47-48
System Architecture
The troubleshooter functions as a Genkit-powered AI flow integrated into a React frontend. While the production application exports as a static Android APK, the system includes a mock assistant for local execution without a backend server.
Component Logic
The UI component AITroubleshooter receives build logs as a string prop. It manages the analysis state and displays structured results containing a summary, identified errors, and suggested solutions.
Sources: src/components/dashboard/AITroubleshooter.tsx:10-28, src/ai/flows/ai-build-troubleshooting-assistant.ts:1-5
Data Flow
The diagram above illustrates the data flow from log generation to structured AI feedback.
Sources: src/components/dashboard/AITroubleshooter.tsx:18-35, src/ai/flows/ai-build-troubleshooting-assistant.ts:25-30
Implementation Details
Data Structures
The system uses specific TypeScript types and schemas to ensure consistent communication between the frontend and the AI flow.
| Data Type | Field | Type | Description |
|---|---|---|---|
| Input | buildLog | string | The raw text output from the kernel compilation process. |
| Input | deviceInfo | object | Optional metadata including model, codename, and GKI/KMI versions. |
| Output | summary | string | A high-level overview of the build status or identified issues. |
| Output | identifiedErrors | string[] | A list of specific error strings extracted from the logs. |
| Output | suggestedSolutions | string[] | Actionable steps to resolve the identified build failures. |
Sources: src/ai/flows/ai-build-troubleshooting-assistant.ts:7-23
AI Configuration
The project utilizes Google GenAI via Genkit for its intelligence layer. In a non-mocked environment, it targets the gemini-2.5-flash model.
// Example Genkit Configuration
import {genkit} from 'genkit';
import {googleAI} from '@genkit-ai/google-genai';
export const ai = genkit({
plugins: [googleAI()],
model: 'googleai/gemini-2.5-flash',
});
Sources: src/ai/genkit.ts:1-7, src/ai/dev.ts:1-4
Execution Environment
The application behavior changes based on the deployment mode:
- Static/Android APK Mode: The
aiBuildTroubleshootingAssistantfunction returns a mock response. It informs the user that a remote AI endpoint is required for analysis within the APK. - Development Mode: The system can be started using Genkit CLI commands (
npm run genkit:dev) to test flows against live AI models.
Sources: src/ai/flows/ai-build-troubleshooting-assistant.ts:32-47, package.json:7-8
Sequence Diagram
This sequence diagram shows the interaction between the React component and the underlying Genkit flow.
Sources: src/components/dashboard/AITroubleshooter.tsx:18-28, src/ai/flows/ai-build-troubleshooting-assistant.ts:32-40
Conclusion
The AI Build Troubleshooter provides a structured interface for diagnosing kernel compilation failures. By translating raw terminal output into human-readable summaries and actionable solutions, it bridges the gap between complex log data and successful kernel deployment.