Skip to content

Use .gitignore also for downloads #5514

Open

Description

@pschoen-itsc

User Story

I use OpenShell to write python software with OpenCode.
During the upload of the source code directory files which are ignored by git will not be uploaded, but if the agent creates such files, they will be downloaded and potentially overwrite the files outside the sandbox.

Problem Statement

Transferring files out of the sandbox (download) does not use the same logic as upload (ignoring files which are ignored by git).
Some workarounds are to only download only certain directories, which can be cumbersome and / or configuring the sandbox so for example my venv is created in a different location.
If the repo was cloned inside the sandbox also the .git directory is downloaded from the sandbox, which can also be problematic (cloned inside sandbox via http, overwrites ssh origins on the host and I could imagine a lot of other potential problems).

Impact / Why This Matters

This can lead to big downloads (.venv, node_modules, etc. You get easily to hundreds of MiB here) and can overwrite other files, which are not in source control (like a .env file). This increases the amount of "untrusted" files to check (python venv, node_modules).

Proposed Design

Downloading only files from the sandbox which are not ignored by git on the host would solve this. Transfering files in and out would be much more predictable. No overwriting of untracked files happens, if you keep .gitignore up to date.
The CLI for download could work the same as for upload, so give a warning if you are not in a git directory.

Acceptance Criteria

  • Files downloaded from the sandbox are checked against the host directories .gitignore rules. No file, which is ignored by git, can be downloaded from the sandbox without explicit permission.

Alternatives Considered

As the CLI already implements this feature for uploads I would think it is best suited to be implemented there also for the download.
There is also an open issue to review overall file / dir changes made by a download, but it does not really solve the problem.

Agent Investigation

No response

Checklist

  • I've reviewed existing issues and the published docs
  • This is a design proposal, not a "please build this" request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions