Skip to content

fix(triage): add llm config to simili.yaml and relax validation#96

Merged
Kavirubc merged 1 commit intomainfrom
fix/triage-llm-config-validation
Mar 5, 2026
Merged

fix(triage): add llm config to simili.yaml and relax validation#96
Kavirubc merged 1 commit intomainfrom
fix/triage-llm-config-validation

Conversation

@Kavirubc
Copy link
Copy Markdown
Contributor

@Kavirubc Kavirubc commented Mar 5, 2026

Summary

  • Added llm: block to .github/simili.yaml so the repo's own config passes validation (previously the missing llm.api_key caused Validate() to discard the entire config, leaving qdrant.collection empty and breaking Qdrant requests)
  • Removed llm.api_key from the required-fields list in Validate() — the process command already falls back to embedding.api_key when llm.api_key is unset, so failing hard here was causing more harm than good
  • Updated tests to reflect the new behaviour: missing llm.api_key is now a valid config, and TestLoadWithInheritanceValidatesMergedConfig now asserts on qdrant.collection (the actual required field) instead

Root cause

The E2E tests seed their own config with a full llm: block, so they never hit this path. The repo's own simili.yaml had no llm: section, causing Validate() to fail → config discarded → qdrant.collection = "" → Qdrant rejected requests.

Test plan

  • go test ./internal/core/config/... — all 9 tests pass
  • Confirm simili.yaml now contains an llm: block with ${GEMINI_API_KEY}

Summary by CodeRabbit

  • New Features

    • Added Gemini LLM provider support with configurable API key and model selection
  • Configuration

    • LLM API key is now optional and falls back to the embedding API key when not provided
    • Configuration validation now prioritizes qdrant collection and embedding API key presence instead of requiring the LLM API key

@Kavirubc Kavirubc requested a review from Copilot March 5, 2026 03:45
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 49f30842-bab2-446f-928b-96bf8c73b31a

📥 Commits

Reviewing files that changed from the base of the PR and between 03fe006 and ddaf496.

📒 Files selected for processing (3)
  • .github/simili.yaml
  • internal/core/config/config.go
  • internal/core/config/config_test.go

📝 Walkthrough

Walkthrough

LLM API key is made optional by removing llm.api_key from required validation; config validation now relies on qdrant.collection and embedding.api_key. Tests and a CI config file adding a Gemini LLM block were updated accordingly.

Changes

Cohort / File(s) Summary
CI / Repo config
/.github/simili.yaml
Added an llm configuration block specifying Gemini provider, API key placeholder, and gemini-2.5-flash model.
Validation Logic
internal/core/config/config.go
Removed llm.api_key from required validation fields and added explanatory note about fallback to embedding.api_key; updated file timestamp.
Tests
internal/core/config/config_test.go
Adjusted tests to treat llm.api_key as optional, updated environment-based and inheritance tests to expect qdrant.collection/embedding.api_key validation errors instead.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hopping through config, a small change I sing,
Keys no longer required — let embedders bring.
Gemini waits in the YAML light,
Optional and ready, cozy and bright.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding LLM config to simili.yaml and relaxing validation requirements for llm.api_key.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/triage-llm-config-validation

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.

@gh-simili-bot
Copy link
Copy Markdown
Contributor

Simili Triage Report

Note

Quality Score: 8.5/10 (Good)
The issue could be improved. See suggestions below.

Classification

Category Value
Labels
Quality Improvements
  • Missing explicit error logs
  • No environment details
  • Include exact error messages/logs from the validation failure
  • Specify operating system and relevant software versions (e.g., Go version)
Similar Threads
Similarity Type Thread Status
86% 🔀 #44 feat: add LLM configuration to YAML config (#37)
85% 🔀 #44 Similar Issue
82% 📝 #52 [UX]: Add Configuration Validation for Environm... Open

Generated by Simili Bot

Root cause: triage was broken in the main repo because .github/simili.yaml
had no `llm:` section. Config validation required llm.api_key, so the entire
config was discarded and replaced with an empty struct — zeroing out
qdrant.collection and causing Qdrant to reject the empty collection name.

Two-part fix:
- .github/simili.yaml: add explicit `llm:` section reusing GEMINI_API_KEY
- config.Validate(): remove llm.api_key from required fields, since the
  process command already falls back to embedding.api_key when it is unset.
  Strict validation was silently discarding a valid config instead of
  gracefully degrading.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
@Kavirubc Kavirubc force-pushed the fix/triage-llm-config-validation branch from 03fe006 to ddaf496 Compare March 5, 2026 03:48
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
internal/core/config/config_test.go (1)

181-189: no llm api key is still valid case is currently redundant.

baseConfig already has an empty LLM.APIKey, so this case duplicates the existing "all valid" behavior. Consider either removing it or making "all valid" include a non-empty LLM key so this case adds unique coverage.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/core/config/config_test.go` around lines 181 - 189, The test case
named "no llm api key is still valid" is redundant because baseConfig already
has LLM.APIKey == "", so either remove that test case or make the suite cover
the intended difference: update baseConfig to set a non-empty LLM.APIKey and
change the "all valid" case to use that non-empty key, leaving the "no llm api
key is still valid" case to explicitly set cfg.LLM.APIKey = "" (referencing
baseConfig, Config, and LLM.APIKey and the test case names "all valid" and "no
llm api key is still valid"); pick one approach and adjust the test cases
accordingly to ensure unique coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@internal/core/config/config_test.go`:
- Around line 181-189: The test case named "no llm api key is still valid" is
redundant because baseConfig already has LLM.APIKey == "", so either remove that
test case or make the suite cover the intended difference: update baseConfig to
set a non-empty LLM.APIKey and change the "all valid" case to use that non-empty
key, leaving the "no llm api key is still valid" case to explicitly set
cfg.LLM.APIKey = "" (referencing baseConfig, Config, and LLM.APIKey and the test
case names "all valid" and "no llm api key is still valid"); pick one approach
and adjust the test cases accordingly to ensure unique coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1593507e-6a89-46f3-81fd-fcb9afbd0da0

📥 Commits

Reviewing files that changed from the base of the PR and between fb6f9d4 and 03fe006.

📒 Files selected for processing (3)
  • .github/simili.yaml
  • internal/core/config/config.go
  • internal/core/config/config_test.go

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Simili’s configuration validation and repo-default config so missing llm.api_key no longer causes config loading to fail (and downstream Qdrant requests to break due to empty qdrant.collection when callers fall back to an empty config).

Changes:

  • Added an llm: block to .github/simili.yaml to ensure the repo’s own config passes validation.
  • Relaxed Config.Validate() by removing llm.api_key from required fields (relying on existing fallback behavior).
  • Updated config unit tests to reflect llm.api_key being optional and to assert on qdrant.collection as the required merged field.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/core/config/config.go Makes llm.api_key optional during config validation and documents rationale.
internal/core/config/config_test.go Adjusts validation/load tests for optional llm.api_key and merged-config validation expectations.
.github/simili.yaml Adds llm configuration so the repo’s own config validates successfully.
Comments suppressed due to low confidence (1)

internal/core/config/config_test.go:186

  • The new test case "no llm api key is still valid" doesn't currently add coverage because baseConfig no longer sets LLM.APIKey, so the preceding "all valid" case already exercises the "missing llm.api_key" path. Consider either restoring a non-empty LLM.APIKey in baseConfig (and keeping this test to prove optionality), or removing this case to avoid redundant coverage.
			// llm.api_key is optional — process command falls back to embedding.api_key.
			name: "no llm api key is still valid",
			cfg: func() Config {
				cfg := baseConfig
				cfg.LLM.APIKey = ""

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -219,7 +222,6 @@ func (c *Config) Validate() error {
{name: "qdrant.api_key", envVar: "QDRANT_API_KEY", value: c.Qdrant.APIKey},
{name: "qdrant.collection", envVar: "QDRANT_COLLECTION", value: c.Qdrant.Collection},
{name: "embedding.api_key", envVar: "EMBEDDING_API_KEY", value: c.Embedding.APIKey},
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

Validate() currently reports missing embedding.api_key as "check EMBEDDING_API_KEY", but this repo appears to standardize on GEMINI_API_KEY/OPENAI_API_KEY (and .github/simili.yaml uses GEMINI_API_KEY). This makes the validation error message misleading; consider updating the env-var hint (or the validation strategy) to match the actual supported env keys.

Suggested change
{name: "embedding.api_key", envVar: "EMBEDDING_API_KEY", value: c.Embedding.APIKey},
{name: "embedding.api_key", envVar: "GEMINI_API_KEY or OPENAI_API_KEY", value: c.Embedding.APIKey},

Copilot uses AI. Check for mistakes.
@Kavirubc Kavirubc merged commit f63d0ef into main Mar 5, 2026
4 of 5 checks passed
@Kavirubc Kavirubc deleted the fix/triage-llm-config-validation branch March 5, 2026 03:50
@github-project-automation github-project-automation Bot moved this from Todo to Done in simili-bot-v1-release Mar 5, 2026
@Kavirubc Kavirubc linked an issue Mar 5, 2026 that may be closed by this pull request
2 tasks
@gh-simili-bot
Copy link
Copy Markdown
Contributor

🧪 E2E Test

Bot responded: yes

| Auto-closer (dry-run) | processed: 0 closed: 0 grace: 0 human: 0 |

Test repo → gh-simili-bot/simili-e2e-22701300627
Run → logs

Auto-generated by E2E pipeline

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

Labels

bug Something isn't working e2e

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

[Bug]: Triage failing

3 participants