Home · Developers · Guides · Remote Workspace

Workspace

Remote Workspace

Confined remote clones

Git repository cloning and remote repository management support with production-quality git integration.

Components

from novacoder.workspace import RemoteWorkspaceManager, RemoteRepository

manager = RemoteWorkspaceManager("/path/to/workspace")
repo = RemoteRepository(url="https://github.com/user/repo", provider="github", branch="main")
manager.clone_repository(repo)

Features

  • Git Integration: Full git clone and pull functionality using subprocess
  • Error Handling: Comprehensive error logging for all git operations
  • Repository Info: Get repository information including current branch, latest commit, and remote URL
  • Branch Support: Clone specific branches from remote repositories
  • Provider Support: Works with GitHub, GitLab, Bitbucket, and other git providers

Usage

Clone Repository

repo = RemoteRepository(
    url="https://github.com/user/repo",
    provider="github",
    branch="main",
    local_path="my-project"
)
success = manager.clone_repository(repo)
if success:
    print("Repository cloned successfully")

Pull Changes

repo = RemoteRepository(
    url="https://github.com/user/repo",
    provider="github",
    branch="main",
    local_path="my-project"
)
success = manager.pull_changes(repo)
if success:
    print("Changes pulled successfully")

Get Repository Information

info = manager.get_repository_info(repo)
if info:
    print(f"Current branch: {info['current_branch']}")
    print(f"Latest commit: {info['latest_commit']['hash']}")
    print(f"Remote URL: {info['remote_url']}")

Integration

service = WorkspaceService()
manager = service.remote_manager

Error Handling

All git operations include comprehensive error handling and logging:

  • Git availability checks before operations
  • Detailed error messages for failed operations
  • Debug-level logging for troubleshooting
  • Graceful degradation when git is not available

API Endpoints

  • GET /api/workspace/remote/health, Remote workspace manager status.
  • POST /api/workspace/remote/clone, Clone a Git repository into the workspace.
  • POST /api/workspace/remote/status, Get status of a cloned repository.

Hardening & IDE Clone Flow

RemoteWorkspaceManager was hardened (see report 27):

  • Clone destinations are confined to the manager's base directory, local_path/names containing .. or absolute paths are rejected.
  • url and branch are validated before reaching git: URLs must be http(s)/ssh/git/file or a local path, and any argument starting with - is rejected, preventing git option injection (e.g. --upload-pack=). Branch names are restricted to git ref characters.
  • All git subprocess calls run with timeouts.
  • RemoteRepository.provider defaults to "generic".

POST /api/workspace/remote/clone accepts {url, branch?, local_path?, name?, open?}; the blocking clone runs via run_in_threadpool. With open: true a successful clone is registered as a multi-workspace root and switched active, the React IDE toolbar exposes a "clone" form that uses this flow (Repository URL + optional branch/directory + "Clone & open").

Tests: tests/test_ide_remote.py (8 tests, offline, uses local git repos as clone sources).

Source: wiki/workspace-remote.md · rendered 2026-11-10