Skip to content

feat(agent-tools): open a terminal child in the agent's own accept-edits or auto mode (FAP presets) - #5093

Closed
code-yeongyu wants to merge 1 commit into
devswha:release/fap-alignfrom
code-yeongyu:fap/presets-auto-accept-edits
Closed

code-yeongyu wants to merge 1 commit into
devswha:release/fap-alignfrom
code-yeongyu:fap/presets-auto-accept-edits

Conversation

@code-yeongyu

Copy link
Copy Markdown
Contributor

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:

Harness accept-edits auto Source
Claude Code (terminal) --permission-mode acceptEdits --permission-mode auto the modes Ovis already reads from Claude's hook (shared/protocol.ts, the 2.1.330 permission-mode fixture)
OmO (terminal) --permission-preset accept-edits --permission-preset auto OmO's own --permission-preset values
everything else not listed not listed answers unsupported as before
  • New optional launch.preset_args in the agent descriptions (schema + regenerated types), { args, pinned } per preset.
  • The mode_changed send 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.
  • harnesses lists per harness exactly the presets it can hold (capabilities.presets). A spec-attached FAP agent still lists all four.
  • thread_read/thread_list report the preset in use (SessionRef.mode gains accept-edits/auto).
  • The lead gate is the same one the write mode uses: without Lead agents on, a preset wider than read-only is not_granted. G8 is untouched: whatever the agent still asks goes to a person.
  • When no wire is named and the harness pins the preset on a terminal, the terminal wire is chosen first.

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-only for built-ins and refused auto/accept-edits even 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 are server/lan-https.test.ts and tui/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 head 2c34e380 on that box (entry-pty only sometimes), so they were already failing and this PR doesn't touch them.
  • New drivers/terminal.test.ts case: Claude's argv pins acceptEdits, a send is refused while the hook tells default and accepted once it tells acceptEdits, auto without a lead is refused, and a harness with no such mode answers unsupported.
  • New lead.test.ts case: OmO opens with --permission-preset accept-edits / auto and reads back as that preset. The no-lead case now also covers both presets.
  • fap-face.test.ts: omo + auto without a lead is now scope_denied / not_granted, not unsupported.

Open question for you

thread_read keeps reporting the ordinary ask-a-person mode as read-only, as #5075 does. In the spec, read-only means 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.

…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.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devswha

devswha commented Nov 30, 2026

Copy link
Copy Markdown
Owner

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 acceptEdits / auto for those launches, and OmO 5.1.86's accept-edits writes unasked while its auto still asks.

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:

  • a Claude prompt told in another mode than the pinned one is stopped before it runs (the hub blocks its UserPromptSubmit)
  • a wider preset is refused on another PC and on wires that cannot hold it
  • full-access on the terminal wire opens the write mode
  • the preset is kept in its own ledger field, so an older build can still read the ledger

On your open question: thread_read keeps read-only for the ordinary mode, the nearest of the spec's four, and every thread view now also tells ovis.mode (ordinary, write, accept-edits, auto). docs/fap.md says so.

I'll close this one when #5100 merges. Thanks again.

@devswha

devswha commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Hi @code-yeongyu, a quick note: this PR wasn't closed by us. Its base branch release/fap-align was deleted when #5075 merged, and GitHub closes a PR when its base goes. Your commits carry on, with your authorship, rebased on main in #5100, together with the fixes from the review round. Thank you for this work! (This corrects my earlier comment here, which said I'd close it later.)

devswha added a commit that referenced this pull request Nov 30, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants