Python
Inside OpenShell: the allow-a-site command the agent gives is the whole command
Rohit C Prasada2b02255808a
diff --git a/coworker/sandbox/inside.py b/coworker/sandbox/inside.pyindex a0f36c68..3872a9da 100644--- a/coworker/sandbox/inside.py+++ b/coworker/sandbox/inside.py@@ -59,7 +59,10 @@ def context() -> str:else:lines.append("If the task needs a blocked request, tell the user which host and port were "- "blocked. They can allow it from outside the sandbox with "- "`openshell policy update --add-endpoint HOST:PORT`."+ "blocked. They can allow it from outside the sandbox, while it is still running, "+ "with `openshell policy update SANDBOX_NAME --add-endpoint HOST:PORT --binary '/**' "+ "--wait`. Give the command with the real host and port, and say that it needs the "+ "sandbox's name and that `--binary` is required: without it the rule lets no "+ "program through.")return " ".join(lines)diff --git a/docs/openshell-inside.md b/docs/openshell-inside.mdindex a87bf9cb..a568b953 100644--- a/docs/openshell-inside.md+++ b/docs/openshell-inside.md@@ -114,8 +114,13 @@ openshell policy update work --add-endpoint pypi.org:443 --binary '/**' --wait````--binary` says which programs may use the site. `'/**'` means any program in the sandbox;-name one, such as `/usr/bin/curl`, to keep it to that program. The change reaches the-running sandbox in a few seconds, with no restart.+name one, such as `/usr/bin/curl`, to keep it to that program. Do not leave `--binary` out:+OpenShell then adds a rule that lets no program through. The change reaches the running+sandbox in a few seconds, with no restart.++The sandbox has to be running to be changed. A run started with `--no-keep` (step 3) is+gone when it ends, so for work that needs sites use a sandbox that stays up (step 4),+allow the sites, and run the task again.OpenShell can also draft these rules from the requests it blocked, for you to approve. Thatis its policy advisor; see OpenShell'sdiff --git a/tests/test_openshell_inside.py b/tests/test_openshell_inside.pyindex 4566e45d..9c243997 100644--- a/tests/test_openshell_inside.py+++ b/tests/test_openshell_inside.py@@ -82,7 +82,9 @@ def test_inside_the_agent_is_told_what_a_blocked_request_looks_like(in_openshellassert "CONNECT tunnel failed, response 403" in text and "policy_denied" in textassert "Couldn't connect to server" in text # how OpenShell 0.1 refuses# Proposals are off, so there is no skill to load: the person changes the policy.- assert "openshell policy update --add-endpoint HOST:PORT" in text+ # The whole command: seen on OpenShell 0.1.2, a rule added without --binary lets no+ # program through, so the short form sent people in a circle.+ assert "openshell policy update SANDBOX_NAME --add-endpoint HOST:PORT --binary '/**' --wait" in textassert "openshell-policy-advisor" not in text