Skip to content

An open-source, faster Devin alternative

TypeScript

expose rclone version, install upstream

Brian Reardonae0ee4c99fae
diff --git a/cmd/oc/internal/commands/mounts.go b/cmd/oc/internal/commands/mounts.go
index 7f9689f4..be7a564d 100644
--- a/cmd/oc/internal/commands/mounts.go
+++ b/cmd/oc/internal/commands/mounts.go
@@ -13,10 +13,11 @@ import (
// MountInfo mirrors internal/mounts.MountRecord — copied here to avoid an
// internal-package import from the CLI binary.
type MountInfo struct {
- Path string `json:"path"`
- Remote string `json:"remote"`
- Backend string `json:"backend,omitempty"`
- ReadOnly bool `json:"readOnly"`
+ Path string `json:"path"`
+ Remote string `json:"remote"`
+ Backend string `json:"backend,omitempty"`
+ ReadOnly bool `json:"readOnly"`
+ RcloneVersion string `json:"rcloneVersion,omitempty"`
}
var mountsCmd = &cobra.Command{
@@ -108,14 +109,14 @@ var mountsListCmd = &cobra.Command{
fmt.Println("No mounts.")
return
}
- headers := []string{"PATH", "REMOTE", "BACKEND", "MODE"}
+ headers := []string{"PATH", "REMOTE", "BACKEND", "MODE", "RCLONE"}
var rows [][]string
for _, m := range mounts {
mode := "rw"
if m.ReadOnly {
mode = "ro"
}
- rows = append(rows, []string{m.Path, m.Remote, m.Backend, mode})
+ rows = append(rows, []string{m.Path, m.Remote, m.Backend, mode, m.RcloneVersion})
}
printer.Table(headers, rows)
})
diff --git a/deploy/firecracker/rootfs/Dockerfile.default b/deploy/firecracker/rootfs/Dockerfile.default
index b374d18a..ed431a29 100644
--- a/deploy/firecracker/rootfs/Dockerfile.default
+++ b/deploy/firecracker/rootfs/Dockerfile.default
@@ -71,16 +71,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Process supervisor — for users who want declarative service management
# without systemd. Started on demand by users (`sudo supervisord -c ...`).
supervisor \
- # FUSE userspace bits + rclone — backs `sandbox.mounts.add(...)`. rclone is
- # one binary covering ~40 backends (S3, GCS, Azure Blob, SFTP, WebDAV, ...).
- # Mounts are torn down on hibernate (worker calls `fusermount3 -u -a`
- # before savevm) and do NOT auto-restore on wake in v1 — callers re-issue
- # mounts.add post-wake.
+ # FUSE userspace bits — rclone itself is installed from upstream below,
+ # not via apt, because Ubuntu 22.04 ships v1.53.3 (Oct 2020) which lacks
+ # years of backend fixes (Dropbox OAuth changes, GCS uniform access,
+ # newer S3-compatible providers, etc.). Backs `sandbox.mounts.add(...)`.
fuse3 \
libfuse3-3 \
- rclone \
&& rm -rf /var/lib/apt/lists/*
+# Install rclone from upstream so we track current backend support. The
+# version pinned into the rootfs is whatever was current at image build
+# time; sandboxes surface it via `mounts.list().rcloneVersion` for ops triage.
+RUN curl -fsSL https://rclone.org/install.sh | bash \
+ && rclone version
+
# Allow non-root users to pass --allow-other to FUSE mounts so processes
# running as the `sandbox` user can read mounts created via sudo.
RUN echo "user_allow_other" > /etc/fuse.conf \
diff --git a/internal/mounts/service.go b/internal/mounts/service.go
index 325945c8..b39d80c1 100644
--- a/internal/mounts/service.go
+++ b/internal/mounts/service.go
@@ -26,11 +26,18 @@ import (
// MountRecord describes one rclone-backed FUSE mount inside a sandbox.
// Process-local — tracks what was added via this worker. Credentials are
// not stored anywhere outside the in-VM tmpfs config file.
+//
+// RcloneVersion is captured at mount-add time. rclone gets installed in the
+// rootfs at image-build time, so different sandboxes can be on different
+// versions depending on which rootfs they cold-booted from. Surfacing this
+// lets ops triage "my S3 mount is broken" reports quickly — "you're on
+// v1.62, the fix is in v1.65, recreate the sandbox".
type MountRecord struct {
- Path string `json:"path"`
- Remote string `json:"remote"`
- Backend string `json:"backend,omitempty"`
- ReadOnly bool `json:"readOnly"`
+ Path string `json:"path"`
+ Remote string `json:"remote"`
+ Backend string `json:"backend,omitempty"`
+ ReadOnly bool `json:"readOnly"`
+ RcloneVersion string `json:"rcloneVersion,omitempty"`
}
// AddRequest is the wire shape the HTTP layer parses and hands to Service.Add.
@@ -94,15 +101,34 @@ func (s *Service) Add(ctx context.Context, sandboxID string, req AddRequest) (Mo
}
rec := MountRecord{
- Path: req.Path,
- Remote: req.Remote,
- Backend: req.Backend,
- ReadOnly: readOnly,
+ Path: req.Path,
+ Remote: req.Remote,
+ Backend: req.Backend,
+ ReadOnly: readOnly,
+ RcloneVersion: s.probeRcloneVersion(ctx, sandboxID),
}
s.registry.put(sandboxID, rec)
return rec, nil
}
+// probeRcloneVersion runs `rclone version` in the VM and returns the version
+// token (e.g. "v1.65.2"). Best-effort — returns empty on any failure since
+// this is purely for ops visibility, never load-bearing.
+func (s *Service) probeRcloneVersion(ctx context.Context, sandboxID string) string {
+ resp, err := s.manager.Exec(ctx, sandboxID, types.ProcessConfig{
+ Command: "sh",
+ Args: []string{"-c", "rclone version 2>/dev/null | head -1"},
+ Timeout: 5,
+ })
+ if err != nil || resp == nil || resp.ExitCode != 0 {
+ return ""
+ }
+ out := strings.TrimSpace(resp.Stdout)
+ // Expected first line: "rclone v1.65.2" — strip the prefix.
+ out = strings.TrimPrefix(out, "rclone ")
+ return out
+}
+
// Remove unmounts and forgets the mount. Idempotent — no error when the path
// isn't currently mounted.
func (s *Service) Remove(ctx context.Context, sandboxID, path string) error {
@@ -173,7 +199,9 @@ func (s *Service) doMount(ctx context.Context, sandboxID, target, remote, rclone
"--daemon",
// Cap how long rclone waits for "mount ready" before forking; without
// a timeout, an unreachable remote makes the call hang indefinitely.
- "--daemon-timeout", "30s",
+ // 60s gives cold first-mount paths headroom (DNS + S3 TLS + rclone
+ // init on a fresh sandbox can chew 30-40s before steady-state).
+ "--daemon-timeout", "60s",
"--allow-other",
}
if readOnly {
@@ -186,7 +214,10 @@ func (s *Service) doMount(ctx context.Context, sandboxID, target, remote, rclone
resp, err := s.manager.Exec(ctx, sandboxID, types.ProcessConfig{
Command: "sudo",
Args: mountArgs,
- Timeout: 30,
+ // Outer cap on the agent-side exec; needs to be > --daemon-timeout
+ // so rclone's own timeout fires first and we get a clean error
+ // message instead of an agent-killed-the-subprocess error.
+ Timeout: 75,
})
if err != nil {
return fmt.Errorf("rclone mount: %w", err)
diff --git a/sdks/python/opencomputer/mounts.py b/sdks/python/opencomputer/mounts.py
index cf6a936d..5d3b9067 100644
--- a/sdks/python/opencomputer/mounts.py
+++ b/sdks/python/opencomputer/mounts.py
@@ -19,12 +19,19 @@ MountBackend = Literal["s3", "gcs", "azureblob", "sftp", "webdav", "dropbox"]
@dataclass
class MountInfo:
- """An active mount as tracked by the worker."""
+ """An active mount as tracked by the worker.
+
+ ``rclone_version`` is the rclone version inside the sandbox captured at
+ mount-add time (e.g. ``"v1.65.2"``). rclone is baked into the rootfs, so
+ different sandboxes may carry different versions; this lets ops triage
+ backend-specific bug reports quickly.
+ """
path: str
remote: str
read_only: bool
backend: str = ""
+ rclone_version: str = ""
@dataclass
@@ -113,4 +120,5 @@ def _mount_from_dict(data: dict) -> MountInfo:
remote=data["remote"],
backend=data.get("backend", ""),
read_only=data.get("readOnly", True),
+ rclone_version=data.get("rcloneVersion", ""),
)
diff --git a/sdks/typescript/src/mounts.ts b/sdks/typescript/src/mounts.ts
index c4ad4db7..c8afa5e8 100644
--- a/sdks/typescript/src/mounts.ts
+++ b/sdks/typescript/src/mounts.ts
@@ -46,6 +46,12 @@ export interface MountInfo {
remote: string;
backend?: string;
readOnly: boolean;
+ /**
+ * rclone version inside the sandbox at the moment this mount was added
+ * (e.g. `"v1.65.2"`). Captured for ops triage — rclone is baked into the
+ * rootfs, so different sandboxes may carry different versions.
+ */
+ rcloneVersion?: string;
}
export class Mounts {