~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: Remove duplicate default settings handling from API
LearningCircuitd7fd0178fcc5
diff --git a/djpetti_review_status_report.md b/djpetti_review_status_report.mdnew file mode 100644index 0000000000..d9b458fb0f--- /dev/null+++ b/djpetti_review_status_report.md@@ -0,0 +1,188 @@+# djpetti Review Comments Status Report++## Overview+This report analyzes djpetti's review comments on PR #578 and indicates which have been addressed by recent commits.++## Comment Status++### ✅ RESOLVED Comments (Already addressed in commits)++1. **docker-compose.yml:36** - "A corresponding change should probably be made in the `cookiecutter` template."+ - **Status**: RESOLVED in commit 99583ce+ - **Resolution**: Update cookiecutter template to match docker-compose.yml changes++2. **docs/DATA_MIGRATION_GUIDE.md:23** - "This is not actually true for the upcoming release. Should we maybe add a note here?"+ - **Status**: RESOLVED in commit 38c6cab+ - **Resolution**: Add note about v1.0 not supporting database migration++3. **src/local_deep_research/config/llm_config.py** - "Should pass `settings_snapshot` here."+ - **Status**: RESOLVED in commit f3fe737+ - **Resolution**: Pass settings_snapshot to get_llm in search_system.py++4. **src/local_deep_research/database/thread_local_session.py:27** - "Maybe this should be named `get_metrics_session`"+ - **Status**: RESOLVED in commit 108f4c5+ - **Resolution**: Rename get_thread_session to get_metrics_session for clarity++5. **src/local_deep_research/database/models/queue.py** - "There was never any `service.db`?"+ - **Status**: RESOLVED in commit 75f024d+ - **Resolution**: Simplify queue.py docstring and remove service.db reference++6. **src/local_deep_research/database/models.py** - "Isn't this a duplicate of a model in `logs.py`?"+ - **Status**: RESOLVED in commit 2205efb+ - **Resolution**: Remove deprecated Log table as it was never used++7. **src/local_deep_research/database/models/active_research.py:1** - "Is there a reason this isn't in `models.py`?"+ - **Status**: RESOLVED in commit f8352e4+ - **Resolution**: Add explanation for ActiveResearch model location++8. **src/local_deep_research/setup_data_dir.py:1** - "Is this file still necessary?"+ - **Status**: RESOLVED in commit c88b3aa+ - **Resolution**: Remove deprecated setup_data_dir.py file++9. **src/local_deep_research/storage/factory.py** - "Should this maybe be a full-on setting instead of just an environment variable?"+ - **Status**: RESOLVED in commit 47070a1+ - **Resolution**: Convert report storage from env var to proper setting++10. **src/local_deep_research/memory_cache/app_integration.py** - "Wait, are we using Redis? This seems questionable."+ - **Status**: RESOLVED in commit 460ad69+ - **Resolution**: Fix misleading Redis references in cache documentation++### ❌ UNRESOLVED Comments (Need to be addressed)++#### Code Quality Issues++1. **Multiple files** - "`logger.exception`" comments+ - Files affected:+ - examples/optimization/update_llm_config.py+ - src/local_deep_research/advanced_search_system/candidate_exploration/progressive_explorer.py+ - src/local_deep_research/advanced_search_system/knowledge/standard_knowledge.py+ - src/local_deep_research/advanced_search_system/strategies/focused_iteration_strategy.py+ - src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py+ - src/local_deep_research/benchmarks/efficiency/resource_monitor.py+ - src/local_deep_research/benchmarks/evaluators/browsecomp.py+ - src/local_deep_research/benchmarks/evaluators/composite.py+ - src/local_deep_research/benchmarks/metrics/calculation.py+ - src/local_deep_research/config/llm_config.py+ - src/local_deep_research/database/encrypted_db.py+ - src/local_deep_research/memory_cache/invalidation.py:117+ - src/local_deep_research/metrics/token_counter.py:388, 1212+ - src/local_deep_research/storage/database.py:65+ - src/local_deep_research/utilities/es_utils.py:69+ - src/local_deep_research/web/api.py:411+ - **Action needed**: Replace generic exception logging with logger.exception++2. **examples/api_usage/UPGRADE_NOTICE.md** - "v1.0"+ - **Action needed**: Update version reference to v1.0++#### Debug Scripts++3. **scripts/audit_sqlcipher_usage.py:1** - "Does this need to be committed, or was it just used for debugging?"+ - **Action needed**: Determine if script should be removed or kept++4. **scripts/debug_db_open.py:1** - "Does this need to be committed, or was it just used for debugging?"+ - **Action needed**: Determine if script should be removed or kept++#### Architecture/Design Issues++5. **src/local_deep_research/api/settings_utils.py:18** - Type handling logic concern+ - **Comment**: "One of the things that concerns me with this is that it doesn't have the proper type-handling logic that the normal `SettingsManager` does..."+ - **Action needed**: Move type handling to base class or let djpetti handle++6. **src/local_deep_research/config/paths.py** - DB migration functions+ - **Comment**: "Since we're not supporting DB migration anyway, maybe we should just get rid of these functions."+ - **Action needed**: Remove DB migration functions++7. **src/local_deep_research/config/search_config.py** - Duplicated function+ - **Comment**: "This function seems to be duplicated. Maybe it should be broken out and shared."+ - **Action needed**: Extract and share duplicated function++8. **src/local_deep_research/database/encrypted_db.py** - Unnecessary type conversion+ - **Comment**: "This shouldn't be necessary. `SettingsManager` should do it."+ - **Action needed**: Remove unnecessary type conversion++9. **src/local_deep_research/database/models/** - Model organization issues+ - Multiple comments about duplicate models and organization+ - **Action needed**: Consolidate models and remove duplicates++10. **src/local_deep_research/database/queue_service.py:14** - Duplicate queue implementation+ - **Comment**: "This seems very similar to `InMemoryQueue`. Are two separate queues really necessary?"+ - **Action needed**: Consider consolidating queue implementations++11. **src/local_deep_research/database/temp_auth.py:14** - Redundant implementation+ - **Comment**: "Couldn't the same functionality be achieved with `SessionPasswordStore`?"+ - **Action needed**: Use SessionPasswordStore instead++#### Cache/Memory Issues++12. **src/local_deep_research/memory_cache/cached_services.py:16** - Settings caching concern+ - **Comment**: "Can we not? We had so many bugs related to settings caching the last time around."+ - **Action needed**: Remove settings caching++13. **src/local_deep_research/memory_cache/config.py:50** - Disk storage for in-memory cache+ - **Comment**: "Is there any reason we have to store this on the disk at all?"+ - **Action needed**: Consider removing disk persistence for memory cache++14. **src/local_deep_research/memory_cache/config.py:169** - Two-tier cache complexity+ - **Comment**: "I still think this is more complicated than it needs to be."+ - **Action needed**: Simplify to single-tier in-memory cache++15. **src/local_deep_research/memory_cache/warmup.py:18** - Cache warmup necessity+ - **Comment**: "I feel like this should be unnecessary for in-memory caches."+ - **Action needed**: Consider removing cache warmup++16. **src/local_deep_research/settings/manager.py:78** - Settings caching+ - **Comment**: "I still think we're better off without caching here."+ - **Action needed**: Remove settings caching++#### Storage/Utility Issues++17. **src/local_deep_research/storage/file.py:1** - File-based storage deprecation+ - **Comment**: "Do we maybe want to deprecate file-based storage entirely?"+ - **Action needed**: Consider deprecating file-based storage++18. **src/local_deep_research/utilities/db_utils.py:20, 147** - Deprecated DB utilities+ - **Comment**: "Should this be removed completely and replaced with the encrypted database manager's session creator methods?"+ - **Action needed**: Remove and use encrypted DB manager methods++19. **src/local_deep_research/utilities/log_utils.py:236** - atexit handler+ - **Comment**: "We might want an `atexit` handler in the main thread that calls this function"+ - **Action needed**: Add atexit handler for log flushing++20. **src/local_deep_research/utilities/log_utils.py:184** - File output disabled+ - **Comment**: "Wait, why are we bothering to have a `_LOG-DIR` if we're disabling file output?"+ - **Action needed**: Keep file output enabled++21. **src/local_deep_research/utilities/search_cache.py:167, 222** - JSON column suggestion+ - **Comment**: "Maybe use a JSON column for this so you don't have to explicitly call `json.loads` and `json.dumps`?"+ - **Action needed**: Use JSON column type++22. **src/local_deep_research/utilities/search_cache.py:309** - Context manager suggestion+ - **Comment**: "Not a big issue, but in the future, it would probably be cleaner to just use a context manager."+ - **Action needed**: Consider using context manager in future++#### Web/API Issues++23. **src/local_deep_research/web/api.py:296** - Default settings handling+ - **Comment**: "I don't really like default settings being handled in two different places."+ - **Action needed**: Remove duplicate default settings handling++24. **src/local_deep_research/web/app.py:23** - Settings framework usage+ - **Comment**: "Why not use the settings framework? This implementation won't work if the user sets them through the web UI"+ - **Action needed**: Use settings framework instead of env vars++25. **src/local_deep_research/web/auth/routes.py:74** - DB version check logic+ - **Comment**: "The correct logic here is not just to check if settings are present, but to check if the app version stored in the DB matches..."+ - **Action needed**: Implement proper DB version checking++## Summary++- **Total Comments**: 62+- **Resolved**: 10+- **Unresolved**: 52++### Priority Issues to Address:+1. Replace all generic exception logging with `logger.exception`+2. Fix settings caching issues (multiple comments about removing caching)+3. Consolidate duplicate models and queue implementations+4. Implement proper DB version checking in auth routes+5. Use settings framework consistently instead of environment variablesdiff --git a/search_cache_context_manager_issue.md b/search_cache_context_manager_issue.mdnew file mode 100644index 0000000000..333f9ecd35--- /dev/null+++ b/search_cache_context_manager_issue.md@@ -0,0 +1,45 @@+# Issue: Use Context Manager for Database Session Management in SearchCache++## Description+As noted in PR #578 review, the `SearchCache` class in `src/local_deep_research/utilities/search_cache.py` currently uses try/finally blocks for session management. This could be improved by using context managers for cleaner, more Pythonic code.++## Current Implementation+```python+session = self.Session()+try:+ session.query(SearchCacheModel).delete()+ session.commit()+finally:+ session.close()+```++## Suggested Improvement+Use a context manager pattern:+```python+with self.Session() as session:+ session.query(SearchCacheModel).delete()+ session.commit()+```++Or create a custom context manager if the Session doesn't support it natively.++## Locations to Update+- `search_cache.py:309` - `clear_all()` method+- Check other methods in the same file that might use similar patterns++## Benefits+- Cleaner, more readable code+- Automatic resource cleanup+- More Pythonic approach+- Reduces boilerplate code++## Priority+Low - This is a code quality improvement, not a bug fix++## Labels+- enhancement+- code-quality+- good-first-issue++## Reference+Comment from djpetti in PR #578: "Not a big issue, but in the future, it would probably be cleaner to just use a context manager."diff --git a/src/local_deep_research/web/api.py b/src/local_deep_research/web/api.pyindex 2ef041f92b..f862182f0c 100644--- a/src/local_deep_research/web/api.py+++ b/src/local_deep_research/web/api.py@@ -292,36 +292,6 @@ def api_quick_summary():logger.debug("No username in session, skipping settings snapshot")params["settings_snapshot"] = {}- # Provide default settings if no snapshot- if not params.get("settings_snapshot"):- logger.debug("No settings snapshot, loading defaults")- try:- # Load default settings from JSON file- import json- from importlib import resources as importlib_resources-- defaults_text = importlib_resources.read_text(- "local_deep_research.defaults", "default_settings.json"- )- defaults = json.loads(defaults_text)-- # Convert to settings snapshot format- settings_snapshot = {}- for key, setting in defaults.items():- if isinstance(setting, dict) and "value" in setting:- settings_snapshot[key] = setting["value"]- else:- settings_snapshot[key] = setting-- params["settings_snapshot"] = settings_snapshot- logger.debug(- f"Loaded {len(settings_snapshot)} default settings"- )- except Exception as e:- logger.error(f"Failed to load default settings: {e}")- # Don't provide minimal defaults - let it fail properly- raise-# Call the actual research functionresult = quick_summary(query, **params)