Repository navigation
MARSOHS-2589: default --permission to ask and print the applied policy - #2112
SSharma-10 merged 6 commits into
Conversation
`create` and `launch` with --harness defaulted --permission to allow, while the manifest spec resolves an omitted permissions.default to ask, and the CLI never showed which policy a session got. The default is now ask. Before creating the session, doctl asks the server which default it will apply to the exact manifest being sent (5 second limit) and prints one line on stderr; the server can change the requested value. If that check fails, the create continues and the line shows the requested value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… test TestRunAgentsCreate_HermesWithOpenAIKeySkipsManagedKey came from main (digitalocean#2114) and assumed the old --permission default of allow. With this branch's default of ask, a --harness create validates the policy before creating, as every other --harness create test here already expects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review notes.
|
…side create With --permission defaulting to ask, `create --harness X --prompt ...` run from a script with no terminal and no --on-hitl started a run that waited at its first tool call with no timeout. That create now refuses before any API call and names the three ways out: --on-hitl, --permission allow, or an explicit --permission ask to keep the wait. A terminal keeps the ask default. The policy check no longer delays create: it runs alongside the create call and its line prints once the session exists (nothing prints when create fails). It sends the manifest with secret values redacted, so secrets cross the wire once; the server's policy resolution does not read them, nor any of create's query parameters. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@sanpj2292 thanks. All three addressed in b837a19.
Tests: |
|
Thanks @nveerdixit. I checked
Under Still open for you:
The switch of the default to |
|
Please resolve the merge conflicts and address the open comment |
Conflict in commands/agents_test.go: both sides appended tests at the end of the file (this branch's JSON permission-line test, main's `logs` tests). Kept both. digitalocean#2118's --model create tests had no ValidatePolicy stub. Every --harness create now runs the policy check alongside create, so the unexpected call failed inside that goroutine and create waited on it forever (the package timed out). They now allow the check without asserting its line, since create is made to fail and the check may be cancelled. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@SSharma-10 @sanpj2292 the conflicts are resolved and the open comment is addressed, in a2b2b0b. It is a merge of Merge conflicts. Git reported one conflict, in Interaction with #2118. The create path keeps both behaviours. The policy check runs alongside whichever create call Server-side follow-up. Filed as MARSOHS-3158: return the applied Tests on a2b2b0b: The switch of the default to |

Summary
doctl harness-runtime createandlaunchwith--harnessdefaulted--permissiontoallow. The environment spec resolves an omittedpermissions.defaulttoask, so the same environment got a different policy depending on how it was created, and the CLI never showed which one a session got. This PR changes two things:ask.--harnesswithout--permissionnow writesdefault: ask.--permission allow|ask|denystill overrides it.allowdefault can be shipped asaskfor agents without full capability data), so printing the flag value could be wrong. Alongside the create call, doctl calls the existing policy-validate endpoint with the manifest bytes create sends (secret values redacted), and once the session exists prints one line on stderr:The check runs in parallel with create and has a 5 second limit. If it fails or times out, the line is labelled "requested". A failed create prints no line.
What users need to know
create --harness ... --prompt ...without--on-hitlor an explicit--permissionnow refuses before any API call, naming--on-hitl approve,--permission allow, or--permission askto keep the wait. Interactive use keeps theaskdefault.ask, a run waits at the first tool call that needs approval, and the wait does not time out. Approve withdoctl harness-runtime approve, in the chat, or withcreate --on-hitl approve. For unattended runs, usecreate --on-hitl approveor--permission allow.launchcannot auto-approve. The flag description and the create/launch help now say this.askinstead of waiting. The flag help says this too.Scope and limits
--harnesspath changes, for bothcreateandlaunch.--spec,--from-config, bare sandboxes and--dry-run(which makes no API calls) print no line.-o json, the line goes to stderr so stdout stays valid JSON. The create JSON comes from a displayer shared with other commands, so no field was added.--harnesscreate, but it runs alongside create, so it adds no latency, and it carries no secret values.manage_model_access_key,openai_session_id,resume_on_topoff). The server resolves the policy from the manifest's permissions, template, agent and MCP servers only, so none of those parameters change its answer.Testing
askdefault;--permission ask,--on-hitl, no prompt,allow);-o jsonstdout staying clean, with the line on stderr;--specnever calling the check;launch --harnesspath.--harnesstests now expect the check.go test ./commands/ ./do/passes exceptTestRegistryLogout, which also fails on unmodifiedmainin my environment (it needs the OS keychain).Refs: MARSOHS-2589
🤖 Generated with Claude Code