opensandbox-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opensandbox_cli/__init__.py +20 -0
- opensandbox_cli/__main__.py +20 -0
- opensandbox_cli/client.py +127 -0
- opensandbox_cli/commands/__init__.py +13 -0
- opensandbox_cli/commands/command.py +359 -0
- opensandbox_cli/commands/config_cmd.py +183 -0
- opensandbox_cli/commands/devops.py +123 -0
- opensandbox_cli/commands/egress.py +98 -0
- opensandbox_cli/commands/file.py +442 -0
- opensandbox_cli/commands/sandbox.py +580 -0
- opensandbox_cli/commands/skills.py +775 -0
- opensandbox_cli/config.py +160 -0
- opensandbox_cli/main.py +138 -0
- opensandbox_cli/output.py +363 -0
- opensandbox_cli/py.typed +1 -0
- opensandbox_cli/skill_registry.py +184 -0
- opensandbox_cli/skills/opensandbox-command-execution.md +215 -0
- opensandbox_cli/skills/opensandbox-file-operations.md +244 -0
- opensandbox_cli/skills/opensandbox-network-egress.md +179 -0
- opensandbox_cli/skills/opensandbox-sandbox-lifecycle.md +305 -0
- opensandbox_cli/skills/opensandbox-sandbox-troubleshooting.md +177 -0
- opensandbox_cli/utils.py +212 -0
- opensandbox_cli-0.1.0.dist-info/METADATA +597 -0
- opensandbox_cli-0.1.0.dist-info/RECORD +27 -0
- opensandbox_cli-0.1.0.dist-info/WHEEL +4 -0
- opensandbox_cli-0.1.0.dist-info/entry_points.txt +3 -0
- opensandbox_cli-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: network-egress
|
|
3
|
+
description: Use OpenSandbox egress commands to inspect and patch runtime outbound network policy for a sandbox. Trigger when users want to allow or deny domains, confirm current egress rules, or debug outbound network access problems caused by policy.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenSandbox Network Egress
|
|
7
|
+
|
|
8
|
+
Manage outbound network access with `osb egress`. Treat runtime egress patching as a policy workflow, not just a one-line command. Always inspect current state, patch only what is needed, then verify both policy text and actual network behavior.
|
|
9
|
+
|
|
10
|
+
## When To Use
|
|
11
|
+
|
|
12
|
+
- the user wants to see current egress rules for a sandbox
|
|
13
|
+
- the user wants to allow or deny one or more outbound domains for an existing sandbox
|
|
14
|
+
- the user reports outbound access issues and runtime policy may be the cause
|
|
15
|
+
- the user wants an exact OpenSandbox command for runtime network policy changes
|
|
16
|
+
|
|
17
|
+
## Configuration Resolution
|
|
18
|
+
|
|
19
|
+
Before suggesting egress commands, resolve the active OpenSandbox connection configuration:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
osb config show -o json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Check the resolved values for:
|
|
26
|
+
|
|
27
|
+
- `domain`
|
|
28
|
+
- `api_key`
|
|
29
|
+
- `protocol`
|
|
30
|
+
|
|
31
|
+
`osb config show` redacts the API key. Use it to confirm the effective target, not to recover the credential itself.
|
|
32
|
+
|
|
33
|
+
Do not assume the user configures OpenSandbox only through environment variables. Work from the resolved configuration that the CLI will actually use.
|
|
34
|
+
|
|
35
|
+
Hard stop:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
osb config show -o json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If `domain` is missing, stop and set it before policy changes:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
osb config set connection.domain <host:port> -o json
|
|
45
|
+
osb config show -o json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If auth is required and `api_key` is missing, stop and set it before policy changes:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
osb config set connection.api_key <api-key> -o json
|
|
52
|
+
osb config show -o json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Policy Model
|
|
56
|
+
|
|
57
|
+
Runtime egress policy consists of:
|
|
58
|
+
|
|
59
|
+
- `defaultAction`
|
|
60
|
+
The fallback action when no rule matches
|
|
61
|
+
- `egress`
|
|
62
|
+
An ordered list of allow or deny rules
|
|
63
|
+
|
|
64
|
+
Important semantics:
|
|
65
|
+
|
|
66
|
+
- if `defaultAction` is omitted, the policy model defaults to `deny`
|
|
67
|
+
- runtime patching uses merge semantics; it is not a full policy replacement workflow
|
|
68
|
+
- targets should be domain-based, such as `pypi.org` or `*.example.com`
|
|
69
|
+
- do not assume IP or CIDR targets are supported in this workflow
|
|
70
|
+
|
|
71
|
+
Use `osb egress patch` for already-created sandboxes. Use `osb sandbox create --network-policy-file ...` when the user wants to define policy at sandbox creation time.
|
|
72
|
+
|
|
73
|
+
## Golden Paths
|
|
74
|
+
|
|
75
|
+
Inspect and patch:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
osb egress get <sandbox-id> -o json
|
|
79
|
+
osb egress patch <sandbox-id> --rule allow=pypi.org -o json
|
|
80
|
+
osb egress get <sandbox-id> -o json
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Inspect, patch, and verify actual behavior:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
osb egress get <sandbox-id> -o json
|
|
87
|
+
osb egress patch <sandbox-id> --rule allow=www.github.com --rule deny=pypi.org -o json
|
|
88
|
+
osb egress get <sandbox-id> -o json
|
|
89
|
+
osb command run <sandbox-id> -o raw -- curl -I https://www.github.com
|
|
90
|
+
osb command run <sandbox-id> -o raw -- curl -I https://pypi.org
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Inspect Current Policy
|
|
94
|
+
|
|
95
|
+
Start by reading the current runtime policy:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
osb egress get <sandbox-id> -o json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Use this before patching whenever the existing state matters.
|
|
102
|
+
|
|
103
|
+
## Patch Runtime Rules
|
|
104
|
+
|
|
105
|
+
Patch only the rules the user actually asked for:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
osb egress patch <sandbox-id> --rule allow=pypi.org -o json
|
|
109
|
+
osb egress patch <sandbox-id> --rule deny=internal.example.com -o json
|
|
110
|
+
osb egress patch <sandbox-id> --rule allow=*.example.com -o json
|
|
111
|
+
osb egress patch <sandbox-id> --rule allow=www.github.com --rule deny=pypi.org -o json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Rules:
|
|
115
|
+
|
|
116
|
+
- keep patches narrow and auditable
|
|
117
|
+
- express changes as explicit `allow` or `deny` entries
|
|
118
|
+
- do not present patching as a full replacement of the policy object
|
|
119
|
+
|
|
120
|
+
## Behavior Verification
|
|
121
|
+
|
|
122
|
+
Do not stop at policy text if the user is debugging connectivity. Verify runtime behavior with actual commands:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
osb command run <sandbox-id> -o raw -- curl -I https://pypi.org
|
|
126
|
+
osb command run <sandbox-id> -o raw -- curl -I https://www.github.com
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Use:
|
|
130
|
+
|
|
131
|
+
- `egress get` to confirm the current rule set
|
|
132
|
+
- `osb command run ... -o raw -- curl ...` to verify whether outbound access is actually allowed or denied
|
|
133
|
+
|
|
134
|
+
## Runtime Notes
|
|
135
|
+
|
|
136
|
+
- use lifecycle create-time policy files when the sandbox has not been created yet
|
|
137
|
+
- use `osb egress patch` only for an already-running or already-created sandbox
|
|
138
|
+
- if network access is still wrong after a correct patch, continue with `sandbox-troubleshooting` instead of assuming the patch command failed silently
|
|
139
|
+
|
|
140
|
+
## Response Pattern
|
|
141
|
+
|
|
142
|
+
Structure the answer as:
|
|
143
|
+
|
|
144
|
+
1. exact `osb egress` command
|
|
145
|
+
2. what policy change it applies
|
|
146
|
+
3. the verification command to run next
|
|
147
|
+
|
|
148
|
+
Keep command examples concrete and ready to paste.
|
|
149
|
+
|
|
150
|
+
## Minimal Closed Loops
|
|
151
|
+
|
|
152
|
+
Allow one domain and verify:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
osb egress get <sandbox-id> -o json
|
|
156
|
+
osb egress patch <sandbox-id> --rule allow=pypi.org -o json
|
|
157
|
+
osb egress get <sandbox-id> -o json
|
|
158
|
+
osb command run <sandbox-id> -o raw -- curl -I https://pypi.org
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Flip behavior between two domains:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
osb egress get <sandbox-id> -o json
|
|
165
|
+
osb egress patch <sandbox-id> --rule allow=www.github.com --rule deny=pypi.org -o json
|
|
166
|
+
osb egress get <sandbox-id> -o json
|
|
167
|
+
osb command run <sandbox-id> -o raw -- curl -I https://www.github.com
|
|
168
|
+
osb command run <sandbox-id> -o raw -- curl -I https://pypi.org
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Best Practices
|
|
172
|
+
|
|
173
|
+
- resolve the active connection configuration before patching policy on a specific server
|
|
174
|
+
- prefer `osb config show` over checking isolated environment variables
|
|
175
|
+
- inspect before patching
|
|
176
|
+
- patch only the minimum required domains
|
|
177
|
+
- verify actual behavior, not just rule text
|
|
178
|
+
- prefer explicit domain targets over broad wildcards unless the user truly needs them
|
|
179
|
+
- prefer create-time policy files for initial sandbox provisioning and runtime patching for later adjustment
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sandbox-lifecycle
|
|
3
|
+
description: Use OpenSandbox CLI lifecycle commands to create, inspect, verify, renew, pause, resume, expose, and terminate sandboxes. Trigger when users want help provisioning a sandbox, choosing create flags, checking runtime state, retrieving endpoints, or safely cleaning up sandboxes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenSandbox Sandbox Lifecycle
|
|
7
|
+
|
|
8
|
+
Use OpenSandbox lifecycle commands directly instead of giving generic container advice. Prefer a verified lifecycle flow over isolated commands.
|
|
9
|
+
|
|
10
|
+
## When To Use
|
|
11
|
+
|
|
12
|
+
- the user wants to create a sandbox for a task or workflow
|
|
13
|
+
- the user needs to inspect sandbox state or health
|
|
14
|
+
- the user wants to expose a service port through an OpenSandbox endpoint
|
|
15
|
+
- the user wants to renew, pause, resume, or terminate a sandbox
|
|
16
|
+
- the user is unsure which create flags or file-based inputs to use
|
|
17
|
+
|
|
18
|
+
## Configuration Resolution
|
|
19
|
+
|
|
20
|
+
Before giving lifecycle commands, resolve the active OpenSandbox connection configuration:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
osb config show -o json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Check the resolved values for:
|
|
27
|
+
|
|
28
|
+
- `domain`
|
|
29
|
+
- `api_key`
|
|
30
|
+
- `protocol`
|
|
31
|
+
- `use_server_proxy` when endpoint routing matters
|
|
32
|
+
|
|
33
|
+
`osb config show` redacts the API key. Use it to confirm which server and protocol the CLI will target, not to recover credentials.
|
|
34
|
+
|
|
35
|
+
Do not focus only on environment variables. `osb config show` already reflects the effective configuration after applying CLI flags, environment variables, config file values, and defaults.
|
|
36
|
+
|
|
37
|
+
Hard stop:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
osb config show -o json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If `domain` is missing, stop and set it before lifecycle commands:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
osb config set connection.domain <host:port> -o json
|
|
47
|
+
osb config show -o json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If auth is required and `api_key` is missing, stop and set it before lifecycle commands:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
osb config set connection.api_key <api-key> -o json
|
|
54
|
+
osb config show -o json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
If the effective target is clear, then continue with lifecycle commands.
|
|
58
|
+
|
|
59
|
+
## Preflight Checks
|
|
60
|
+
|
|
61
|
+
Run these checks before lifecycle commands:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
osb --version
|
|
65
|
+
osb config show -o json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
If `osb` is missing, try a project-local entrypoint:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
.venv/bin/osb --version
|
|
72
|
+
.venv/bin/osb config show -o json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Use the results to classify the situation:
|
|
76
|
+
|
|
77
|
+
- CLI available
|
|
78
|
+
- config resolves
|
|
79
|
+
- target looks plausible for the current environment
|
|
80
|
+
|
|
81
|
+
## Golden Path
|
|
82
|
+
|
|
83
|
+
Use this as the default lifecycle flow unless the user asks for a narrower action:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
osb config show -o json
|
|
87
|
+
osb sandbox create --image python:3.12 --timeout 30m -o json
|
|
88
|
+
osb sandbox get <sandbox-id> -o json
|
|
89
|
+
osb sandbox health <sandbox-id> -o json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If the sandbox is intended to serve traffic on a known port, continue with:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
osb sandbox endpoint <sandbox-id> --port 8080 -o json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This sequence is safer than stopping at `sandbox get`, because `get` confirms object state while `health` confirms the sandbox is actually reachable through the execd health path.
|
|
99
|
+
|
|
100
|
+
## Create Options
|
|
101
|
+
|
|
102
|
+
Start with the narrowest create command that matches the request:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
osb sandbox create --image python:3.12 -o json
|
|
106
|
+
osb sandbox create --image node:20 --timeout 30m -o json
|
|
107
|
+
osb sandbox create --image my-registry.example.com/team/app:latest --image-auth-username alice --image-auth-password <token> -o json
|
|
108
|
+
osb sandbox create --image python:3.12 --timeout none -o json
|
|
109
|
+
osb sandbox create --image python:3.12 --entrypoint python --entrypoint -m --entrypoint http.server -o json
|
|
110
|
+
osb sandbox create --image python:3.12 --extension storage.id=abc123 -o json
|
|
111
|
+
osb sandbox create --image python:3.12 --ready-timeout 90s -o json
|
|
112
|
+
osb sandbox create --image python:3.12 --network-policy-file network-policy.json -o json
|
|
113
|
+
osb sandbox create --image python:3.12 --volumes-file volumes.json -o json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Use these options deliberately:
|
|
117
|
+
|
|
118
|
+
- `--image`: required unless the CLI already has `defaults.image` configured
|
|
119
|
+
- `--image-auth-username` and `--image-auth-password`: use together when the image is in a private registry
|
|
120
|
+
- `--timeout`: recommended for most temporary workloads so sandboxes do not linger indefinitely
|
|
121
|
+
- `--timeout none`: disable automatic expiration and switch the sandbox to manual cleanup mode
|
|
122
|
+
- omit `--timeout`: use `defaults.timeout` when configured; otherwise the request falls back to the SDK/server default TTL
|
|
123
|
+
- `--entrypoint`: repeat the flag once per argv item; do not use JSON or shell-wrapped command strings
|
|
124
|
+
- `--extension`: repeat for opaque extension key-value pairs that should be passed through as-is
|
|
125
|
+
- `--ready-timeout`: increase this when the image or workload needs more startup time
|
|
126
|
+
- `--skip-health-check`: use only when the user explicitly wants object creation without waiting for readiness; do not use it to mask startup problems
|
|
127
|
+
|
|
128
|
+
If the user does not specify an image, recommend one that matches the runtime they need instead of guessing silently.
|
|
129
|
+
|
|
130
|
+
## JSON Shapes
|
|
131
|
+
|
|
132
|
+
When recommending `--network-policy-file` or `--volumes-file`, always show the JSON shape instead of assuming the user knows it.
|
|
133
|
+
|
|
134
|
+
Example `network-policy.json`:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"defaultAction": "deny",
|
|
139
|
+
"egress": [
|
|
140
|
+
{
|
|
141
|
+
"action": "allow",
|
|
142
|
+
"target": "pypi.org"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"action": "allow",
|
|
146
|
+
"target": "files.pythonhosted.org"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Example `volumes-host.json`:
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
[
|
|
156
|
+
{
|
|
157
|
+
"name": "workspace-data",
|
|
158
|
+
"host": {
|
|
159
|
+
"path": "/tmp/opensandbox-data"
|
|
160
|
+
},
|
|
161
|
+
"mountPath": "/workspace/data",
|
|
162
|
+
"readOnly": false
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Example `volumes-pvc.json`:
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
[
|
|
171
|
+
{
|
|
172
|
+
"name": "shared-models",
|
|
173
|
+
"pvc": {
|
|
174
|
+
"claimName": "shared-models-pvc"
|
|
175
|
+
},
|
|
176
|
+
"mountPath": "/workspace/models",
|
|
177
|
+
"readOnly": true
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Prefer `pvc` when the environment supports it and the user needs a more portable storage definition. Use `host` when the user explicitly needs a host-path bind mount and the server has been configured to allow that path.
|
|
183
|
+
|
|
184
|
+
## Verification
|
|
185
|
+
|
|
186
|
+
Use verification commands in this order:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
osb sandbox get <sandbox-id> -o json
|
|
190
|
+
osb sandbox health <sandbox-id> -o json
|
|
191
|
+
osb sandbox metrics <sandbox-id> -o json
|
|
192
|
+
osb sandbox metrics <sandbox-id> --watch -o raw
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Use:
|
|
196
|
+
|
|
197
|
+
- `sandbox get` to inspect the current lifecycle state and metadata
|
|
198
|
+
- `sandbox health` to confirm the sandbox is usable
|
|
199
|
+
- `sandbox metrics` for a point-in-time resource snapshot
|
|
200
|
+
- `sandbox metrics --watch` when the user wants live CPU and memory updates while diagnosing load or pressure
|
|
201
|
+
|
|
202
|
+
If the user needs a public or routed port, verify it explicitly:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
osb sandbox endpoint <sandbox-id> --port 8080 -o json
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Lifecycle Actions
|
|
209
|
+
|
|
210
|
+
Use these commands for ongoing lifecycle management:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
osb sandbox list -o json
|
|
214
|
+
osb sandbox list --state running --state paused -o json
|
|
215
|
+
osb sandbox renew <sandbox-id> --timeout 30m -o json
|
|
216
|
+
osb sandbox pause <sandbox-id> -o json
|
|
217
|
+
osb sandbox resume <sandbox-id> -o json
|
|
218
|
+
osb sandbox kill <sandbox-id> -o json
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Rules:
|
|
222
|
+
|
|
223
|
+
- use `sandbox list` for discovery or filtering, not single-sandbox verification
|
|
224
|
+
- `sandbox list --state` accepts known lifecycle states case-insensitively
|
|
225
|
+
- use `renew` before long-running work instead of waiting for expiry
|
|
226
|
+
- use `pause` only when the workload can tolerate suspension
|
|
227
|
+
- use `kill` when cleanup is the real goal; do not leave orphaned sandboxes behind
|
|
228
|
+
|
|
229
|
+
## Runtime Notes
|
|
230
|
+
|
|
231
|
+
- `renew` resets the expiration to approximately `now + timeout`; treat it as a fresh TTL, not a simple additive extension to the old timestamp
|
|
232
|
+
- `create --timeout none` means no automatic expiration; cleanup becomes an explicit `kill` responsibility
|
|
233
|
+
- `create` without `--timeout` does not mean manual cleanup; it uses `defaults.timeout` first and otherwise leaves TTL selection to the SDK/server default
|
|
234
|
+
- `pause` and `resume` may depend on the underlying runtime; if the runtime does not support them, avoid promising they will work
|
|
235
|
+
- host-path volumes depend on server-side allowed host path configuration
|
|
236
|
+
- if creation fails or the sandbox never becomes healthy, switch to `sandbox-troubleshooting` instead of adding more create flags blindly
|
|
237
|
+
|
|
238
|
+
## Response Pattern
|
|
239
|
+
|
|
240
|
+
Structure the answer as:
|
|
241
|
+
|
|
242
|
+
1. exact command to run
|
|
243
|
+
2. what state change or verification result to expect
|
|
244
|
+
3. the next lifecycle command if the workflow continues
|
|
245
|
+
|
|
246
|
+
Keep command examples concrete and ready to paste.
|
|
247
|
+
|
|
248
|
+
## Minimal Closed Loops
|
|
249
|
+
|
|
250
|
+
Create and verify readiness:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
osb sandbox create --image python:3.12 --timeout 30m -o json
|
|
254
|
+
osb sandbox get <sandbox-id> -o json
|
|
255
|
+
osb sandbox health <sandbox-id> -o json
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Create a service sandbox and retrieve its endpoint:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
osb sandbox create --image python:3.12 --timeout 30m -o json
|
|
262
|
+
osb sandbox health <sandbox-id> -o json
|
|
263
|
+
osb sandbox endpoint <sandbox-id> --port 8080 -o json
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Create with network policy:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
osb sandbox create --image python:3.12 --network-policy-file network-policy.json -o json
|
|
270
|
+
osb sandbox get <sandbox-id> -o json
|
|
271
|
+
osb sandbox health <sandbox-id> -o json
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Renew before long work:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
osb sandbox renew <sandbox-id> --timeout 30m -o json
|
|
278
|
+
osb sandbox get <sandbox-id> -o json
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Pause and confirm state:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
osb sandbox pause <sandbox-id> -o json
|
|
285
|
+
osb sandbox get <sandbox-id> -o json
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Resume and verify health:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
osb sandbox resume <sandbox-id> -o json
|
|
292
|
+
osb sandbox health <sandbox-id> -o json
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Best Practices
|
|
296
|
+
|
|
297
|
+
- resolve the active connection configuration before assuming which server the command will hit
|
|
298
|
+
- prefer `osb config show` over checking individual environment variables in isolation
|
|
299
|
+
- confirm whether the user wants to keep, override, or persist connection settings before changing them
|
|
300
|
+
|
|
301
|
+
- Prefer explicit `--image` and `--timeout` when demonstrating commands
|
|
302
|
+
- Prefer `health` over assuming readiness from `create` output alone
|
|
303
|
+
- Prefer `endpoint` over telling the user to guess host/port mappings
|
|
304
|
+
- Prefer `pvc` over `host` when portability matters
|
|
305
|
+
- Prefer troubleshooting over `--skip-health-check` when startup is failing
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sandbox-troubleshooting
|
|
3
|
+
description: Use OpenSandbox CLI state, health, summary, inspect, events, and logs to investigate failed, unhealthy, or unreachable sandboxes. Trigger when users report startup failures, crashes, OOM, image pull problems, pending sandboxes, network issues, or an unresponsive sandbox and want root cause plus next actions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenSandbox Sandbox Troubleshooting
|
|
7
|
+
|
|
8
|
+
Investigate the reported sandbox before proposing a fix. Prefer evidence from OpenSandbox state, health checks, summary output, and diagnostics streams over speculation.
|
|
9
|
+
|
|
10
|
+
## Inputs To Collect
|
|
11
|
+
|
|
12
|
+
Capture these from the user request or surrounding context before running commands:
|
|
13
|
+
|
|
14
|
+
- sandbox ID or an unambiguous short ID
|
|
15
|
+
- whether `osb` or `opensandbox` CLI is available locally
|
|
16
|
+
- any reported symptom: pending forever, crash, OOM, unreachable service, bad image, failed exec, etc.
|
|
17
|
+
|
|
18
|
+
If the sandbox ID is missing, ask for it first.
|
|
19
|
+
|
|
20
|
+
## Configuration Resolution
|
|
21
|
+
|
|
22
|
+
Before troubleshooting a sandbox, resolve the active OpenSandbox connection configuration:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
osb config show -o json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Check the resolved values for:
|
|
29
|
+
|
|
30
|
+
- `domain`
|
|
31
|
+
- `api_key`
|
|
32
|
+
- `protocol`
|
|
33
|
+
- `use_server_proxy` when endpoint routing or proxy behavior may matter
|
|
34
|
+
|
|
35
|
+
`osb config show` redacts the API key. Use it to confirm the effective target server and protocol before troubleshooting.
|
|
36
|
+
|
|
37
|
+
If `domain` is missing, stop and set it first:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
osb config set connection.domain <host:port> -o json
|
|
41
|
+
osb config show -o json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If auth is required and `api_key` is missing, stop and set it first:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
osb config set connection.api_key <api-key> -o json
|
|
48
|
+
osb config show -o json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Use raw HTTP only after domain, protocol, and API key expectations are explicit.
|
|
52
|
+
|
|
53
|
+
## Operating Rules
|
|
54
|
+
|
|
55
|
+
- start with the highest-signal commands first: sandbox state, sandbox health, then diagnostics summary
|
|
56
|
+
- use CLI commands when `osb` is available because they are shorter and usually already authenticated
|
|
57
|
+
- use HTTP only when the CLI is unavailable or the user is clearly working from raw API access
|
|
58
|
+
- distinguish observed facts from inference and quote the field, event, or log line that supports the diagnosis
|
|
59
|
+
- separate sandbox/runtime failures from workload/application failures before suggesting a fix
|
|
60
|
+
- do not paper over readiness problems with `--skip-health-check`
|
|
61
|
+
- end with a likely root cause and 1-3 concrete remediation steps
|
|
62
|
+
|
|
63
|
+
## Triage Order
|
|
64
|
+
|
|
65
|
+
Use this order by default:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
osb sandbox get <sandbox-id> -o json
|
|
69
|
+
osb sandbox health <sandbox-id> -o json
|
|
70
|
+
osb devops summary <sandbox-id> -o raw
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then drill down only where the summary points:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
osb devops inspect <sandbox-id> -o raw
|
|
77
|
+
osb devops events <sandbox-id> --limit 100 -o raw
|
|
78
|
+
osb devops logs <sandbox-id> --tail 500 -o raw
|
|
79
|
+
osb devops logs <sandbox-id> --since 30m -o raw
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Diagnostics Streams
|
|
83
|
+
|
|
84
|
+
Important properties of the diagnostics commands:
|
|
85
|
+
|
|
86
|
+
- `summary` is the broadest starting point because it combines inspect output, event history, and recent logs
|
|
87
|
+
- `inspect`, `events`, and `logs` are detailed streams used after the broad summary
|
|
88
|
+
- diagnostics commands return plain-text output, not structured SDK model objects
|
|
89
|
+
- quote concrete lines from diagnostics output instead of summarizing vaguely
|
|
90
|
+
|
|
91
|
+
Use:
|
|
92
|
+
|
|
93
|
+
- `inspect` for container state, exit code, restart count, resources, ports, and runtime metadata
|
|
94
|
+
- `events` for scheduling failures, image pull issues, restarts, OOM kills, and probe transitions
|
|
95
|
+
- `logs` for application errors, missing binaries, bad entrypoints, startup hangs, and health-check failures
|
|
96
|
+
|
|
97
|
+
## Symptom To Command Mapping
|
|
98
|
+
|
|
99
|
+
Use the first command that best matches the reported symptom:
|
|
100
|
+
|
|
101
|
+
| Symptom | First command | What to confirm next |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| pending forever or stuck creating | `osb devops events <sandbox-id> --limit 100 -o raw` | image pull errors, scheduling failures, admission errors |
|
|
104
|
+
| image pull failure | `osb devops events <sandbox-id> --limit 100 -o raw` | image name, tag, registry auth |
|
|
105
|
+
| crash loop or repeated restarts | `osb devops logs <sandbox-id> --tail 200 -o raw` | `osb devops inspect <sandbox-id> -o raw` for exit code and restart count |
|
|
106
|
+
| suspected OOM or exit code issue | `osb devops inspect <sandbox-id> -o raw` | `OOMKilled`, exit code, resource limits |
|
|
107
|
+
| endpoint unreachable or connection refused | `osb sandbox health <sandbox-id> -o json` | `osb sandbox endpoint <sandbox-id> --port <port> -o json` and then `osb devops logs <sandbox-id> --tail 200 -o raw` |
|
|
108
|
+
| outbound network access failure | `osb sandbox health <sandbox-id> -o json` | check service behavior, then switch to `network-egress` if the issue is egress policy related |
|
|
109
|
+
|
|
110
|
+
## Diagnosis Playbooks
|
|
111
|
+
|
|
112
|
+
### Image Pull Failure
|
|
113
|
+
|
|
114
|
+
- first evidence: `events` shows `ImagePullBackOff`, `ErrImagePull`, or auth failures
|
|
115
|
+
- confirming evidence: sandbox stays `Pending` or never reaches healthy state
|
|
116
|
+
- likely cause: bad image reference or missing registry credentials
|
|
117
|
+
- next actions: verify image URI and tag, fix registry auth, recreate the sandbox
|
|
118
|
+
|
|
119
|
+
### OOM Kill
|
|
120
|
+
|
|
121
|
+
- first evidence: `inspect` shows `OOMKilled: True` or exit code `137`
|
|
122
|
+
- confirming evidence: events mention container killed due to out-of-memory
|
|
123
|
+
- likely cause: memory limit too low for the workload
|
|
124
|
+
- next actions: increase memory, rerun the workload, compare peak workload memory with the configured limit
|
|
125
|
+
|
|
126
|
+
### Crash Loop Or Bad Entrypoint
|
|
127
|
+
|
|
128
|
+
- first evidence: `logs` show startup exceptions, missing binaries, or permission errors
|
|
129
|
+
- confirming evidence: `inspect` shows repeated restarts, exit code `126`, or exit code `127`
|
|
130
|
+
- likely cause: bad entrypoint, missing executable, or application crash on boot
|
|
131
|
+
- next actions: fix the command or image contents, correct file permissions, redeploy or recreate
|
|
132
|
+
|
|
133
|
+
### Endpoint Or Service Unreachable
|
|
134
|
+
|
|
135
|
+
- first evidence: sandbox is `Running` but client requests fail or connection is refused
|
|
136
|
+
- confirming evidence: `sandbox endpoint <id> --port <port>` is missing, wrong, or points to a service that is not listening
|
|
137
|
+
- likely cause: wrong exposed port, service not bound, or server endpoint host misconfiguration
|
|
138
|
+
- next actions: verify the port, inspect service logs, and if the endpoint host is unreachable from the client environment check the server endpoint configuration
|
|
139
|
+
|
|
140
|
+
## Minimal Closed Loops
|
|
141
|
+
|
|
142
|
+
CLI-first troubleshooting:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
osb sandbox get <sandbox-id> -o json
|
|
146
|
+
osb sandbox health <sandbox-id> -o json
|
|
147
|
+
osb devops summary <sandbox-id> -o raw
|
|
148
|
+
osb devops events <sandbox-id> --limit 100 -o raw
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Crash-focused investigation:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
osb devops summary <sandbox-id> -o raw
|
|
155
|
+
osb devops logs <sandbox-id> --tail 500 -o raw
|
|
156
|
+
osb devops inspect <sandbox-id> -o raw
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Endpoint troubleshooting:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
osb sandbox get <sandbox-id> -o json
|
|
163
|
+
osb sandbox health <sandbox-id> -o json
|
|
164
|
+
osb sandbox endpoint <sandbox-id> --port <port> -o json
|
|
165
|
+
osb devops logs <sandbox-id> --tail 200 -o raw
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Response Format
|
|
169
|
+
|
|
170
|
+
Structure the answer in this order:
|
|
171
|
+
|
|
172
|
+
1. current state: what the sandbox is doing now
|
|
173
|
+
2. evidence: the command output that matters
|
|
174
|
+
3. root cause: the most likely diagnosis, stated as confidence not certainty when needed
|
|
175
|
+
4. next actions: specific fixes or follow-up checks
|
|
176
|
+
|
|
177
|
+
Keep the conclusion compact.
|