Skip to content

Commit ec4815f

Browse files
feat(sandbox): honor OCI image working directories
Closes #2526 Signed-off-by: Matthew Grossman <[email protected]>
1 parent bc14018 commit ec4815f

30 files changed

Lines changed: 1120 additions & 195 deletions

File tree

‎.agents/skills/generate-sandbox-policy/SKILL.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ filesystem_policy:
466466
- /etc
467467
- /var/log
468468
read_write:
469-
- /sandbox
470469
- /tmp
471470
- /dev/null
472471

‎.agents/skills/generate-sandbox-policy/examples.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,6 @@ filesystem_policy:
823823
- /etc
824824
- /var/log
825825
read_write:
826-
- /sandbox
827826
- /tmp
828827
- /dev/null
829828

‎.agents/skills/openshell-cli/SKILL.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ openshell sandbox ssh-config my-sandbox >> ~/.ssh/config
220220
### Upload and download files
221221

222222
```bash
223-
# Upload local files to sandbox
224-
openshell sandbox upload my-sandbox ./src /sandbox/src
223+
# Upload local files to the sandbox working directory
224+
openshell sandbox upload my-sandbox ./src
225225

226226
# Download files from sandbox
227227
openshell sandbox download my-sandbox /sandbox/output ./local-output
@@ -231,6 +231,10 @@ Uploads honor `.gitignore` by default. Add `--no-git-ignore` only when ignored f
231231

232232
Uploads preserve symlinks, including dangling symlinks, instead of dereferencing their targets. A symlink source bypasses Git-aware filtering so the link itself is archived.
233233

234+
When the upload destination is omitted, the CLI discovers the remote working
235+
directory. Downloads must use an absolute sandbox path within that same
236+
canonical working directory.
237+
234238
### Execute a non-interactive command
235239

236240
```bash

‎.agents/skills/openshell-cli/cli-reference.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,11 @@ Open an interactive SSH shell. The name defaults to the last-used sandbox. `--ed
258258

259259
### `openshell sandbox upload <name> <path> [dest]`
260260

261-
Upload files using tar-over-SSH. The destination defaults to the container working directory. `.gitignore` filtering is enabled unless `--no-git-ignore` is passed.
261+
Upload files using tar-over-SSH. The CLI discovers the canonical remote working directory when the destination is omitted. `.gitignore` filtering is enabled unless `--no-git-ignore` is passed.
262262

263263
### `openshell sandbox download <name> <path> [dest]`
264264

265-
Download files using tar-over-SSH. The local destination defaults to `.`.
265+
Download files using tar-over-SSH. The sandbox source must be an absolute path within the canonical remote working directory. The local destination defaults to `.`.
266266

267267
### `openshell sandbox ssh-config [name]`
268268

‎architecture/compute-runtimes.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ The gateway preserves whether each policy process field was omitted. The active
131131
driver then supplies one authoritative identity input to the supervisor:
132132

133133
- Docker and Podman inspect the final sandbox image, pin container creation to
134-
its immutable image ID, and pass its raw OCI `Config.User`.
134+
its immutable image ID, and pass its raw OCI `Config.User`. They also resolve
135+
the workspace from OCI `Config.WorkingDir` during that inspection.
135136
- Kubernetes passes its platform-resolved numeric UID/GID, including OpenShift
136137
SCC-derived values.
137138
- VM keeps its existing guest identity behavior.
@@ -144,6 +145,16 @@ and uses the same privilege-drop path for direct and SSH children. When a
144145
declaration omits the group, the supervisor fills it with the user's numeric
145146
primary GID. It does not rewrite the account files.
146147

148+
Docker and Podman use an absolute OCI working directory as the workspace. An
149+
empty or root (`/`) declaration falls back to `/sandbox`, which OpenShell
150+
creates inside the container when needed. Before direct or SSH children start,
151+
the supervisor transfers ownership of only the workspace directory to the
152+
completed UID/GID. Image-provided contents and nested mounts retain their
153+
ownership. The resolved workspace is also the child cwd and `HOME`, the
154+
automatic writable policy path, and Podman's managed workspace-volume mount
155+
target. Kubernetes/OpenShift keep their `/sandbox` PVC and `fsGroup` behavior,
156+
and VM keeps its `/sandbox` guest initialization path.
157+
147158
Sandbox creation fails before the workload becomes ready when a required image
148159
identity is absent, malformed, unknown, ambiguous, or resolves to UID/GID 0.
149160
The supervisor itself remains root so it can establish isolation before

0 commit comments

Comments
 (0)