chore(config): consolidate LLM config truth + harden ENV error paths#164
Merged
KailasMahavarkar merged 1 commit intomainfrom Apr 20, 2026
Merged
chore(config): consolidate LLM config truth + harden ENV error paths#164KailasMahavarkar merged 1 commit intomainfrom
KailasMahavarkar merged 1 commit intomainfrom
Conversation
Follow-up to #163. The behaviour audit of the config subsystem turned up four issues; fixing them all here. 1. Truth fork (HIGH) tools/finetune/training.py was reading its own tools/finetune/ training_config.json with a bespoke loader (`load_openrouter_config`) that ignored the shared /.env and tools/autoresearch/config.json. Replace with a 10-line delegation to `tools.autoresearch.providers. resolve_providers`. Training now uses the same single source of truth as autoresearch and every bench. The preferred training model is hardcoded as `_DEFAULT_TRAINING_MODEL = "deepseek/deepseek-v3.2:nitro"` (overridable via OPENROUTER_TRAINING_MODEL env var). Delete tools/finetune/training_config.json entirely. 2. Silent fallback on missing env_key (HIGH) providers.resolve_providers used to fall back to api_key="ollama" when a provider's env_key field was missing. That hid misconfiguration in bogus auth failures far from the root cause. Now: non-local providers without env_key raise ValueError at resolve time with a pointer at what to add. Local providers still tolerate missing env_key (Ollama accepts any non-empty key string). 3. ENV KeyError lost field list (MEDIUM) ENV["typo"] previously raised bare `KeyError('typo')`. Restore the earlier format: `KeyError("ENV: unknown key 'typo'. Known: [...]")`. 4. Silent .env load (MEDIUM) env.py now emits a DEBUG-level log line with the count of variables loaded from /.env (or "no .env; shell env only" when absent). Verified end-to-end: - ENV typed access + KeyError show field list - Missing env_key on non-local provider raises ValueError - resolve_providers returns 5 candidates for current /.env + config - 1802 tests pass, 101 skipped Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
KailasMahavarkar
added a commit
that referenced
this pull request
Apr 20, 2026
After #163 (.env + typed env.py) and #164 (env_key pointer in provider config), the autoresearch README still documented the old "inline api_key in config.json" shape. Updated: * Config example now shows env_key pointers (ollama_key, openrouter_key) instead of api_key strings * Added a short preamble explaining that secrets live in /.env and config.json is shape-only * Setup section now tells the user to copy both config.example.json AND .env.example, and edit /.env for real keys * "Add a new model" section points at env.py + .env.example for provider-level onboarding Other README.md files in the repo were scanned; only this one had stale config refs. Nothing else needs updating. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
KailasMahavarkar
added a commit
that referenced
this pull request
Apr 20, 2026
After #163 (.env + typed env.py) and #164 (env_key pointer in provider config), the autoresearch README still documented the old "inline api_key in config.json" shape. Updated: * Config example now shows env_key pointers (ollama_key, openrouter_key) instead of api_key strings * Added a short preamble explaining that secrets live in /.env and config.json is shape-only * Setup section now tells the user to copy both config.example.json AND .env.example, and edit /.env for real keys * "Add a new model" section points at env.py + .env.example for provider-level onboarding Other README.md files in the repo were scanned; only this one had stale config refs. Nothing else needs updating. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
KailasMahavarkar
added a commit
that referenced
this pull request
Apr 20, 2026
After #163 (.env + typed env.py) and #164 (env_key pointer in provider config), the autoresearch README still documented the old "inline api_key in config.json" shape. Updated: * Config example now shows env_key pointers (ollama_key, openrouter_key) instead of api_key strings * Added a short preamble explaining that secrets live in /.env and config.json is shape-only * Setup section now tells the user to copy both config.example.json AND .env.example, and edit /.env for real keys * "Add a new model" section points at env.py + .env.example for provider-level onboarding Other README.md files in the repo were scanned; only this one had stale config refs. Nothing else needs updating. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #163. Config-subsystem behaviour audit turned up four issues; fixed in one PR.
1. Truth fork (HIGH)
tools/finetune/training.pyread its owntools/finetune/training_config.jsonwith a bespoke loader that ignored the shared/.envandtools/autoresearch/config.json.Replaced with a 10-line delegation to
tools.autoresearch.providers.resolve_providers. Training now uses the same single source of truth as autoresearch and every bench._DEFAULT_TRAINING_MODEL = "deepseek/deepseek-v3.2:nitro"(overridable viaOPENROUTER_TRAINING_MODELenv var).tools/finetune/training_config.json.2. Silent fallback on missing
env_key(HIGH)providers.resolve_providersused to fall back toapi_key="ollama"when a provider'senv_keyfield was missing - hid misconfiguration in bogus auth failures far from root cause.Now: non-local providers without
env_keyraiseValueErrorat resolve time. Local providers (Ollama) still tolerate missingenv_key.3.
ENVKeyError lost field list (MEDIUM)ENV["typo"]previously raised bareKeyError('typo'). Restored:KeyError("ENV: unknown key 'typo'. Known: [...]").4. Silent
.envload (MEDIUM)env.pynow emits a DEBUG-level log line with count of vars loaded from/.env(or "no .env; shell env only" when absent).Verified
resolve_providersreturns 5 candidates for current /.env + config🤖 Generated with Claude Code