Skip to content

feat: support custom sandbox entrypoint command #848

Description

@matifali

Problem Statement

The sandbox always runs sleep infinity — hardcoded in the k8s driver. There's no API field to override this.
I'm integrating Coder workspaces with OpenShell sandboxes via the Terraform provider. The e2e flow works but the Coder agent has to be manually bootstrapped after sandbox creation — there's no way to run a custom entrypoint at startup. The only workaround is openshell sandbox exec after the sandbox reaches Ready, which can't be expressed declaratively in Terraform.
I imagine this would affect any orchestrator that needs to run a process inside the sandbox at creation time.

Proposed Design

I think the minimal change would be adding a command field to SandboxSpec and threading it through to the k8s driver. When set, the driver writes it to OPENSHELL_SANDBOX_COMMAND instead of sleep infinity. When empty, behavior is unchanged.
The sandbox supervisor already reads from OPENSHELL_SANDBOX_COMMAND and supports arbitrary commands — the gap is just that the k8s driver always overwrites it.
The files I think would need changes (though I might be missing something):

  • proto/openshell.proto — add repeated string command to SandboxSpec
  • proto/compute_driver.proto — add the same to DriverSandboxSpec
  • crates/openshell-server/src/compute/mod.rs — pass it through driver_sandbox_spec_from_public
  • crates/openshell-driver-kubernetes/src/driver.rs — use spec.command in apply_required_env instead of the hardcoded value

Alternatives Considered

  1. Override via environment map — I tried passing OPENSHELL_SANDBOX_COMMAND through the sandbox's environment field in Terraform. Doesn't work — upsert_env in apply_required_env overwrites user-provided values.
  2. Post-creation exec — Using openshell sandbox exec after the sandbox reaches Ready. This works but adds latency, requires polling, and can't be automated declaratively through Terraform.
  3. Bake into the image — Tried building a custom image with an entrypoint. The sandbox supervisor ignores the image's ENTRYPOINT/CMD and runs OPENSHELL_SANDBOX_COMMAND directly.

Agent Investigation

  • Traced OPENSHELL_SANDBOX_COMMAND from the supervisor (crates/openshell-sandbox/src/main.rs) through the k8s driver (driver.rs:1284) — confirmed the hardcoding
  • The supervisor already supports arbitrary commands (CLI args → env var → /bin/bash fallback), so no supervisor changes should be needed
  • The gateway maps public spec → driver spec in driver_sandbox_spec_from_public (crates/openshell-server/src/compute/mod.rs:617)
  • Tested all three alternatives above against a live gateway (v0.0.28)

Checklist

  • I've reviewed existing issues and the architecture docs
  • This is a design proposal, not a "please build this" request

Activity

  1. self-assigned this
    on Apr 15, 2026
  2. matifali commented on May 11, 2026

    @matifali
    Author

    Hi @kirit93 and @johntmyers, what do we think of issues that are assigned but are removed from the Roadmap? Thanks. Please let me know if you are open to contributions to this improvement.

  3. TaylorMutch commented on Jul 13, 2026

    @TaylorMutch
    Collaborator

    Supporting custom sandbox entrypoint is on our radar. There are a few other changes in flight but I think this is likely a good candidate in the near future.

  4. changed the title [-]support custom sandbox entrypoint command[/-] [+]feat: support custom sandbox entrypoint command[/+] on Jul 13, 2026
  5. github-actions commented on Aug 29, 2026

    @github-actions

    This issue has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. Comment or remove the state:stale label to keep it open.

  6. matifali commented on Aug 30, 2026

    @matifali
    Author

    bumping

  7. github-actions commented on Sep 16, 2026

    @github-actions

    This issue has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. Comment or remove the state:stale label to keep it open.

  8. matifali commented on Sep 17, 2026

    @matifali
    Author

    bumping

  9. matifali commented on Sep 25, 2026

    @matifali
    Author

    @johntmyers can you also link to docs on how to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions