fix(mcp): tolerate malformed client env#7561
Open
yyswhsccc wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
@Scottcjn Please take a look when you have a chance. This is a small MCP client startup hardening fix: malformed Validation:
|
jaxint
reviewed
Jun 23, 2026
jaxint
left a comment
Contributor
There was a problem hiding this comment.
✅ Code reviewed - implementation verified.
jaxint
reviewed
Jun 24, 2026
jaxint
left a comment
Contributor
There was a problem hiding this comment.
✅ Code reviewed - implementation verified. Good work on the changes.
Contributor
|
Nice implementation! This is a valuable contribution. Reviewed for Bounty #71 |
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.
Problem
rustchain-bounties-mcp/rustchain_bounties_mcp/client.pyparsedRUSTCHAIN_TIMEOUTandRUSTCHAIN_RETRYdirectly at import time. A malformed local environment value raisesValueErrorbefore the MCP client can start.Impact
A single bad numeric env value can crash the RustChain bounties MCP client during startup, preventing bounty/node tooling from initializing until the environment is corrected.
Fix
Add a small local
_safe_int_envhelper that logs malformed numeric env values and falls back to the existing defaults. Valid numeric env overrides are preserved.Tests
uv run --no-project --with pytest --with pytest-asyncio --with aiohttp python -B -m pytest -q tests/test_client_miners.py-> 4 passedpython3 -m py_compile rustchain_bounties_mcp/client.py tests/test_client_miners.py-> passedgit diff --check-> passedBoundaries
Related to the general bug bounty surface (#305). This PR does not change payout amounts, wallet crediting, admin secrets, or production wallet behavior.
wallet: RTC47bc28896a1a4bf240d1fd780f4559b242bcd945