fix(solana): auto-load wallet from ~/.blockrun/.solana-session (parity with Base)#10
Merged
VickyXAI merged 2 commits intoJun 14, 2026
Merged
Conversation
SolanaLLMClient resolved its key from `private_key` or the SOLANA_WALLET_KEY env var only — unlike the Base LLMClient, which also falls back to load_wallet() (~/.blockrun/.session). So a host with a Solana wallet session on disk still had to export SOLANA_WALLET_KEY, and the blockrun-litellm sidecar refused to start (its fail-fast wallet check) without it. Add the missing load_solana_wallet() fallback to both SolanaLLMClient and AsyncSolanaLLMClient, mirroring the Base clients. Now the env var is optional when a session file exists. Tests: test_raises_without_key now patches load_solana_wallet -> None so it's deterministic regardless of the host's session file; new test_init_from_session_file covers the fallback. Full unit suite: 256 passed.
…over async + bad-key Review follow-ups to the session-file auto-load: - Fix misleading comment/error: load_solana_wallet() scans the newest ~/.*/solana-wallet.json from ANY provider first, then ~/.blockrun/.solana-session — the old text named only the session file, hiding which key is actually used. - Validate the resolved key for true Base parity: wrap _create_signer so a malformed key (incl. one auto-loaded from disk) raises a clean ValueError instead of a raw base58/solders exception. Both sync and async clients. - Guard the legacy session-file read against OSError (unreadable file → no wallet, not a crash), matching the provider-scan path. - Tests: add async session-file fallback + invalid-key coverage.
VickyXAI
pushed a commit
that referenced
this pull request
Jun 15, 2026
Bump 1.4.1 -> 1.4.2. Ships the #10 fix: SolanaLLMClient / AsyncSolanaLLMClient fall back to the on-disk wallet session when SOLANA_WALLET_KEY is unset, with clean error handling for malformed/unreadable keys.
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
SolanaLLMClient/AsyncSolanaLLMClientresolved the wallet key fromprivate_keyor theSOLANA_WALLET_KEYenv var only:The Base
LLMClientalready falls back to the on-disk session:So with a Solana wallet at
~/.blockrun/.solana-sessionyou still had toexport SOLANA_WALLET_KEY, and theblockrun-litellmsidecar's fail-fast wallet check refused to start without it — a confusing asymmetry with Base.Fix
Add the missing
load_solana_wallet()fallback to both sync and async clients, mirroring the Base clients:Now
SOLANA_WALLET_KEYis optional when a session file exists. No behavior change when the env var or an explicit key is provided.Tests
test_raises_without_keynow patchesload_solana_wallet -> Noneso it's deterministic regardless of whether the host has a session file.test_init_from_session_filecovers the fallback.