fix(agents): enforce sandbox disabled on remote and cloud workplaces#41
Merged
anvie merged 1 commit intoMay 18, 2026
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
anvie
approved these changes
May 16, 2026
Owner
anvie
left a comment
There was a problem hiding this comment.
Thank you for the PR! This is a clean fix for a real bug (issue #35).
The two bugs in the old code are clear:
- Create:
if data.get('sandbox_enabled')skips the check entirely when the client sendssandbox_enabled=0— a remote/cloud agent could be created with stale sandbox state. - Update: same falsy guard plus
del data['sandbox_enabled']instead of setting to0— the old DB value persists through partial updates.
The new _apply_sandbox_workplace_policy() helper fixes both: always called, always writes 0 for remote/cloud.
Test coverage is solid — all three workplace types, both on/off states, and the no-workplace-id edge case with assert_not_called. Clean use of unittest.mock.patch.
One non-blocking note: the dashboard api_setup() creates the super agent with a local workspace, so it's not affected. But if the setup wizard ever gains workplace selection, the same helper should be called there.
Full review report saved at artifacts/pr41-review.md.
Best,
Richard
Robin Syihab's agent.
jeffrysurya
pushed a commit
to jeffrysurya/evonic
that referenced
this pull request
May 20, 2026
- Create channel_pending_approvals table with id, channel_id (FK), external_user_id, user_name, pair_code (UNIQUE), created_at, expires_at - Add indexes on pair_code and channel_id for fast lookups
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.
Background
Docker sandbox mode only applies to local workplaces. Remote SSH and cloud (Evonet) workplaces run tools through different execution backends, so a sandbox toggle on those agents does not mean what the UI implies.
There was a gap in how agent create/update handled
sandbox_enabled:sandbox_enabledwas truthy, so sending0skipped the workplace check entirely.sandbox_enabledfrom the payload instead of writing0. The old value in SQLite could stay out of sync with what the settings page shows.Issue #35 reported the toggle feeling ineffective; the underlying issue is that policy was not applied consistently on every save path.
How it behaves now
A small helper,
_apply_sandbox_workplace_policy(), looks up the target workplace and, forremoteorcloudtypes, always setssandbox_enabledto0on the data dict passed to the database layer.Both API entry points call it:
/api/agents— usesworkplace_idfrom the create body./api/agents/<id>— usesworkplace_idfrom the body when present, otherwise the agent’s existing workplace.That means a partial update (name, prompt, channel, etc.) on a cloud agent still persists
sandbox_enabled=0, even when the client omits the sandbox field. Local workplaces are unchanged: both0and1pass through as sent.The agent detail UI already disables the sandbox toggle for remote/cloud; this change makes the stored agent record match that expectation.
Files touched
routes/agents.py—_apply_sandbox_workplace_policy()plus calls from create/update handlers.unit_tests/test_agent_sandbox_workplace_validation.py— unit tests against the helper (local allowed, remote/cloud forced off, no lookup whenworkplace_idis missing).Notes for reviewers
Checked with
python -m pytest unit_tests/test_agent_sandbox_workplace_validation.py -q