fix(config): enable bittensor CLI arg parsing (BT_NO_PARSE_CLI_ARGS)#286
Merged
Conversation
bittensor 10.4.x disables CLI parsing by default (BT_NO_PARSE_CLI_ARGS defaults to "true"), so bt.Config(parser) ignored every --flag and returned only DEFAULTS: config.neuron was None (crashing check_config with 'NoneType' has no attribute 'name'), netuid was dropped, and subtensor stayed on finney. Our neurons are configured entirely via CLI flags, so set BT_NO_PARSE_CLI_ARGS=false inside config() before building the Config. Scoped to config() (not module import) so it never makes bittensor's logging machine parse pytest's argv during the test suite. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes startup crashes/regressions introduced with bittensor==10.4.1 by ensuring Bittensor parses CLI arguments when building neuron configs (miner/validator), restoring expected behavior for --netuid, --subtensor.network, --neuron.*, etc.
Changes:
- Set
BT_NO_PARSE_CLI_ARGS=false(viaos.environ.setdefault) insideconfig()before constructingbt.Config(parser)to re-enable CLI arg parsing under Bittensor 10.4.x.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
On bittensor
10.4.x, the validator (and miner) crash at startup:Root cause
bittensor 10.4.x disables CLI argument parsing by default:
bittensor.core.config.Config.__init__early-returns whenno_parse_cli()is true, andno_parse_cli()readsBT_NO_PARSE_CLI_ARGSwhich defaults to"true". Sobt.Config(parser)skips parsing entirely and returns onlyDEFAULTS:config.neuronisNone→check_configcrash aboveconfig.netuidis droppedconfig.subtensor.networkstaysfinney(ignores--subtensor.network test)i.e. every
--flagfromentrypoint-validator.sh/entrypoint-miner.shwas silently ignored. This regressed when the repo moved tobittensor==10.4.1.Fix
Set
BT_NO_PARSE_CLI_ARGS=falseinsideconfig()before buildingbt.Config, so the neurons are configured from their CLI flags again. It's scoped toconfig()(not module import) so it never makes bittensor's logging machine parse pytest's argv during the test suite, and usessetdefaultso an operator can still override.One line covers both validator and miner (they share
config()).Verification
With the fix,
Validator.config()built from a realistic argv resolves correctly andcheck_config()passes:netuid=247,subtensor.network=test,wallet.name,neuron.name/nprocs,retention.low.days,validator.mode,storage.backendcheck_config()no longer raises;neuron.full_pathcomputesblack/flake8clean🤖 Generated with Claude Code