Skip to content

Commit 93bbd79

Browse files
committed
fix: allow PENDING→COMPLETE transition and idempotent status updates, fix LT tag embedding
1 parent 19d12b8 commit 93bbd79

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/orb/domain/request/request_types.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,17 @@ def can_transition_to(self, new_status: RequestStatus) -> bool:
133133
Returns:
134134
True if transition is valid, False otherwise
135135
"""
136+
# Idempotent transitions are always valid (same status → same status)
137+
if new_status == self:
138+
return True
139+
136140
valid_transitions = {
137141
RequestStatus.PENDING: [
138142
RequestStatus.IN_PROGRESS,
139143
RequestStatus.CANCELLED,
140144
RequestStatus.FAILED,
145+
RequestStatus.COMPLETED, # instant provisioning (e.g. RunInstances)
146+
RequestStatus.PARTIAL, # instant provisioning with partial fulfillment
141147
],
142148
RequestStatus.IN_PROGRESS: [
143149
RequestStatus.COMPLETED,

src/orb/providers/aws/infrastructure/launch_template/manager.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,16 @@ def _create_new_launch_template(
438438
"Launch template %s does not exist. Creating new template.", template_name
439439
)
440440

441+
lt_tags = self._create_launch_template_tags(aws_template, request)
442+
441443
response = self.aws_client.ec2_client.create_launch_template(
442444
LaunchTemplateName=template_name,
443445
VersionDescription=f"Created for request {request.request_id}",
444446
LaunchTemplateData=template_data,
445447
ClientToken=client_token, # Key for idempotency!
448+
TagSpecifications=[
449+
{"ResourceType": "launch-template", "Tags": lt_tags}
450+
],
446451
)
447452

448453
launch_template = response["LaunchTemplate"]

0 commit comments

Comments
 (0)