Report a robot's status to InOrbit when it changes - #94
Merged
Conversation
leandropineda
approved these changes
Aug 28, 2026
Not publishing system stats for an offline robot stops InOrbit from asking for state and re-stamping the robot's offline timestamp, but it also removes the only thing that could ever mark that robot offline: InOrbit requests state only from robots it already has offline, and the robot session answers InOrbit's pings for as long as the connector process is alive. A robot that dies while InOrbit has it online would stay online indefinitely. Hand the online check's result to the session on every iteration instead. The edge-sdk publishes it only when it changed, so the robot is reported offline once, when it goes offline, and its offline timestamp is left alone from then on. Register the online status callback on the RobotSessionFactory rather than on each session: the pool connects a session as soon as it builds it, so the per-session registration happened after the first connection had already reported a status. Requires the edge-sdk release with publish_status() and the factory-level callback, so the dependency floor moves to 3.3.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
b-Tomas
force-pushed
the
report-robot-status-changes
branch
from
August 28, 2026 14:23
fa5bac2 to
34c3383
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#92 stopped publishing system stats for robots the connector reports offline, which stops InOrbit asking for state and re-stamping the robot's offline timestamp on every execution loop iteration. Reading the platform side afterwards showed that it also removes the only signal that can mark such a robot offline in the first place:
ingest's system module sendsget_stateonly for a robot it already has offline, and only on asystem/statsmessage. No other message type triggers it.So a robot that dies while InOrbit has it online stays online indefinitely: no stats to provoke
get_state, no failing pings, and the session is up so neither the will nordisconnect()fires. The connector knows the robot is offline and has no way to say so.Change
Hand the online check's result to the session on every iteration, next to the decision it already drives:
The edge-sdk publishes it only when it changed, so the robot is reported offline once — at the moment it goes offline, which is the timestamp you want — and nothing touches it afterwards. When the robot comes back, the status flips to online in the same place and the stats resume.
Also moves the online status callback registration from the session to the
RobotSessionFactory.RobotSessionPool.get_session()builds and connects a session in one step, so registering on the session happened after the first connection had already published a status — the callback only ever affected later reconnections.Dependency floor moves to
inorbit-edge>=3.3.0forpublish_status()andRobotSessionFactory.set_online_status_callback().Notes for review
publish_statusis called every iteration on purpose. The de-duplication lives in the edge-sdk, so the connector keeps no extra per-robot state and cannot drift out of sync with what was actually published.Falsenow marks the robot offline rather than merely muting its stats. A callback that raises still falls back to online, as before.Testing
test_publish_pending_system_stats_publishes_online_status— online robot getspublish_status(True), offline robotpublish_status(False)test_sets_online_status_callback— rewritten for factory-level registration, asserts nothing is registered on the session238 passed, flake8 and black clean, run against the edge-sdk branch from Report the robot's actual status, and only when it changes edge-sdk-python#113🤖 Generated with Claude Code