Skip to content

Background commander fails to apply user changes due to missing thread argument #5498

Description

@IlyaKochnev

Description

User changes made in the panel are committed to the database, but the generated service configurations are not refreshed. For example, after deleting a user while Telemt is enabled, the deleted UUID remains in other/telegram/telemt/config.toml and Telemt continues accepting it.

The problem affects all background calls to commander(...), not only Telemt.

Root cause

hiddifypanel/panel/run_commander.py starts cmd_in_back without passing its required cmd argument:

t = threading.Thread(target=cmd_in_back, daemon=True)
t.start()

but the target is declared as:

def cmd_in_back(cmd):
    p = subprocess.Popen(cmd, cwd=str(os.environ['HIDDIFY_CONFIG_PATH']), start_new_session=True)
    p.wait()

Every background invocation therefore fails with:

TypeError: cmd_in_back() missing 1 required positional argument: 'cmd'

The caller returns success immediately, so the UI does not report the failure.

Steps to reproduce

  1. Install Hiddify Manager 12.3.3 and enable the Telemt Telegram proxy.
  2. Create a user and apply the configuration.
  3. Delete that user in the panel UI.
  4. Inspect other/telegram/telemt/config.toml.
  5. Inspect the panel/background-task error logs.

Actual result

  • The user is deleted from the panel/database.
  • The UUID remains in Telemt's generated config.toml.
  • The configuration modification time does not change.
  • Logs contain TypeError: cmd_in_back() missing 1 required positional argument: 'cmd'.

Expected result

The apply-users command should run in the background, regenerate configurations from the current database state, and apply the user change.

Proposed fix

Pass base_cmd to the thread target:

t = threading.Thread(target=cmd_in_back, args=(base_cmd,), daemon=True)

A pull request with this change will be linked below.

Environment

  • Hiddify Manager: 12.3.3
  • Hiddify Panel: 12.3.3
  • Installation: standard installer
  • OS: Ubuntu 22.04
  • Telegram proxy implementation: Telemt

Additional note

Telemt's add_client and remove_client methods are currently no-ops, so it relies on generated configuration updates. Telemt may also need to be reloaded/restarted after regeneration for the changed access list to take effect in the running process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions