Skip to content

feat: add update_network convenience method for sandbox network configuration#150

Merged
Joffref merged 4 commits into
mainfrom
devin/1779927111-add-update-network
May 28, 2026
Merged

feat: add update_network convenience method for sandbox network configuration#150
Joffref merged 4 commits into
mainfrom
devin/1779927111-add-update-network

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 28, 2026

Summary

Adds a high-level update_network class method to both SandboxInstance (async) and SyncSandboxInstance (sync) for updating sandbox network/proxy configuration without recreating the sandbox.

Changes:

  • types.py: New SandboxUpdateNetwork type accepting SandboxNetwork or dict
  • default/sandbox.py: Async update_network classmethod on SandboxInstance
  • sync/sandbox.py: Sync update_network classmethod on SyncSandboxInstance
  • __init__.py: Export SandboxUpdateNetwork

Follows the existing pattern of update_metadata, update_ttl, and update_lifecycle.

Review & Testing Checklist for Human

  • Verify update_network correctly calls the update API with the modified sandbox spec
  • Test with a real sandbox: await SandboxInstance.update_network("my-sandbox", SandboxUpdateNetwork(network={"proxy": {...}}))
  • Confirm passing network=None correctly sets the spec field to UNSET

Notes

The backend already supports network updates via the sandbox update API — this PR adds the SDK convenience method.

Link to Devin session: https://app.devin.ai/sessions/9282779c78a94d22baf1c06d80566dc5
Requested by: @Joffref


Note

Adds update_network convenience methods to both SandboxInstance (async) and SyncSandboxInstance (sync) for updating sandbox network configuration in-place. Introduces a SandboxUpdateNetwork wrapper type and exports it from the package. The latest commit switches test assertions to exact set equality to resolve CodeQL URL substring warnings.

Written by Mendral for commit 8ebdf03.

…ates

Add SandboxUpdateNetwork type and update_network class methods to both
SandboxInstance (async) and SyncSandboxInstance (sync) following the
existing update_metadata/update_ttl/update_lifecycle pattern.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

mendral-app[bot]

This comment was marked as outdated.

@Joffref
Copy link
Copy Markdown
Contributor

Joffref commented May 28, 2026

DevinAI add an integration test for this please

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Added integration tests in tests/integration/core/sandbox/test_network.py covering:

  • Updating network with allowed domains (dict input)
  • Updating network with forbidden domains (dict input)
  • Updating network using SandboxNetwork model object
  • Clearing network config by passing network=None

See commit 7e75d13.

mendral-app[bot]

This comment was marked as outdated.

Comment thread tests/integration/core/sandbox/test_network.py Fixed
Comment thread tests/integration/core/sandbox/test_network.py Fixed
Comment thread tests/integration/core/sandbox/test_network.py Fixed
Comment thread tests/integration/core/sandbox/test_network.py Fixed
@Joffref
Copy link
Copy Markdown
Contributor

Joffref commented May 28, 2026

DevinAI use httpbin

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Updated all integration tests to use httpbin.org domains instead of generic ones. See commit 7cdd77a.

Comment thread tests/integration/core/sandbox/test_network.py Fixed
Comment thread tests/integration/core/sandbox/test_network.py Fixed
Comment thread tests/integration/core/sandbox/test_network.py Fixed
@Joffref
Copy link
Copy Markdown
Contributor

Joffref commented May 28, 2026

DevinAI fix codeql

…rnings

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Fixed the CodeQL "Incomplete URL substring sanitization" warnings by replacing in membership checks with exact equality assertions (== and set() comparisons). See commit 8ebdf03.

Copy link
Copy Markdown
Contributor

@mendral-app mendral-app Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The fix commit only changes test assertions from substring checks to exact set() equality — no logic changes. No new issues introduced.

Tag @mendral-app with feedback or questions. View session

@Joffref Joffref merged commit 5327540 into main May 28, 2026
19 checks passed
@Joffref Joffref deleted the devin/1779927111-add-update-network branch May 28, 2026 00:48
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