fix: Fix Sandboxes.send_command failing to reach the sandbox data plane. - #7140
Open
copybara-service[bot] wants to merge 1 commit into
Open
fix: Fix Sandboxes.send_command failing to reach the sandbox data plane.#7140copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
copybara_979408819
branch
2 times, most recently
from
September 11, 2026 01:23
6d725a9 to
1781e81
Compare
`Sandboxes.send_command` built an inner `genai.Client(vertexai=True, ...)` and called `_api_client.request(...)` to talk to the sandbox data plane. That genai client's authorized session has no credentials object, so every call failed with `AttributeError: 'NoneType' object has no attribute 'before_request'`, making all Computer Use / sandbox HTTP calls (GET /, /tabs, POST /cdp, etc.) unusable. The sandbox data plane does not use ADC; it authenticates via the `Authorization: Bearer <jwt>`, `X-Sandbox-Routing-Token` and `X-Sandbox-Port` headers that `send_command` already sets. Routing through a genai client was therefore both unnecessary and broken. Issue the request directly with `requests` instead, mirroring `generate_access_token`, which already talks to a non-aiplatform endpoint the same way. A JSON `Content-Type` is set only when a request body is present, and a caller-supplied `Content-Type` is preserved. `generate_browser_ws_headers`, which calls `send_command` internally, continues to parse the JSON body correctly. PiperOrigin-RevId: 979408819
copybara-service
Bot
force-pushed
the
copybara_979408819
branch
from
September 11, 2026 16:45
1781e81 to
5e65802
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.
fix: Fix Sandboxes.send_command failing to reach the sandbox data plane.
Sandboxes.send_commandbuilt an innergenai.Client(vertexai=True, ...)andcalled
_api_client.request(...)to talk to the sandbox data plane. That genaiclient's authorized session has no credentials object, so every call failed with
AttributeError: 'NoneType' object has no attribute 'before_request', making allComputer Use / sandbox HTTP calls (GET /, /tabs, POST /cdp, etc.) unusable.
The sandbox data plane does not use ADC; it authenticates via the
Authorization: Bearer <jwt>,X-Sandbox-Routing-TokenandX-Sandbox-Portheaders that
send_commandalready sets. Routing through a genai client wastherefore both unnecessary and broken.
Issue the request directly with
requestsinstead, mirroringgenerate_access_token, which already talks to a non-aiplatform endpoint thesame way. A JSON
Content-Typeis set only when a request body is present, and acaller-supplied
Content-Typeis preserved.generate_browser_ws_headers,which calls
send_commandinternally, continues to parse the JSON bodycorrectly.