Skip to content

fix: Fix Sandboxes.send_command failing to reach the sandbox data plane. - #7140

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara_979408819
Open

fix: Fix Sandboxes.send_command failing to reach the sandbox data plane.#7140
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara_979408819

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

fix: Fix Sandboxes.send_command failing to reach the sandbox data plane.

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.

@copybara-service
copybara-service Bot requested a review from a team as a code owner September 10, 2026 22:27
@product-auto-label product-auto-label Bot added size: xl Pull request size is extra large. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Sep 10, 2026
@copybara-service
copybara-service Bot force-pushed the copybara_979408819 branch 2 times, most recently from 6d725a9 to 1781e81 Compare September 11, 2026 01:23
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. and removed size: xl Pull request size is extra large. labels Sep 11, 2026
`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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. google-contributor size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant