Skip to content

feat(acp): an agent can run each chat's own permission mode itself - #28455

Merged
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/agy-chat-6-permission-mode
Oct 17, 2026
Merged

brennanb2025 merged 5 commits into
mainfrom
brennanb2025/agy-chat-6-permission-mode

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​32 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25

ELI5

Antigravity chats need Google's separate Antigravity chat server. An earlier version of this stack downloaded it silently the first time a chat started: about 18 seconds of "Working for Ns" with no progress and no Cancel, and every extra chat opened started another download. Now nothing downloads until the person clicks Install, which shows the size, progress and Cancel in Settings and in the new chat.

This PR covers permissions. Some chat agents, Antigravity's server among them, enforce permissions themselves: Orca tells the agent which of its own modes to run in, and the agent decides when to ask. Main has a per-chat permission picker (Ask for approval, Accept edits, Approve for me, Full access), but Orca had no way to hand that choice to such an agent. This PR lets an agent map each picker choice to one of its own modes. No agent uses it yet; Antigravity (#28595) is the first.

What Changed

This revision (moving to the common pattern): each agent's spec had to name its mode option's id (configId), so a server that renamed the option would have been sent the wrong one. The mode option is now found the way the common pattern finds it: the session's select option in the standard mode category, whatever the agent calls it (falling back to the id mode). Antigravity's option is mode in that category, so its behavior is unchanged.

  • Before: nothing in Orca could hand an Agent Client Protocol (ACP) chat agent a per-chat permission mode. Under Full access, Orca approved the agent's permission requests on the person's behalf.
  • After: an ACP launch spec can declare permissionModeConfig: the agent's own value for each Orca mode it supports, set on the session's mode-category option. An Ask value is required. Every start, new or reopened, sets the value for the chat's mode after restoring the chat's saved options. The start fails with "Permission mode could not be confirmed" if the agent doesn't report that value back. A chat with no mode, or with a mode the spec doesn't map, runs the Ask value, so the agent never gets more access than the person chose.
  • Changing the mode mid-chat: no new code. The host already restarts a chat's agent before the next message when its mode changed (the same path Claude and Codex chats use), and that restart sets the new value.
  • Permission requests: for an agent that enforces the mode itself, every permission request and question is shown to the person in every mode. Orca doesn't auto-approve them under Full access. The agent's own full-access mode decides what it still asks.
  • Merged alone: no agent sets the field, so nothing changes.

Why

The per-chat picker already owns the choice, where it is saved, and how a change reaches the host. Mapping that choice onto the agent's own modes reuses all of it: no second permission setting and no new message between client and host. Letting the agent enforce its own mode, rather than having Orca approve each request, keeps the agent's own rules about what counts as an edit and what counts as a command.

Linked Issue

N/A (maintainer; part of the Antigravity Chat UI stack).

Visual Proof

N/A: no agent sets the new field yet, so nothing visible changes. The picker for Antigravity arrives with #28595.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • One test through the real adapter, with an agent whose mode option has a non-standard id: a start in Accept edits sets the mapped value on that option, a start naming no mode requests the Ask value, and an agent that doesn't confirm the value fails the start. It fails if the chat's mode is ignored.

  • pnpm tc:node, the ACP and shared test folders (13,835 tests) and the code-quality gate passed.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Mixed versions: the host owns both the mapping and the launch. An older client without an agent's picker row shows no picker, and the host still launches with the chat's saved mode, never the global setting.
  • SSH and remote hosts: the mode is applied by the host that runs the chat.
  • PR author: @BrennanKB5

Differences from the common pattern

  • Intended: if the agent does not confirm the requested mode, the chat start fails rather than running in whatever mode the agent kept. Antigravity's server restores a saved looser mode when a chat is reopened, so adopting whatever it reports could run a chat in Full access after the person chose Ask.
  • Intended: a mode change takes effect by restarting the chat's agent before the next message, the path every other chat agent already uses, instead of a live mode switch. One permission-mode path for all agents; mode changes are rare.
  • Intended: for an agent that enforces the mode itself, Orca shows every permission request it still sends instead of auto-approving it under Full access. In its own full-access mode Antigravity still asks only for reviews an administrator requires and for questions; approving those for the person would defeat that policy.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Some agents enforce Ask or Full access themselves, but Orca had no way to set that choice when a chat starts or reopens. This PR adds an optional Agent Client Protocol (ACP) declaration, applies the choice after saved settings are restored, and sends any remaining permission request to the person. No agent uses the declaration yet, so existing chats have no visible change.

The review reproduced one dormant contract defect: a successful reply could omit the requested mode or report a different value, while startup still succeeded. Fixed in 71580abffb2: startup now requires the reported option to match the requested value and otherwise fails through the existing child cleanup path. One compact regression covers both replies and verifies that the child closes once.

Two review rounds, the architecture challenge, final readiness checklist, and dedicated performance scan are complete with no remaining findings. Local validation passed 75 tests across seven ACP suites, 11 scripted contract probes, pnpm tc:node, and all 22 repository checks using pinned Bun. The full PR adds 17 production lines and 16 test lines, within the agreed budgets. Final CI passed on the reviewed commit: 13 checks succeeded and 17 were skipped, including all five test shards, Linux/Windows packaging, relay integration, static analysis and the final verification jobs.

Electron QA is N/A because no agent enables this field. The new permission flow was tested with scripted agents; a real declaring agent, rendered chat UI, live remote execution, and performance timings were not exercised here; the later agent activation PR owns its recorded integration coverage. No other code findings were deferred, the parent PR was left untouched, and this PR was not merged.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 14, 2026 07:10
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/agy-chat-1-question-claims to main October 14, 2026 07:17
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3ae92f52-05eb-4afb-aba2-124535c554f3
📥 Commits

Reviewing files that changed from the base of the PR and between 71580ab and d57b9b2.

📒 Files selected for processing: 5
  • src/main/acp/acp-launch-specs.ts
  • src/main/acp/acp-structured-acquire.ts
  • src/main/acp/acp-structured-adapter.test-support.ts
  • src/main/acp/acp-structured-options.ts
  • src/main/acp/acp-structured-session-adapter-resume.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

📝 Walkthrough

ACP launch specifications now support mappings from chat permission modes to agent mode values. Session acquisition applies the mapped value, falls back to the configured ask value when needed, and checks that the agent reports the value as current. Full-access auto-approval now depends on whether the dialect claims the request and whether a permission-mode configuration exists. Tests cover mode selection for a new Grok session.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to d57b9

This adds optional permission-mode mapping for ACP agents that none currently use, so there is no visible behavior change today. No blocking risks were found for merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the main change: ACP agents can apply each chat's permission mode themselves.
Description check Passed The description is detailed and covers the user impact, implementation, rationale, testing, visual proof, compatibility considerations, and checklist. It is mostly complete despite some repository com…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, testing, visual proof, compatibility considerations, and checklist. It is mostly complete despite some repository command checklist items remaining unchecked.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 71580ab to a955b2d Compare October 14, 2026 17:35
@brennanb2025 brennanb2025 changed the title feat(acp): an agent can enforce the permission mode itself through a session option feat(acp): an agent can run each chat's own permission mode itself Oct 14, 2026
@brennanb2025
brennanb2025 changed the base branch from main to brennanb2025/agy-chat-7-signin-prompt October 14, 2026 17:35
@brennanb2025
brennanb2025 marked this pull request as draft October 14, 2026 17:35
@brennanb2025
brennanb2025 marked this pull request as ready for review October 14, 2026 18:19
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Orca could not pass a chat's own permission choice to an Agent Client Protocol (ACP) agent that enforces approvals itself. This PR adds a generic mapping: the host applies the chat's choice, falls back to Ask for missing or unmapped choices, and refuses to start if the agent does not confirm it. Requests from a declaring agent use the existing approval/question surface instead of Orca automatically answering them.

No production agent opts in yet, so this PR changes no visible picker, tabs, focus, setup, or notices. PR 8 adds the enabled agent and owns live picker QA.

  • Fixed during review: the acquire module exceeded the repository's line limit; additive commit 411d7205e48 reuses its existing display-name calculation without changing behavior or suppressing the rule.
  • Review: independent correctness and architecture reviews, narrow verification of the fix, final readiness, and a dedicated performance scan found no open findings in this generic patch.
  • Verified: 140 focused tests on the final commit, two external protocol-flow probes on the original reviewed commit, and all 21 repository checks including typechecks. Full PR CI and the readiness workflow both passed for 411d7205e48, including the required PR aggregate; the readiness workflow verified reuse of the identical successful full test run.
  • Kept outside this PR: main's existing behavior can defer applying a changed permission mode while work remains open; the coordinator is tracking that separately and PR 8 will check it live. Unattended/setup questions retain their deliberate cancellation policy.
  • Not exercised here: Electron/live-agent QA, real mixed-version peers, or live Windows/WSL/Linux/SSH network-failure scenarios. Electron QA is N/A for this dormant backend support under the handoff.

Ready for review; no merge performed.

@brennanb2025
brennanb2025 marked this pull request as draft October 15, 2026 08:35
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from e73668c to a94f0d1 Compare October 15, 2026 08:35
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 411d720 to f05f141 Compare October 15, 2026 08:35
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from a94f0d1 to a6cc794 Compare October 15, 2026 08:39
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from f05f141 to a341356 Compare October 15, 2026 08:39
@brennanb2025
brennanb2025 marked this pull request as ready for review October 15, 2026 09:33
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from a6cc794 to 6b74006 Compare October 15, 2026 13:34
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from a341356 to 5b1bd65 Compare October 15, 2026 13:34
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 6b74006 to 6873ffe Compare October 15, 2026 13:39
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 5b1bd65 to f9b8f4c Compare October 15, 2026 13:40
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 6873ffe to 80b124d Compare October 15, 2026 13:57
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from f9b8f4c to 4abb999 Compare October 15, 2026 13:57
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 80b124d to 4c5c7ce Compare October 15, 2026 14:24
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 4abb999 to 85ab473 Compare October 15, 2026 14:24
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 4c5c7ce to 6b4c263 Compare October 15, 2026 16:03
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 85ab473 to 2162aaa Compare October 15, 2026 16:03
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 6b4c263 to f090b03 Compare October 15, 2026 16:30
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 2162aaa to e6d2b82 Compare October 15, 2026 16:30
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from e6d2b82 to e5c1e2a Compare October 15, 2026 19:57
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch 2 times, most recently from 36a9859 to 47613e5 Compare October 16, 2026 03:25
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from c328a27 to 529047a Compare October 16, 2026 03:25
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 47613e5 to b4ca6d9 Compare October 16, 2026 03:27
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch 2 times, most recently from 7d2c41d to 5cb96ec Compare October 16, 2026 19:43
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from b4ca6d9 to 3495a4e Compare October 16, 2026 19:43
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 5cb96ec to e6b585a Compare October 16, 2026 20:09
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 3495a4e to 1ab34a3 Compare October 16, 2026 20:10
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from e6b585a to ad82282 Compare October 16, 2026 21:55
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 1ab34a3 to 6aecbf4 Compare October 16, 2026 21:55
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from ad82282 to 929a0a4 Compare October 16, 2026 22:11
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch 2 times, most recently from 7775094 to e2abbf0 Compare October 16, 2026 22:23
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 929a0a4 to 5707583 Compare October 16, 2026 22:23
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from e2abbf0 to 4f767db Compare October 17, 2026 00:43
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 5707583 to 2d88838 Compare October 17, 2026 00:43
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from 4f767db to fdbb87d Compare October 17, 2026 01:07
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 2d88838 to 49fe731 Compare October 17, 2026 01:07
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-7-signin-prompt branch from fdbb87d to 796e987 Compare October 17, 2026 06:32
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/agy-chat-7-signin-prompt to main October 17, 2026 08:00
…session config option

An optional launch-spec field names the session config option and its ask/full values. Every new or
reopened session gets the value for the chat's full-access posture before it is exposed, and a refusal
fails the start. With the field present Orca no longer answers permission requests for the person.
No agent sets it yet.
…t's own mode

The launch spec maps each chat permission mode to its session option value; a start sets the
value for the mode the host launches with (ask when it names none), replacing the global Agent
Permissions full-access read. A mid-chat change takes effect through the host's existing restart
of a child launched with another mode before the next send.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-6-permission-mode branch from 49fe731 to d57b9b2 Compare October 17, 2026 08:01
@brennanb2025
brennanb2025 merged commit a5b96a1 into main Oct 17, 2026
32 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/agy-chat-6-permission-mode branch October 19, 2026 04:33
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.

1 participant