Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions agentplatform/_genai/sandboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,14 @@ def pause(
get_operation_fn=self._get_sandbox_operation,
poll_interval_seconds=poll_interval_seconds,
)
if operation.response:
# Only refresh via get() when the LRO response carries a resource
# name. The pause LRO's response_type is declared as SandboxEnvironment
# in the proto but the backend may return an empty payload for some
# code paths, in which case operation.response.name is empty and a
# get() call would produce a 404 with an unsubstituted {name} in the
# request URL. Callers who want the post-pause state can call
# sandboxes.get(name=name) explicitly.
if operation.response and getattr(operation.response, "name", None):
operation.response = self.get(name=operation.response.name)
return operation

Expand Down Expand Up @@ -1084,7 +1091,11 @@ def resume(
get_operation_fn=self._get_sandbox_operation,
poll_interval_seconds=poll_interval_seconds,
)
if operation.response:
# Only refresh via get() when the LRO response carries a resource
# name. Symmetric guard with pause() above: protects against a backend
# response payload without a name field, which would otherwise produce
# a 404 with an unsubstituted {name} in the request URL.
if operation.response and getattr(operation.response, "name", None):
operation.response = self.get(name=operation.response.name)
return operation

Expand Down
Loading