Skip to content

fix(config): enable bittensor CLI arg parsing (BT_NO_PARSE_CLI_ARGS)#286

Merged
Thykof merged 1 commit into
mainfrom
fix/enable-bittensor-cli-parsing
Jun 19, 2026
Merged

fix(config): enable bittensor CLI arg parsing (BT_NO_PARSE_CLI_ARGS)#286
Thykof merged 1 commit into
mainfrom
fix/enable-bittensor-cli-parsing

Conversation

@Thykof

@Thykof Thykof commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Problem

On bittensor 10.4.x, the validator (and miner) crash at startup:

File "synth/utils/config.py", line 58, in check_config
    config.neuron.name,
AttributeError: 'NoneType' object has no attribute 'name'

Root cause

bittensor 10.4.x disables CLI argument parsing by default: bittensor.core.config.Config.__init__ early-returns when no_parse_cli() is true, and no_parse_cli() reads BT_NO_PARSE_CLI_ARGS which defaults to "true". So bt.Config(parser) skips parsing entirely and returns only DEFAULTS:

  • config.neuron is Nonecheck_config crash above
  • config.netuid is dropped
  • config.subtensor.network stays finney (ignores --subtensor.network test)

i.e. every --flag from entrypoint-validator.sh / entrypoint-miner.sh was silently ignored. This regressed when the repo moved to bittensor==10.4.1.

Fix

Set BT_NO_PARSE_CLI_ARGS=false inside config() before building bt.Config, so the neurons are configured from their CLI flags again. It's scoped to config() (not module import) so it never makes bittensor's logging machine parse pytest's argv during the test suite, and uses setdefault so 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 and check_config() passes:

  • netuid=247, subtensor.network=test, wallet.name, neuron.name/nprocs, retention.low.days, validator.mode, storage.backend
  • check_config() no longer raises; neuron.full_path computes
  • unit tests green; black/flake8 clean

🤖 Generated with Claude Code

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (via os.environ.setdefault) inside config() before constructing bt.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.

@Thykof Thykof merged commit 187dc7c into main Jun 19, 2026
6 checks passed
@Thykof Thykof deleted the fix/enable-bittensor-cli-parsing branch June 19, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants