Skip to content

refactor(cua-sandbox): use generated Cyclops SDK for Fleet cloud transport - #2398

Merged
r33drichards merged 16 commits into
mainfrom
refactor/cyclops-fleet-sdk
Jul 23, 2026
Merged

refactor(cua-sandbox): use generated Cyclops SDK for Fleet cloud transport#2398
r33drichards merged 16 commits into
mainfrom
refactor/cyclops-fleet-sdk

Conversation

@r33drichards

Copy link
Copy Markdown
Collaborator

Summary

Replaces the handwritten _FleetClient REST implementation from #2384 with an adapter around the generated Cyclops Python SDK (cyclops_sdk), merged in trycua/cloud#5905.

What changed

  • Vendored cyclops_sdk under lib/fleets/ (origin: cloud PR #5905, commit 239a06064), with local package metadata and README documenting the source.
  • New cyclops_http_client.py — an HttpClient subclass bridging the SDK's HttpRequest/HttpResponse types to httpx.AsyncClient.
  • Rewrote fleet_cloud.py — replaces raw httpx REST calls, manual OAuth token POST, polling loops, and asyncio.to_thread wrappers with typed SDK calls (CyclopsClient.connect, create_pool, create_claim, wait_claim, delete_claim, delete_pool, service_request).
  • Updated fleet.py — routes computer-server traffic (/cmd, /screenshot, /status, /pty) through service_request instead of service_client.
  • Ported tests to mock the SDK boundary (CyclopsClient/HttpClient) instead of raw httpx endpoints.
  • Packaging — added vendored SDK dependency to pyproject.toml; documented native cdylib build requirement.

What's preserved

  • Public API unchanged: cua.configure(client_id=..., client_secret=...), Sandbox.create/ephemeral, Image.from_registry(...).expose(...), TunnelInfo with Fleet service URLs.
  • Legacy CloudTransport (API-key VM) path untouched.
  • Cleanup-on-failure, suspend/resume/restart/delete, unsupported-operation errors, us-east-1-only restriction.
  • Original PR feat(cua-sandbox): use Fleet as the cloud backend #2384 commits cherry-picked with -x attribution.

Validation

  • git diff --check — clean
  • ruff check on changed transport and test files — passed
  • Vendored SDK upstream async contract suite — 4/4 passed
  • Full cua-sandbox pytest blocked locally (missing Python.h for evdev transitive build)

Supersedes #2384.

Test Plan

  • CI passes (lint, type check, unit tests)
  • E2E with OAuth credentials against a disposable registry image
  • Verify legacy API-key path still works

r33drichards and others added 9 commits July 21, 2026 00:50
(cherry picked from commit d12a914)
- raise a typed Fleet snapshot error\n- route OAuth lifecycle and reconnects through Fleet\n- keep Fleet readiness waits off the event loop\n- preserve cleanup handles until successful deletion\n- retain provisioning failures when cleanup also fails\n- split Fleet and legacy API base URLs\n- preserve API-key creation through the legacy VM API\n- reject unsupported Fleet disk and region arguments and honor startup timeouts\n- return Fleet service endpoints for exposed ports

(cherry picked from commit 9192140)
@r33drichards
r33drichards requested a review from ddupont808 as a code owner July 21, 2026 01:26
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@r33drichards
r33drichards merged commit 3df76b1 into main Jul 23, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants