Skip to content

fix(cli): honor an explicit --wallet/--hotkey in issues register#1594

Open
swengieer0829 wants to merge 1 commit into
entrius:testfrom
swengieer0829:fix/register-honor-explicit-wallet
Open

fix(cli): honor an explicit --wallet/--hotkey in issues register#1594
swengieer0829 wants to merge 1 commit into
entrius:testfrom
swengieer0829:fix/register-honor-explicit-wallet

Conversation

@swengieer0829

Copy link
Copy Markdown

Summary

gitt issues register silently ignores an explicitly-passed --wallet / --hotkey when the value equals the option default, substituting the config wallet instead.

register resolved the wallet with a value comparison:

effective_wallet = wallet_name if wallet_name != 'default' else config.get('wallet', wallet_name)

So --wallet default (the wallet literally named default) is treated as "not supplied" and the config wallet wins. Every other wallet-taking command — including harvest, in the same file — resolves via resolve_wallet_config, which uses Click's ParameterSource to distinguish an explicitly-passed flag from a defaulted one. register is the only command that doesn't, so it resolves the wallet inconsistently with the rest of the CLI.

This is not merely cosmetic: register is owner-only and spends real ALPHA on-chain. A user who explicitly selects --wallet default to sign the registration gets signed with a different (config) wallet — a silent, surprising override of an explicit flag on a money-moving command.

Fix: resolve the wallet through the shared resolve_wallet_config helper (already imported and already used by harvest), so register honors an explicit flag exactly like its sibling commands. The now-unused config = load_config() line and its import are removed — resolve_wallet_config loads the config internally.

Behavior

~/.gittensor/config.json = {"wallet": "alice"}, running:

gitt issues register --repo owner/repo --issue 1 --bounty 10 --wallet default -y
  • Before: signs with alice — the explicit --wallet default is ignored.
  • After: signs with default — the explicit flag is honored. Omitting --wallet still falls back to alice.

(No user-facing output shape changes; the only observable difference is that the Loading wallet … status line now names the wallet the user actually asked for.)

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated
  • Manually tested

Added tests/cli/test_issue_register.py (the command had no prior test coverage):

  • test_register_honors_explicit_wallet_default_over_config — explicit --wallet default beats config alice.
  • test_register_falls_back_to_config_wallet_when_flag_omitted — omitting the flag still uses the config wallet, guarding against over-correction.

Both drive the real issues register command and assert on the wallet passed to bittensor.Wallet. Both fail on the pre-fix code and pass with the fix. ruff check, ruff format --check, and vulture are clean.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

register resolved the wallet with a value comparison
(wallet_name != 'default') instead of Click's ParameterSource, so an
explicitly-passed --wallet/--hotkey that equals the option default was
silently overridden by the config wallet -- unlike harvest and the other
commands, which resolve via resolve_wallet_config. Since register is
owner-only and spends real ALPHA, signing with the wrong wallet matters.
Resolve through the shared resolve_wallet_config helper so register
honors an explicit flag identically to its siblings; drop the now-unused
config = load_config() and its import (resolve_wallet_config loads it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label Jul 6, 2026
@anderdc anderdc added blocked cli Command-line interface (gitt) changes and removed bug Something isn't working labels Jul 8, 2026
@anderdc

anderdc commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

please provide before and after screenshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked cli Command-line interface (gitt) changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants