Repository navigation
fix(provider): accept OPENAI_* env fallback alongside CORAGENT_* - #36
Merged
Merged
Conversation
from_env now tries CORAGENT_* then OPENAI_* as complete triples; the first prefix whose full triple (BASE_URL/MODEL/API_KEY) is present wins. Prefixes are never mixed — a half-configured environment cannot silently blend two sources. Whitespace-only values count as absent. This removes the manual env mapping step that broke the first E8 run attempt (binary rejected an OPENAI_*-only environment). Validated live: OPENAI_*-only env, tole run completed a read_file turn against the real provider. 112/112 tests, clippy clean. Housekeeping: preserve the E8 run log as docs/e8-session-log.jsonl (E8 'documented run' artifact, verified secret-free) and gitignore .tole/ so future runs never leak session files into commits.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Oct 7, 2026
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.
What
OpenAiConfig::from_envnow resolves provider config from complete prefix triples:CORAGENT_*first, thenOPENAI_*. The first prefix whose full triple (_BASE_URL,_MODEL,_API_KEY) is present and non-empty wins. Prefixes are never mixed — a half-configured environment cannot silently blend two sources. Whitespace-only values count as absent.Also: error message now names both accepted prefixes, and CLI docs updated.
Housekeeping in the same PR: the E8 run session log is preserved at
docs/e8-session-log.jsonl(the E8 'documented run' artifact, verified secret-free — the only 'sk-' hit was the word 'risk-tiered'), and.tole/is now gitignored so future runs never leak session files into commits.Why
The first E8 MVP gate run attempt failed with
missing CORAGENT_BASE_URL / CORAGENT_MODEL / CORAGENT_API_KEYon a machine that had a perfectly goodOPENAI_*environment — the operator had to hand-map env vars to make the run work (logged in the E8 retro). The standard OpenAI-compatible env names should just work.Testing
env_prefix_resolution_prefers_coragent_and_never_mixescovers 4 cases: OPENAI-only fallback, CORAGENT priority when both complete, incomplete-CORAGENT + complete-OPENAI (no blending), whitespace-only treated as absent. Env snapshot/restore included; mutex-guarded.OPENAI_*from the real provider env (CORAGENT_* explicitly unset), rantole run --yes— completed a fullread_fileturn against the real provider. The exact scenario that failed before this fix now works.