fix: clean error when OPENAI_API_KEY is unset in broker tools - #8
Draft
jayzuccarelli wants to merge 1 commit into
Draft
fix: clean error when OPENAI_API_KEY is unset in broker tools#8jayzuccarelli wants to merge 1 commit into
jayzuccarelli wants to merge 1 commit into
Conversation
The tools read the key at import with os.environ[...], so running any of them without a key dumped a raw KeyError traceback. Match config.py and fail with the same one-line message instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
jayzuccarelli
force-pushed
the
fix/tools-missing-key-error
branch
from
August 14, 2026 21:15
77bca83 to
56cb650
Compare
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.
Running any broker tool without
OPENAI_API_KEYprinted a rawKeyErrortraceback, because the key is read at import time withos.environ[...].config.pyalready handles this properly.Uses
.get()plus a one-lineSystemExitin the four tools that did it: harness, test_client, test_bargein, m2_play_ref.Verified:
python3 broker/tools/harness.pywith no key now printsOPENAI_API_KEY is requiredand exits. Ruff is unchanged (the 2 remaining errors in broker/tools are pre-existing and outside CI's lint scope).🤖 Generated with Claude Code