Repository navigation
Description
Parent Epic: #9802
Outcome
Route existing production sandbox upload, download, and copy operations through a typed, asynchronous NemoClaw OpenShell interface. Preserve the behavior and security controls of each consumer. File transfer retains its CLI implementation.
Scope decision
Decision: Accept
Reason: This is a behavior-preserving adapter migration under #9802. It adds no transfer protocol, supported integration, public command, or credential model.
Placement: Transfer requests, command construction, gateway targeting, subprocess handling, failure mapping, and diagnostic redaction belong under src/lib/adapters/openshell/. Use a shared package boundary where the plugin needs the same implementation. Do not duplicate the CLI implementation in the plugin.
Caller path selection, session archive contents, config parsing, snapshot ownership repair, destination publication, and recovery decisions remain with their current owners. OpenShell's internal archive and SSH implementation remains upstream-owned.
Accountable maintainer and implementation owner: @rsliter.
Validation plan: Typed consumer fakes, CLI argument and result tests, existing filesystem publication and snapshot tests, and focused real-process or sandbox evidence for changed external boundaries. Run focused checks, CLI and plugin type-checking as applicable, npm run review:local, and repository PR validation before publication.
Included consumers
src/lib/actions/sandbox/upload.tsanddownload.ts, including transfer-related source probes through the existing typed command boundary.- All three download paths in
src/lib/actions/sandbox/sessions/export.ts: directory, tar, and JSONL export. Preserve existing artifact verification and cleanup. fetchGatewayAuthTokenFromSandboxinsrc/lib/onboard/dashboard.ts, including its asynchronous callers and private temporary-file lifecycle.restoreIntoSandboxinnemoclaw/src/blueprint/snapshot.ts, including transfer-dependent repair commands through the typed command boundary. Preserve current best-effort repair behavior.
Refresh this inventory against the implementation base before coding. Record any additional production transfer consumer before declaring the migration complete.
Typed boundary
- Expose only the upload, download, and host-to-sandbox copy operations required by these consumers. Do not add unused transfer directions.
- Requests identify the sandbox, explicit gateway target, source and destination paths, and only required execution options. Reuse existing gateway target and command/SSH contracts.
- Keep OpenShell argv, raw output, process objects, SSH configuration, and temporary transport paths inside the implementation.
- Distinguish reported transfer success from caller verification and publication. A successful process exit does not prove that a download produced an artifact.
- Return bounded typed failures for invalid requests, unavailable execution, timeout/interruption, transfer failure, and indeterminate effects. Classify more specific causes only when the evidence supports them.
- Do not automatically retry a mutation or fall back to another transport after uncertain completion. Preserve the caller's recovery state.
- Public action results may retain caller-selected paths. Transfer diagnostics must not expose credential values, payload contents, SSH tokens, or internal credential/configuration paths.
Acceptance evidence
User transfers
- Relative and absolute host paths, trailing separators, default destinations, file and directory copies, and overwrite behavior retain the implementation base's semantics.
- Preserve sandbox liveness checks, lifecycle locks, and existing unsupported-runtime restrictions.
- Download rejects missing sources, symlink sources or ancestors, unsafe directory members, and unobservable or changed source types as the current implementation requires. Preserve the missing-source exit code.
- Source paths remain positional data rather than shell code. Coordinate leading-hyphen handling with nemoclaw download rejects a leading-hyphen sandbox source path as an unknown flag #11378 and PR fix(cli): prevent leading hyphens in download paths from being parsed as flags #11388; preserve any fix merged before implementation.
- Exit zero with no newly staged artifact fails before publication. A failed or unverified transfer cannot publish as a successful download.
- Preserve destination symlink rejection, descriptor/identity checks, private temporary files, file modes, and cleanup from the existing publication helper.
- A failure during directory publication remains a failure and may leave already published entries. This issue does not introduce directory-wide transactions or rollback.
Export and onboarding
- Directory, tar, and JSONL session exports retain their existing contents, destination handling, private output permissions, manifests, and cleanup warnings.
- Preserve validation of session identifiers and existing archive construction. Do not move session-format decisions into the transfer adapter.
- Onboarding token download keeps payloads in its private temporary directory and caller memory. The token is passed only to the existing authorized onboarding consumer, never returned as transfer diagnostics.
- Failed transfer, missing file, or invalid config retains the caller's existing failure result. Cleanup runs after success and failure. Preserve and document the existing best-effort cleanup limitation; do not claim guaranteed erasure.
Snapshot restore
- Missing snapshot input or failed copy retains the existing unsuccessful restore result.
- Successful copy retains legacy-link repair and ownership repair order, including their existing best-effort failure behavior.
- Snapshot creation, formats, sanitization, and restore lifecycle policy remain unchanged.
Failure and security
- Malformed requests and invalid target identities fail before spawning a transfer. Authentication or transport failure must not become success.
- Timeout, interruption, nonzero exit, and unknown remote effects remain distinguishable where the execution boundary supports that distinction. No speculative mutation retry occurs.
- Remove only temporary resources owned by this invocation. Never remove caller-owned source or destination data as transfer cleanup.
- Preserve existing credential environment filtering and gateway selection protections. Reuse SSH credential custody and cleanup if the transfer implementation directly needs SSH; do not add a second SSH stack.
- Do not add a universal size quota. Preserve existing consumer limits and test actual resource/output-limit failures at their owning boundary.
- Do not claim snapshot consistency, checksum verification, universal traversal rejection, or remote rollback beyond the current consumer's controls.
Delivery order
1. User upload and download
Implement the minimal typed transfer interface and CLI implementation. Migrate both user commands and related source probes. Keep filesystem publication policy with its existing owner. Prove path, source-validation, staging, publication, error, and cleanup behavior.
This delivers an independently usable typed boundary for public transfers. The issue remains open for the consumers below.
2. Session export and onboarding token download
Reuse the interface for directory, tar, and JSONL exports and the onboarding token download. Carry asynchronous propagation through existing callers without detaching work or releasing lifecycle locks early. Prove private artifact custody, domain validation, and cleanup after partial failure.
3. Plugin snapshot restore
Reuse the same transfer implementation through a package-compatible boundary. Migrate copy and transfer-dependent repair commands. Prove copy failure handling, repair ordering, plugin loading, and installed-package behavior.
Each delivery includes its tests and owning repository guidance. Before a partial PR merges, enumerate remaining consumers and satisfy #9802's partial-delivery rule with accepted, assigned follow-on issues. Do not close #9810 until its accepted consumers are migrated or explicitly reassigned under that rule. Record final dispositions in #9813.
Dependencies and related work
- Phase 1 slice 1: Route sandbox inventory and readiness through the OpenShell adapter #9803 and Phase 1 slice 4: Route exec, interactive sessions, and SSH through the OpenShell adapter #9804 are closed. Their inventory, buffered command, and SSH boundaries are available on main, including Phase 1 slice 4b: Route buffered sandbox exec consumers through the OpenShell adapter #10991 and Phase 1 slice 4c: Route SSH command transport and version probes through the OpenShell adapter #10992. Start implementation from a base containing them.
- Reuse
OpenShellGatewayTarget,OpenShellSandboxBufferedCommandExecutor, andOpenShellSandboxSshExecutorwhere needed. Do not recreate their process, targeting, or credential machinery. - nemoclaw download rejects a leading-hyphen sandbox source path as an unknown flag #11378 / PR fix(cli): prevent leading hyphens in download paths from being parsed as flags #11388 overlaps download path handling. Refresh its status before editing
download.ts. - Coordinate snapshot changes with active snapshot PRs, including fix(snapshot): remove host Python sanitizer dependency #11181 and fix(snapshot): normalize GPU restore authority #11032, if they remain open at implementation time.
- Phase 1 slice 11: Complete the OpenShell CLI consumer sweep #9813 owns the final consumer sweep and executable-level exception disposition.
Test plan
- Consumer tests use typed transfer/command fakes and assert decisions, artifacts, recovery, and cleanup rather than OpenShell argv.
- CLI implementation tests own argv, explicit gateway targeting, environment filtering, error classification, output suppression/redaction, and timeout/interruption handling.
- Extend existing upload, download, session export,
download-verify, onboarding dashboard, and plugin snapshot tests. - Use real filesystem tests for symlinks, source/destination identity changes, private publication, permissions, partial directories, and cleanup. Use controlled real child processes when process termination is the changed contract.
- Use the narrowest existing live sandbox target when proving OpenShell archive/copy semantics or ownership requires the real sandbox. Record the tested commit, runtime version, selected behavior, result, and cleanup evidence. Do not add a broad live suite for deterministic adapter logic.
- Verify plugin packaging and loading through the package-contract lane if the shared implementation boundary changes.
Deferred scope and explicit exclusions
- SDK/gRPC file transfer, dependency upgrades, new protocols, remote-to-remote copy, resume, retries, checksums, atomic directory replacement, new size limits, and new overwrite rules.
- Generic config reads/writes that use exec or privileged execution rather than transfer. They remain with their existing owning capabilities;
sandbox/config.tsis not a file-transfer migration merely because its header mentions download/upload. - Bearer-token reads already using exec, snapshot creation/sanitization, and session archive-format redesign.
scripts/backup-workspace.sh,tools/openshell-agent/runtime.mts, direct executable E2E clients, and manual OpenShell documentation examples. These are inventoried executable-level consumers for Phase 1 slice 11: Complete the OpenShell CLI consumer sweep #9813 disposition, not application transfers silently added to this issue.
Stop conditions
Stop for a decision if parity requires a new security policy, retry/rollback behavior, credential lifetime, public transfer guarantee, or wider product scope. Record newly discovered defects separately unless their repair is required to avoid a regression from this migration.
Slice 1 output parity
Capability slice 1 preserves inherited OpenShell stdout/stderr, including existing progress and diagnostics. Redaction applies to typed adapter results and adapter-generated errors. Changing or filtering upstream terminal output is outside this PR.
Activity
cv commentedon Aug 28, 2026
docs/manage-sandboxes/transfer-state-manually.mdx:101— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:102— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:103— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:104— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:105— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:106— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:119— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:120— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:121— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:122— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:123— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:133— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:134— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:135— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:136— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:19— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:28— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:29— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:30— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:31— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:32— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:33— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:47— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:48— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:49— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:50— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:51— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:63— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:64— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:78— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:79— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:8— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:80— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:81— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:82— Sandbox-transfer call or contract.docs/manage-sandboxes/transfer-state-manually.mdx:93— Sandbox-transfer call or contract.docs/manage-sandboxes/workspace-files.mdx:205— Sandbox-transfer call or contract.docs/monitoring/monitor-sandbox-activity.mdx:80— Sandbox-transfer call or contract.docs/reference/cli-selection-guide.mdx:129— Sandbox-transfer call or contract.docs/reference/cli-selection-guide.mdx:273— Sandbox-transfer call or contract.nemoclaw/src/blueprint/snapshot.test.ts:224— Sandbox-transfer call or contract.nemoclaw/src/blueprint/snapshot.ts:143— Sandbox-transfer call or contract.nemoclaw/src/blueprint/snapshot.ts:144— Sandbox-transfer call or contract.nemoclaw/src/blueprint/snapshot.ts:193— Sandbox-transfer call or contract.scripts/backup-workspace.sh:107— Sandbox-transfer call or contract.scripts/backup-workspace.sh:140— Sandbox-transfer call or contract.scripts/backup-workspace.sh:72— Sandbox-transfer call or contract.scripts/backup-workspace.sh:99— Sandbox-transfer call or contract.src/lib/actions/sandbox/download.ts:116— Sandbox-transfer call or contract.src/lib/actions/sandbox/download.ts:117— Sandbox-transfer call or contract.src/lib/actions/sandbox/sessions/download-verify.ts:28— Sandbox-transfer call or contract.src/lib/actions/sandbox/sessions/download-verify.ts:31— Sandbox-transfer call or contract.src/lib/actions/sandbox/sessions/download-verify.ts:85— Sandbox-transfer call or contract.src/lib/actions/sandbox/sessions/export.ts:199— Sandbox-transfer call or contract.src/lib/actions/sandbox/sessions/export.ts:256— Sandbox-transfer call or contract.src/lib/actions/sandbox/sessions/export.ts:381— Sandbox-transfer call or contract.src/lib/actions/sandbox/upload.ts:46— Sandbox-transfer call or contract.src/lib/onboard/dashboard.ts:613— Sandbox-transfer call or contract.src/lib/onboard/dashboard.ts:614— Sandbox-transfer call or contract.src/lib/resources-cmd.test.ts:177— Sandbox-transfer call or contract.src/lib/resources-cmd.test.ts:180— Sandbox-transfer call or contract.test/e2e/fixtures/clients/sandbox.ts:147— Sandbox-transfer call or contract.test/e2e/support/e2e-clients.test.ts:710— Sandbox-transfer call or contract.test/e2e/support/e2e-clients.test.ts:717— Sandbox-transfer call or contract.test/e2e/support/e2e-clients.test.ts:718— Sandbox-transfer call or contract.tools/openshell-agent/runtime.mts:341— Sandbox-transfer call or contract.tools/openshell-agent/runtime.mts:343— Sandbox-transfer call or contract.rsliter commentedon Sep 10, 2026
Slice 1 is in draft PR #11496 with inherited output parity. The accepted deferred consumers now have assigned follow-ons under #9802: #11497 owns session-export and onboarding downloads; #11498 owns plugin snapshot restore. Both are assigned to @rsliter. This capability issue remains open.
refactor(transfers): await typed user upload and download (#11496)