4.7 KiB
Agent Task
You are running inside an OpenShell sandbox. Your job has two steps. Each
step starts with a curl call that the L7 proxy will deny; for each
denial, read /etc/openshell/skills/policy_advisor.md, draft a narrow
proposal, submit it to http://policy.local/v1/proposals, wait on
GET /v1/proposals/{chunk_id}/wait?timeout=300, then retry.
Target
- Repository:
{{OWNER}}/{{REPO}} - Branch:
{{BRANCH}} - File path:
{{FILE_PATH}} - Run id:
{{RUN_ID}}
What to do
Step 1 — Fetch a public schema (un-credentialed action)
-
Fetch the well-known GitHub OpenAPI description from
https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.jsonwithcurl. Do not send any authentication header — this resource is public. Save the response to/tmp/github-openapi.json.The first attempt will fail with HTTP 403 and a JSON body containing
"error": "policy_denied". Read the body — it tells you which layer denied you, which method/path was missing, and where to learn more. -
Read
/etc/openshell/skills/policy_advisor.mdand follow it. Submit the narrowest possible proposal tohttp://policy.local/v1/proposals— exact host (raw.githubusercontent.com), exact port (443), exact method (GET), exact path (/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json), binary/usr/bin/curl. Do not propose wildcard hosts. Saveaccepted_chunk_ids[0]. -
Block on the gateway's decision by calling
GET http://policy.local/v1/proposals/{chunk_id}/wait?timeout=300.status: "approved"— retry the fetch once. Because the host has no credentials in scope (it's a public-content endpoint), the prover sees no findings and the gateway auto-approves the proposal without human review. The whole step typically completes in ~1 second after submission.status: "rejected"— readrejection_reason. If it has text, address the specific feedback and submit a revised proposal; otherwise stop and tell the developer you can't proceed.status: "pending"withtimed_out: true— re-issue the same/waitrequest once. Each/waitis one long-lived HTTP call.
-
After the retry, verify the file exists at
/tmp/github-openapi.jsonand is non-empty.
Step 2 — Write to GitHub (credentialed action)
-
PUT the file with
curlagainsthttps://api.github.com/repos/{{OWNER}}/{{REPO}}/contents/{{FILE_PATH}}. Authenticate with theGITHUB_TOKENenvironment variable. Do not echo the token. Body content (base64-encoded into the JSONcontentfield):# OpenShell policy advisor demo Run id: {{RUN_ID}} Written from inside an OpenShell sandbox after a narrowly-scoped policy proposal was reviewed by the developer. -
The first attempt will fail with HTTP 403 and a JSON body containing
"error": "policy_denied". Read the body — it tells you which layer denied you (l7/rest), which method/path was missing, and where to learn more. -
Submit the narrowest possible proposal to
http://policy.local/v1/proposals— exact host (api.github.com), exact port (443), exact method (PUT), exact path (/repos/{{OWNER}}/{{REPO}}/contents/{{FILE_PATH}}), binary/usr/bin/curl. Do not include query strings. Do not propose wildcard hosts. Saveaccepted_chunk_ids[0]. -
Block on the developer's decision by calling
GET http://policy.local/v1/proposals/{chunk_id}/wait?timeout=300.- This time the prover emits a
capability_expansionfinding: PUT is a new method on a host the binary already had credentialed reach to (read-only). That's a stated intent change, so the gateway holds the chunk inpendingfor human review instead of auto-approving. The/waitcall still parks on a socket — zero LLM tokens burn while the human decides. status: "approved"— retry the PUT once. Policy has hot-reloaded.status: "rejected"— readrejection_reason. If it has text, address the specific feedback and submit a revised proposal (back to step 3); otherwise stop and tell the developer you can't proceed.status: "pending"withtimed_out: true— re-issue the same/waitrequest once.
- This time the prover emits a
-
On a successful PUT (HTTP 200 or 201), print a short summary showing
content.pathandcontent.html_urlfrom the GitHub response. Do not print the full response body.
If anything is unclear, prefer making a narrower proposal and asking for approval again over widening the rule.