Skip to content

feat(ai): add Google Gemini provider + improved error handling#166

Open
sivaangayarkanni wants to merge 2 commits into
optiqor:mainfrom
sivaangayarkanni:feat/gemini-provider-error-handling
Open

feat(ai): add Google Gemini provider + improved error handling#166
sivaangayarkanni wants to merge 2 commits into
optiqor:mainfrom
sivaangayarkanni:feat/gemini-provider-error-handling

Conversation

@sivaangayarkanni
Copy link
Copy Markdown

@sivaangayarkanni sivaangayarkanni commented Jun 2, 2026

What

Added Google Gemini as a new AI provider, introduced 3 new AI correlation patterns, and improved error handling with a structured LoadError type and helper functions.

Why

  • Users wanted native support for Google Gemini.
  • Current error messages when eBPF fails to load are not helpful.
  • AI analysis was missing useful cross-signal correlations.

Fixes #165

How

  • Added gemini.go and gemini_test.go with pure HTTP integration (no SDK).
  • Extended AI fallback logic in fallback.go with 3 new correlation patterns.
  • Created errors.go with LoadError type + helper functions (IsPermissionError, IsBTFError, IsVerifierError).
  • All changes include full test coverage and follow existing project style.

Testing

  • go build ./... passes
  • go test ./... passes
  • go vet ./... passes
  • golangci-lint run ./... passes
  • Tested locally with: sudo ./bin/kerno doctor --ai
  • N/A — pure docs/refactor
  • sudo ./bin/bpf-verify --read 5s confirms 6/6 programs still load
  • ./scripts/verify.sh passes (or specific phase: ./scripts/verify.sh quality)

Checklist

  • PR title follows Conventional Commits (feat(ai): add Google Gemini provider + improved error handling)
  • All commits are DCO-signed (git commit -s)
  • No unrelated changes pulled in
  • Documentation updated where user-visible behavior changed
  • Added/updated tests for new code paths
  • If a new doctor rule, paired with a chaos scenario in scripts/verify.sh

Add complete Google Gemini API integration as a new LLM provider:
- Implement GeminiProvider with HTTP-based API client
- Add comprehensive test suite with 7 test cases
- Update provider factory to support gemini provider
- Support configurable model, temperature, and max tokens
- Default to gemini-1.5-flash model

feat(bpf): add enhanced error handling with contextual hints

Add LoadError type and classification utilities:
- WrapLoadError() for enriching errors with context
- classifyLoadError() with 11+ error pattern mappings
- Helper functions: IsPermissionError, IsBTFError, IsVerifierError
- Actionable user-facing fix hints for common BPF load failures
- Complete test coverage with 20+ test cases

feat(ai): enhance correlation analysis with new patterns

Add 3 new correlation patterns to fallback analyzer:
- Memory + cgroup memory detection
- Scheduler + syscall correlation
- TCP + memory buffer exhaustion detection

Signed-off-by: Sivaangayarkanni <siva.21.baba@gmail.com>
@github-actions github-actions Bot added level:critical Touches BPF, security, or release surfaces (auto-applied) documentation Improvements or additions to documentation testing Tests and test coverage area/bpf eBPF programs and loaders area/integrations External integrations (sinks, exports, CI) labels Jun 2, 2026
@sivaangayarkanni sivaangayarkanni force-pushed the feat/gemini-provider-error-handling branch from 1abef82 to 37702d6 Compare June 2, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/bpf eBPF programs and loaders area/integrations External integrations (sinks, exports, CI) documentation Improvements or additions to documentation level:critical Touches BPF, security, or release surfaces (auto-applied) testing Tests and test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add Google Gemini AI provider + enhanced error handling + new correlation patterns

1 participant