Repository navigation
feat(agent-tools): open a terminal child in the agent's own accept-edits or auto mode (FAP presets) - #5093
feat(agent-tools): open a terminal child in the agent's own accept-edits or auto mode (FAP presets)#5093code-yeongyu wants to merge 1 commit into
Conversation
…its or auto mode (FAP presets) A lead agent asking permission_preset accept-edits or auto gets a terminal child whose launch pins the agent's own mode of that name (Claude Code --permission-mode acceptEdits/auto, OmO --permission-preset accept-edits/auto), held by the same mode checks; harnesses lists per harness the presets it can hold.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Thank you, @code-yeongyu: this is a good fit for the spec, and it's going in. We ran the review round on it (omo gate and Codex) plus a live check in an isolated HOME. Claude Code 2.1.330's hook tells exactly The fixes from that round could not be pushed to your branch (GitHub answered permission denied), and this branch's base was #5075's, which has since been squash-merged. So they are in #5100: your commit as you wrote it (your authorship kept), rebased on main, with one maintainer commit on top. The fixes:
On your open question: I'll close this one when #5100 merges. Thanks again. |
|
Hi @code-yeongyu, a quick note: this PR wasn't closed by us. Its base branch |
…its or auto mode (FAP presets) (#5100) ## What @code-yeongyu's #5093, rebased on main (after #5075) with one maintainer commit from its review round on top. His commit keeps his authorship; the review fixes could not be pushed to his branch (GitHub answered permission denied), so they land here instead. Thank you, @code-yeongyu. FAP permission presets `accept-edits` and `auto` open a Claude Code or OmO terminal child in that agent's own mode of that name, pinned by its launch, for a lead agent only: | Harness | `accept-edits` | `auto` | | --- | --- | --- | | Claude Code (terminal) | `--permission-mode acceptEdits` | `--permission-mode auto` | | OmO (terminal) | `--permission-preset accept-edits` | `--permission-preset auto` | | anything else | `unsupported` | `unsupported` | ## Review round (omo gate + Codex via the team proxy, gpt-6.2-sol-fast xhigh) Supply chain: no dependency, lockfile, workflow or script change, no network call, no code taken from elsewhere. Fixed in the maintainer commit: - Claude Code tells its mode only with a prompt (2.1.330's `SessionStart` carries none), so a child could take its first prompt in another mode (Manual, when `auto` is unavailable). The approval hub now answers the `UserPromptSubmit` hook of a preset child with `decision: block` when the told mode is not the pinned one, so that prompt never runs; later sends are refused as before (`mode_changed`). - A preset wider than `read-only` on another PC is refused before any card (it was dropped silently). - `permission_preset: "full-access"` on the terminal wire opens the write mode (it opened the ordinary mode); `mode: "write"` with another preset is refused. - An explicit preset on a wire that cannot hold it is refused again, `read-only` too for an agent that runs everything unasked (Prime Agent); `harnesses` lists no preset for such an agent. - The preset is stored in its own ledger field (`preset`), not as a new value of `mode`: a build from before presets still reads `children.json` after a rollback. - `Harness` gains `presets` in the generated types. - Tests: the drift refusal, the prompt block, full-access, conflicting fields, the cross-PC refusal, the face success path, and a contract test that each preset's `pinned` value is what the real hook told. ## Real-agent verification (isolated HOME, team proxy, cheap model) - Claude Code 2.1.330 (`claude -p`, claude-haiku-4-5): its hook told `acceptEdits` for `--permission-mode acceptEdits`, `auto` for `auto`, and `default` for `manual`; recorded in `server/agent-tools/fixtures/claude-2.1.330-preset-modes.json`. - OmO 5.1.86 (`omo -p`): `accept-edits` wrote the file unasked, `auto` still asked before the edit, `read-only` refused; recorded in `server/agent-tools/fixtures/omo-5.1.86-preset-modes.json`. - Without Lead agents, `accept-edits` and `auto` answer `not_granted` (`scope_denied` in the FAP face). ## The open question in #5093 `thread_read` keeps `permission_preset: "read-only"` for the ordinary mode, the nearest of the spec's four values (a client may treat the list as closed), and every thread view now also tells `ovis.mode`: `ordinary` (asks a person), `write`, `accept-edits` or `auto`. docs/fap.md says so. ## Checks On this branch: typecheck green, generated types fresh, `bun test` of server/agent-tools, server/approvals, the conventions, changelog and plugin-agent tests: 497 pass, 0 fail. Supersedes #5093. --------- Co-authored-by: YeonGyu-Kim <[email protected]>
What
permission_preset: "accept-edits"and"auto"are no longer refused for built-in harnesses whose agent has a native mode of that name. A lead agent's terminal child is launched with that mode pinned, exactly as the write mode is today:accept-editsauto--permission-mode acceptEdits--permission-mode autoshared/protocol.ts, the 2.1.330 permission-mode fixture)--permission-preset accept-edits--permission-preset auto--permission-presetvaluesunsupportedas beforelaunch.preset_argsin the agent descriptions (schema + regenerated types),{ args, pinned }per preset.mode_changedsend guard now compares the hook's told mode with the mode the child was pinned to, so an accept-edits child is still refused once its mode drifts, and an ordinary child is unchanged.harnesseslists per harness exactly the presets it can hold (capabilities.presets). A spec-attached FAP agent still lists all four.thread_read/thread_listreport the preset in use (SessionRef.modegainsaccept-edits/auto).not_granted. G8 is untouched: whatever the agent still asks goes to a person.Why
The FAP spec by Sisyphus Labs has four presets, and a host maps each one a harness lists to that agent's own permission mode. Ovis listed only
read-onlyfor built-ins and refusedauto/accept-editseven where the agent has exactly that mode.Tests
Run on a Linux x86_64 box (bun 1.4.5) at head
9e110d6a:bun run check fast: workflow syntax, generated types (fresh), themes, typecheck and build ok. Unit: 27945 pass, 2 fail, 402 skip. The two failures areserver/lan-https.test.tsandtui/testing/entry-pty.test.ts. Both fail the same way at the feat(agent-tools): follow the Sisyphus Labs FAP spec (thread_* calls, envelope, receipts, FAP agent wire) #5075 head2c34e380on that box (entry-ptyonly sometimes), so they were already failing and this PR doesn't touch them.drivers/terminal.test.tscase: Claude's argv pinsacceptEdits, a send is refused while the hook tellsdefaultand accepted once it tellsacceptEdits,autowithout a lead is refused, and a harness with no such mode answersunsupported.lead.test.tscase: OmO opens with--permission-preset accept-edits/autoand reads back as that preset. The no-lead case now also covers both presets.fap-face.test.ts:omo+autowithout a lead is nowscope_denied / not_granted, notunsupported.Open question for you
thread_readkeeps reporting the ordinary ask-a-person mode asread-only, as #5075 does. In the spec,read-onlymeans the host declines every ask, so the label is a little generous. I left it alone rather than change a wire value without you.@devswha this stacks on #5075. Happy to rebase or reshape it however you prefer.