Skip to content

fix(backend): support mkdir/delete/move on OpenSandbox agent workspaces - #1911

Open
JasonBuildAI wants to merge 2 commits into
TencentCloud:developfrom
JasonBuildAI:fix/c7d1-work
Open

JasonBuildAI wants to merge 2 commits into
TencentCloud:developfrom
JasonBuildAI:fix/c7d1-work

Conversation

@JasonBuildAI

Copy link
Copy Markdown

Summary

Any expert on an opensandbox storage backend currently cannot start: octop_harness's OpenSandbox supports execute / upload_files / download_files, but unlike DockerSandbox it never defines mkdir_path / delete_path / move_path, and BackendWorkspace requires those three primitives on any backend without a host mount. The first workspace mutation therefore raises BackendOperationNotSupportedError: mkdir is not supported by backend type 'OpenSandbox' and the expert dies during startup. This PR adds the three primitives in Octop's backend protocol-compat layer, so OpenSandbox-backed experts start and workspace seeding / session files work like on the Docker backend.

Fixes #1813.

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (release/* or hotfix/* only)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore
  • Release / hotfix

Test plan

Reproduced first, then fixed (octop @ this branch, octop_harness 1.0.2, Python 3.12.12, Windows 10 zh-CN).

  1. Minimal repro — real OpenSandbox class + fake remote SDK, no live sandbox. Before the change:
backend class: OpenSandbox
has mkdir_path: False

REPRO: workspace init FAILED

Traceback (most recent call last):
  File "...\_repro1813.py", line 60, in main
    workspace.mkdir("skills/demo")
  File "...\octop_harness\backends\workspace.py", line 1024, in mkdir
    raise BackendOperationNotSupportedError("mkdir", type(self._backend).__name__)
octop_harness.backends.utils.BackendOperationNotSupportedError: mkdir is not supported by backend type 'OpenSandbox'

The same repro after the change:

backend class: OpenSandbox
has mkdir_path: False

OK: sandbox commands = ['mkdir -p /skills/demo', 'mkdir -p /skills/demo && mv /SOUL.md /skills/demo/SOUL.md', 'rm -rf /skills/demo']
  1. The new unit tests are sensitive to the fix: uv run pytest tests/unit/backend/test_compat.py -q -k sandbox → 2 failed, 3 passed without it, 21 passed with it.
  2. uv run pytest tests/unit/backend -q → 42 passed, 1 skipped.
  3. uv run ruff check + uv run ruff format --check on the two touched files → All checks passed! / 2 files already formatted; uv run mypy src/octop → Success: no issues found in 570 source files.
  4. uv run pytest -n auto -m "not live" → 27 failed, 4430 passed, 201 skipped. All 27 failures are pre-existing environment issues on this box and unrelated to this change: 19 of them (tests calling Path.read_text() without an explicit encoding under a zh-CN Windows GBK locale, in tests/unit/db and tests/unit/backup) pass when the suite is rerun with PYTHONUTF8=1; the remaining 8 are the desktop vendor-wheels shell-script tests, which invoke C:\Windows\System32\bash.EXE (a WSL stub here, not a usable bash). No failing module imports infra/backend.

Notes:

  • This machine has no make; the commands above are the make all equivalents (ruff check / ruff format --check / mypy / pytest) run directly.

  • Why fix this in Octop instead of octop-harness: harness 1.0.2 is already released with the primitives missing, and infra/backend/compat.py is the layer Octop already uses to bridge released backends (it adapts the legacy deepagents_backends protocol and the S3 listing gap). The patch is idempotent — it skips backends without sandbox_fs, keeps any existing implementation, and no-ops as soon as the harness backend defines the three methods — so a future harness/deepagents release that adds them automatically supersedes it. A harness-side fix (or lifting the primitives onto deepagents' BaseSandbox, as suggested in the issue) is still the better long-term home; this PR unblocks the released versions.

  • make all passes locally (no make on this machine; equivalent commands above)

  • Added/updated tests

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed)

AI disclosure: this change was drafted with AI assistance at my request, under my direction and review.

JasonBuildAI added a commit to JasonBuildAI/Octop that referenced this pull request Oct 11, 2026
octop_harness's OpenSandbox implements the deepagents sandbox file surface
through execute/upload_files/download_files but, unlike DockerSandbox, never
defines mkdir_path / delete_path / move_path. BackendWorkspace requires those
primitives on any backend without a host mount, so workspace init on an
OpenSandbox backend raises BackendOperationNotSupportedError: mkdir is not
supported by backend type 'OpenSandbox' and the expert never starts.

Patch the three helpers in place in the Octop backend protocol-compat layer,
with the same execute commands docker_sandbox.py uses. The patch skips
backends without sandbox_fs, keeps existing implementations, and no-ops once
the harness backend defines the primitives itself.

Fixes TencentCloud#1813
_LegacyProtocolBackend defines its own no-op mkdir_path for object-store /
postgres prefixes, so patching the wrapper would install delete_path and
move_path but silently leave mkdir_path a no-op - an asymmetric half-fix for
a combination (legacy protocol + sandbox_fs) that no backend implements
today. Patch only concrete sandbox backends from the modern-protocol branch.

This branch has not been deployed

No deployments
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.

1 participant