Skip to content

Conversation

@b-Tomas
Copy link
Member

@b-Tomas b-Tomas commented Dec 19, 2025

Description

Uses command_name as msg.file_name on the commands result function when args[0] is not of a type compatible with the protobuf message.

Previously, assigning msg.file_name = args[0] would crash upon navigation goal commands being reported as failed by calling the result_function due to _handle_pose_msg_helper parsing the navigation goal message with the pose as the first item of the args array, contrary to custom command messages which use file_name.

def _handle_pose_msg_helper(self, msg, cmd):
"""A helper to abstract handling pose messages."""
args = msg.decode("utf-8").split("|")
seq = args[0]
ts = args[1] # noqa: F841
x = args[2]
y = args[3]
theta = args[4]
# Hand over to callback for processing, using the proper format
self.dispatch_command(
command_name=cmd,
args=[{"x": x, "y": y, "theta": theta}],
execution_id=seq, # NOTE: Using seq as the execution ID
)

NOTE: Calling result_function for a navigation goal message has no effect on the InOrbit side, and reporting a failure through it won't make the user notice it in the UI (the command will appear successful anyway). However, navigation goal commands are dispatched in the same way as custom commands and therefore it is common for connectors to reuse exception handling logic that reports a failures through result_function.


Note

Ensure CustomScriptStatusMessage.file_name uses args[0] when string/bytes, otherwise falls back to command_name, and wire command_name through result reporting with tests.

  • RobotSession
    • Update dispatch_command() to pass command_name into result_functionreport_command_result(...).
    • Change report_command_result signature to accept command_name and set CustomScriptStatusMessage.file_name to args[0] if it is str/bytes, else use command_name.
  • Tests
    • Add parametrized test_report_command_result_file_name validating file_name selection and status fields.
    • Adjust imports to expose CUSTOM_COMMAND_STATUS_FINISHED and MQTT_SCRIPT_OUTPUT_TOPIC for assertions.

Written by Cursor Bugbot for commit 073b580. This will update automatically on new commits. Configure here.

Copy link
Contributor

Copilot AI left a comment

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 a bug where calling result_function for navigation goal commands would crash due to attempting to assign a dict object (the pose) to msg.file_name, which expects a string or bytes value. The fix adds command_name as a parameter to report_command_result and uses it as a fallback when args[0] is not a string or bytes type.

Key Changes:

  • Updated report_command_result signature to include command_name parameter
  • Modified msg.file_name assignment to check args[0] type and fallback to command_name for non-string/bytes values
  • Updated the call site in result_function within dispatch_command to pass command_name

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

b-Tomas and others added 2 commits December 19, 2025 13:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@b-Tomas b-Tomas merged commit a5cce1e into main Dec 22, 2025
25 checks passed
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.

3 participants