Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,19 @@

- [ ] Integrate [Strix](https://github.com/usestrix/strix) - **Requires human supervision**
- [ ] Re-init Postgres API key due to potential leak

## Code Quality

### High Priority

- [ ] Broad exception handling in `src/utils/logging_config.py:64` - catches all exceptions indiscriminately
- [ ] Validator anti-pattern in `common/global_config.py:188-198` - validators ignore input parameter `v`
- [ ] Circular import risk in `common/flags.py:6-7` - `setup_logging()` called at import time
- [ ] Broad exceptions in `utils/llm/dspy_langfuse.py:280,321,438` - catches generic `Exception`
- [ ] Unsafe exception re-instantiation in `src/utils/logging_config.py:61-71` - reconstructs exceptions unsafely

### Medium Priority

- [ ] Type ignore comments in `utils/llm/dspy_langfuse.py` - indicates type system gaps
- [ ] Limited test coverage for `init/`, `utils/llm/` directories
- [ ] Feature flag not checked in all fallback paths
20 changes: 13 additions & 7 deletions common/global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ class Config(BaseSettings):
logging: LoggingConfig
features: FeaturesConfig = Field(default_factory=lambda: FeaturesConfig())

# Environment variables (required)
# Environment variables
DEV_ENV: str
OPENAI_API_KEY: str
ANTHROPIC_API_KEY: str
GROQ_API_KEY: str
PERPLEXITY_API_KEY: str
GEMINI_API_KEY: str
OPENAI_API_KEY: str | None = None
ANTHROPIC_API_KEY: str | None = None
GROQ_API_KEY: str | None = None
PERPLEXITY_API_KEY: str | None = None
GEMINI_API_KEY: str | None = None

# Runtime environment (computed)
is_local: bool = Field(default=False)
Expand Down Expand Up @@ -252,7 +252,13 @@ def llm_api_key(self, model_name: str | None = None) -> str:
"gemini": self.GEMINI_API_KEY,
}
if provider in api_keys:
return api_keys[provider]
key = api_keys[provider]
if key is None:
raise ValueError(
f"API key for provider '{provider}' is not configured. "
f"Set {provider.upper()}_API_KEY in your .env file."
Comment on lines +258 to +259
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Error message inconsistency - this uses {provider.upper()}_API_KEY format, but actual env var names vary (e.g. OPENAI_API_KEY not openai_API_KEY). Suggestion uses the correct uppercase format.

Suggested change
f"API key for provider '{provider}' is not configured. "
f"Set {provider.upper()}_API_KEY in your .env file."
f"Set {provider.upper()}_API_KEY in your .env file."
Prompt To Fix With AI
This is a comment left during a code review.
Path: common/global_config.py
Line: 258:259

Comment:
Error message inconsistency - this uses `{provider.upper()}_API_KEY` format, but actual env var names vary (e.g. `OPENAI_API_KEY` not `openai_API_KEY`). Suggestion uses the correct uppercase format.

```suggestion
                    f"Set {provider.upper()}_API_KEY in your .env file."
```

How can I resolve this? If you propose a fix, please make it concise.

)
return key
raise ValueError(f"No API key configured for model: {model_identifier}")


Expand Down
Loading