Skip to content

fix: update reply_to topic format in MQTTManager for consistency - #259

Open
MTewari13 wants to merge 1 commit into
hummingbot:mainfrom
MTewari13:fix/issue-256-mqtt-reply-to-topic
Open

MTewari13 wants to merge 1 commit into
hummingbot:mainfrom
MTewari13:fix/issue-256-mqtt-reply-to-topic

Conversation

@MTewari13

Copy link
Copy Markdown

Summary

MQTTManager.publish_command() set reply_to to hummingbot-api-response-<ts> (dash format). The API doesn't subscribe to that topic, and the stock deploy EMQX ACL denies it, so every start/stop/config command caused an AUTHZ denial and a dead-letter reply.

This changes it to hummingbot-api/response/<ts>, matching the existing subscription (hummingbot-api/response/+) and the generic RPC path in the same module.

Closes #256

Notes

  • Commands were never affected (confirmations use hbot/<bot>/response/...); this only removes the broker/bot log noise.
  • The bot's reply now reaches the API's response subscription, so _handle_rpc_response logs "No pending RPC response" once per command, since publish_command() is fire-and-forget.
  • Not tested against a live EMQX broker.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The reply-topic change reaches the bot-control commands that share this publisher.

Fix the shared reply-topic collision before merging so commands cannot supply the reply to a history request.

Findings

  1. P1 History gets the wrong reply ▶

Summary

Changes publish_command() to use hummingbot-api/response/<timestamp>.

  • Bot command replies now use the API's subscribed response topic.

Reviews (1) · Last reviewed commit: "fix: update reply_to topic format in MQT..." · Reviewed by Greptile

Comment thread utils/mqtt_manager.py
"header": {
"timestamp": int(time.time() * 1000), # Milliseconds
"reply_to": f"hummingbot-api-response-{int(time.time() * 1000)}", # Unique response topic
"reply_to": f"hummingbot-api/response/{int(time.time() * 1000)}", # Matches the subscribed response topic

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 History gets the wrong reply

publish_command() now uses the same millisecond-only reply topic as publish_command_and_wait(). When a start, stop, or config request and a history request generate their topics in the same millisecond, the command reply can arrive first and satisfy the history request. _handle_rpc_response() checks only the topic, so the API returns the command's reply as successful history data and discards the real history reply.

Give each request a unique topic, such as a UUID-based suffix, while keeping the allowed prefix.

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

Labels

None yet

Projects

None yet

1 participant