Skip to content

Clean up LegacyPhaseShim subscription after task_summaries removal#511

Open
Matthew0803 wants to merge 6 commits into
open-rmf:mainfrom
Matthew0803:rm_legacy_reporting_mechanism
Open

Clean up LegacyPhaseShim subscription after task_summaries removal#511
Matthew0803 wants to merge 6 commits into
open-rmf:mainfrom
Matthew0803:rm_legacy_reporting_mechanism

Conversation

@Matthew0803
Copy link
Copy Markdown

Bug fix

#477

Fixed bug

The robot fleet system used to publish a "task status bulletin board" (/task_summaries topic) so other parts of the system could watch what robots were doing. That bulletin board was removed because nobody was reading it. But leftover code in LegacyPhaseShim still used the old bulletin board message format to figure out when a robot task started, finished, or failed, instead of just knowing those things directly.

Fix applied

Simplify the subscription code to:

  1. Immediately mark the event as "Underway" when the phase begins (like all other events in the codebase do)
  2. Only use incoming messages for logging and failure detection
  3. Let the completion handler properly set the "Completed" status
  4. Remove the now-unnecessary _last_state_value tracking field

@mxgrey mxgrey added this to PMC Board Mar 10, 2026
@github-project-automation github-project-automation Bot moved this to Inbox in PMC Board Mar 10, 2026
@arjo129 arjo129 self-requested a review March 10, 2026 03:25
Signed-off-by: Matthew0803 <matthewfc83@gmail.com>
@Matthew0803 Matthew0803 force-pushed the rm_legacy_reporting_mechanism branch from 8e573f1 to 49bde84 Compare March 11, 2026 02:29
@mxgrey mxgrey self-requested a review March 24, 2026 01:08
@mxgrey mxgrey moved this from Inbox to In Review in PMC Board Mar 24, 2026
Copy link
Copy Markdown
Contributor

@mxgrey mxgrey left a comment

Choose a reason for hiding this comment

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

I can understand having a default switch to Underway status at the start and a switch to Completed status at the end if the task accidentally finished with an Underway status, but I don't understand why would discard other status changes that happen in between. I've put more detailed comments inline.

Comment on lines -130 to -143
self->_last_state_value = msg.state;
if (msg.state == TaskSummary::STATE_QUEUED
|| msg.state == TaskSummary::STATE_PENDING)
self->_state->update_status(Event::Status::Standby);
else if (msg.state == TaskSummary::STATE_ACTIVE)
self->_state->update_status(Event::Status::Underway);
else if (msg.state == TaskSummary::STATE_COMPLETED)
self->_state->update_status(Event::Status::Completed);
else if (msg.state == TaskSummary::STATE_FAILED)
self->_state->update_status(Event::Status::Failed);
else if (msg.state == TaskSummary::STATE_CANCELED)
self->_state->update_status(Event::Status::Canceled);
else
self->_state->update_status(Event::Status::Uninitialized);
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.

I don't understand why we would remove the ability to update the task status based on the specific legacy TaskSummary::state value. With the changes in this PR, users would only ever get to see Underway or Failed status updates. What's the point of reducing the visible status updates to just that?

}

/* *INDENT-OFF* */
if (!self->_last_state_value.has_value()
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.

What's the point of not tracking the last state value? Each time we change the task status we will be triggering communication with the server. We shouldn't do that if we're not delivering any new information.

Copy link
Copy Markdown
Contributor

@mxgrey mxgrey left a comment

Choose a reason for hiding this comment

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

I've filtered this PR down to the key contributions and reverted what I felt was an unnecessary change in the way task statuses were being converted. I think this is good to merge now.

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

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants