Add a generic manual operator action framework - #1203
Open
j0nch wants to merge 15 commits into
Open
Conversation
j0nch
force-pushed
the
feat/manual-operator-actions
branch
2 times, most recently
from
August 18, 2026 23:35
63f9511 to
9a198d3
Compare
j0nch
marked this pull request as ready for review
August 19, 2026 02:47
added 9 commits
August 19, 2026 23:11
j0nch
force-pushed
the
feat/manual-operator-actions
branch
from
August 20, 2026 06:16
b749dd8 to
50cf8ad
Compare
Comment on lines
+10
to
+15
| class OperatorActionStatus(str, Enum): | ||
| """Outcome reported by an operator-action provider.""" | ||
|
|
||
| COMPLETED = "completed" | ||
| CANCELLED = "cancelled" | ||
| FAILED = "failed" |
Member
There was a problem hiding this comment.
Can we make this into a string literal?
Comment on lines
+36
to
+47
| def __post_init__(self) -> None: | ||
| for field_name in ( | ||
| "operator_name", | ||
| "action", | ||
| "title", | ||
| "instructions", | ||
| "confirmation_text", | ||
| ): | ||
| if not getattr(self, field_name).strip(): | ||
| raise ValueError(f"{field_name} must not be empty") | ||
| object.__setattr__(self, "details", self.details.copy()) | ||
| object.__setattr__(self, "resources", tuple(self.resources)) |
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.
Summary
ManualOperatorfrontend for awaiting work performed by a personmove_resource()for acknowledged manual transfers with PLR resource-model reconciliationWhy a dedicated ManualOperator?
A direct
input()pause is often appropriate for a simple notebook workflow.ManualOperatorprovides a reusable PLR contract when a protocol needs a safer or more observable manual handoff:The built-in console provider remains deliberately simple for users who only need an interactive pause; richer providers are optional application integrations.
Operator providers
ManualOperator.perform()creates a structuredOperatorActionRequestand awaits anOperatorActionProvider. Providers return an explicit completed, cancelled, or failed result; provider exceptions propagate unchanged. The built-in console provider runs blocking input in a worker thread so the protocol event loop remains available.The request contract is independent of any one presentation transport. Applications can implement a provider for a terminal, notebook, GUI, HTTP service, LIMS, or message broker without changing protocol code.
Resource moves
ManualOperator.move_resource()validates the modeled source and destination before prompting, leaves the resource assigned to its source while the operator works, and updates the model only after successful acknowledgement. It revalidates before assignment to avoid overwriting state that changed while the request was pending. Cancellation, reported failure, and provider exceptions leave the resource model unchanged.The operation uses PLR's standard resource-assignment machinery, including default
ResourceHolderchild positioning and optional explicit destination coordinates. Requests contain transport-safe resource names rather than liveResourceobjects.EventBus integration
With an active EventBus subscriber, manual actions emit a correlated lifecycle named
manual_operator.<action>.started,.completed, or.failed. Events usedevice_reference()for theManualOperator, carry direct modeled resources throughresource_reference(), preserve structured request details, and add provider completion metadata when available. Cancellation, provider-reported failure, invalid results, and provider exceptions produce the standard failed lifecycle without changing normal exception behavior.move_resource()emitsmanual_operator.resource.move.*with the direct moved resource and its truesourceanddestination. PLR's existingresource.unassignedandresource.assignedevents independently record the subsequent model transition.Testing
python3 -m unittest pylabrobot.events.bus_tests pylabrobot.manual_operator.manual_operator_tests -vpython3 -m compileall -q pylabrobot/events pylabrobot/manual_operatorgit diff --check origin/main...HEAD