Repository navigation
Policy update in Sandbox Policy Quickstart fails with an error #3138
Description
User Story
As a new user, I want to complete the Sandbox Policy Quickstart, so I can make sure OpenShell is working on my machine and learn how to use it.
Problem Statement
In step 4 of the quickstart, trying to run the command for updating the policy in the still-running sandbox returns the following error, and the policy is not updated:
OpenShell$ openshell policy set demo --policy examples/sandbox-policy-quickstart/policy.yaml --wait
Error: × code: 'Client specified an invalid argument', message: "process policy cannot be changed on a live sandbox (applied at startup)"
Impact / Why This Matters
If we extract the current policy from the live sandbox with openshell policy get demo --base and copy the following section into the policy.yaml file before calling openshell policy set, the update succeeds:
process:
run_as_user: sandbox
run_as_group: sandbox
However, a new user might be unable to identify this solution, preventing them from completing the quickstart, or at least forcing them to spend time trying to debug the problem. The confusion and frustration might lead the user to give up on using OpenShell altogether. Furthermore, if this same issue occurs in the context of a real application rather than just a tutorial, the user might be unable to update the policy in their running sandbox, blocking their workflow until they can find a solution.
Acceptance Criteria
- The instructions in step 4 of the Sandbox Policy Quickstart can be followed by a user successfully with no errors, without requiring modification to
policy.yamlor any other files (or, if modifications are needed, instructions for doing so are included in the quickstart).
Reproduction Steps
- Run
openshell sandbox create --name demo --no-auto-providers --detachto create a running sandbox without attaching it to the terminal. - From the top-level directory of the OpenShell repo, run
openshell policy set demo --policy examples/sandbox-policy-quickstart/policy.yaml --wait. - Observe the following output:
Error: × code: 'Client specified an invalid argument', message: "process policy cannot be changed on a live sandbox (applied at startup)" - Add the following section to the
policy.yamlfile (copied from the output ofopenshell policy get demo --base):process: run_as_user: sandbox run_as_group: sandbox - Re-run
openshell policy set demo --policy examples/sandbox-policy-quickstart/policy.yaml --wait. - Observe an output similar to the following:
✓ Policy version 2 submitted (hash: 43b6858641b9) ✓ Policy version 2 loaded (active version: 2)
Environment
- OpenShell: v0.0.116
- OS: Ubuntu 22.04
- Runtime: Docker Engine 29.7.2
Activity