Skip to content

feat: Add auto permission mode for Claude adapter#1749

Merged
charlesvien merged 2 commits intomainfrom
04-20-add_auto_permission_mode_for_claude_adapter
Apr 21, 2026
Merged

feat: Add auto permission mode for Claude adapter#1749
charlesvien merged 2 commits intomainfrom
04-20-add_auto_permission_mode_for_claude_adapter

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented Apr 21, 2026

Problem

Claude upstream supports an auto mode that uses a model classifier to approve/deny permission prompts, but it was previously skipped in our fork.

CleanShot 2026-04-20 at 20.30.50@2x.png

Changes

  1. Add auto to CODE_EXECUTION_MODES, available modes and AUTO_ALLOWED_TOOLS
  2. Add "auto" option to ExitPlanMode permission options and approval handler
  3. Map auto mode to Codex native auto mode
  4. Update ModeSelector UI with Robot icon and blue styling for auto mode
  5. Update UPSTREAM.md to reflect auto mode is now adopted

How did you test this?

Manually

@charlesvien charlesvien changed the title Add auto permission mode for Claude adapter feat: Add auto permission mode for Claude adapter Apr 21, 2026
Copy link
Copy Markdown
Member Author

charlesvien commented Apr 21, 2026

@charlesvien charlesvien marked this pull request as ready for review April 21, 2026 03:10
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 21, 2026

Comments Outside Diff (2)

  1. packages/agent/src/execution-mode.test.ts, line 5-22 (link)

    P1 Tests assume non-root environment

    Both tests hard-code bypassPermissions and full-access in their expected arrays, but those modes are only pushed onto the lists when ALLOW_BYPASS = !IS_ROOT. If the test process runs as UID 0 (common in Docker-based CI), IS_ROOT is true, neither mode is ever added, and the actual arrays will be ["auto","default","acceptEdits","plan"] / ["read-only","auto"] — causing both tests to fail without any obvious connection to the root check.

    The tests need either a jest/vitest mock for IS_ROOT, a vi.mock("./utils/common", ...) call, or separate test cases for each branch.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/agent/src/execution-mode.test.ts
    Line: 5-22
    
    Comment:
    **Tests assume non-root environment**
    
    Both tests hard-code `bypassPermissions` and `full-access` in their expected arrays, but those modes are only pushed onto the lists when `ALLOW_BYPASS = !IS_ROOT`. If the test process runs as UID 0 (common in Docker-based CI), `IS_ROOT` is `true`, neither mode is ever added, and the actual arrays will be `["auto","default","acceptEdits","plan"]` / `["read-only","auto"]` — causing both tests to fail without any obvious connection to the root check.
    
    The tests need either a jest/vitest mock for `IS_ROOT`, a `vi.mock("./utils/common", ...)` call, or separate test cases for each branch.
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. packages/agent/src/execution-mode.test.ts, line 1-22 (link)

    P2 Prefer parameterised tests

    Both test cases call getModes().map((mode) => mode.id) and compare against a fixed array — the same assertion shape for two different adapters. Per the team's convention, these should use it.each:

    it.each([
      [
        "claude sessions",
        getAvailableModes,
        ["auto", "default", "acceptEdits", "plan", "bypassPermissions"],
      ],
      ["codex sessions", getAvailableCodexModes, ["read-only", "auto", "full-access"]],
    ])(
      "includes correct modes for %s",
      (_label, getModes, expected) => {
        expect(getModes().map((mode) => mode.id)).toEqual(expected);
      },
    );
    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/agent/src/execution-mode.test.ts
    Line: 1-22
    
    Comment:
    **Prefer parameterised tests**
    
    Both test cases call `getModes().map((mode) => mode.id)` and compare against a fixed array — the same assertion shape for two different adapters. Per the team's convention, these should use `it.each`:
    
    ```typescript
    it.each([
      [
        "claude sessions",
        getAvailableModes,
        ["auto", "default", "acceptEdits", "plan", "bypassPermissions"],
      ],
      ["codex sessions", getAvailableCodexModes, ["read-only", "auto", "full-access"]],
    ])(
      "includes correct modes for %s",
      (_label, getModes, expected) => {
        expect(getModes().map((mode) => mode.id)).toEqual(expected);
      },
    );
    ```
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix All With AI
This is a comment left during a code review.
Path: packages/agent/src/execution-mode.test.ts
Line: 5-22

Comment:
**Tests assume non-root environment**

Both tests hard-code `bypassPermissions` and `full-access` in their expected arrays, but those modes are only pushed onto the lists when `ALLOW_BYPASS = !IS_ROOT`. If the test process runs as UID 0 (common in Docker-based CI), `IS_ROOT` is `true`, neither mode is ever added, and the actual arrays will be `["auto","default","acceptEdits","plan"]` / `["read-only","auto"]` — causing both tests to fail without any obvious connection to the root check.

The tests need either a jest/vitest mock for `IS_ROOT`, a `vi.mock("./utils/common", ...)` call, or separate test cases for each branch.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: packages/agent/src/execution-mode.test.ts
Line: 1-22

Comment:
**Prefer parameterised tests**

Both test cases call `getModes().map((mode) => mode.id)` and compare against a fixed array — the same assertion shape for two different adapters. Per the team's convention, these should use `it.each`:

```typescript
it.each([
  [
    "claude sessions",
    getAvailableModes,
    ["auto", "default", "acceptEdits", "plan", "bypassPermissions"],
  ],
  ["codex sessions", getAvailableCodexModes, ["read-only", "auto", "full-access"]],
])(
  "includes correct modes for %s",
  (_label, getModes, expected) => {
    expect(getModes().map((mode) => mode.id)).toEqual(expected);
  },
);
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Add auto permission mode for Claude adap..." | Re-trigger Greptile

@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch 2 times, most recently from 9466e82 to 93df89e Compare April 21, 2026 03:28
@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch from 93df89e to 200093b Compare April 21, 2026 03:48
@charlesvien charlesvien force-pushed the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch from 7f338d1 to 65b74b6 Compare April 21, 2026 03:56
@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch from 200093b to b51fcb1 Compare April 21, 2026 03:56
Copy link
Copy Markdown
Contributor

@jonathanlab jonathanlab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super excited about this!

@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch from b51fcb1 to 7353f59 Compare April 21, 2026 18:57
@charlesvien charlesvien force-pushed the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch from 65b74b6 to 5a8876b Compare April 21, 2026 18:57
@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch 2 times, most recently from 28d67c4 to f3aebc9 Compare April 21, 2026 19:25
@charlesvien charlesvien force-pushed the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch from ccf9656 to 3687000 Compare April 21, 2026 19:25
@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch from f3aebc9 to a595db2 Compare April 21, 2026 19:28
@charlesvien charlesvien force-pushed the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch 3 times, most recently from 96d7541 to 79e0837 Compare April 21, 2026 19:47
@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch from a595db2 to bd70b17 Compare April 21, 2026 19:47
@charlesvien charlesvien changed the base branch from 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ to graphite-base/1749 April 21, 2026 19:57
@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch from bd70b17 to fe61322 Compare April 21, 2026 19:57
@graphite-app graphite-app Bot changed the base branch from graphite-base/1749 to main April 21, 2026 19:57
@charlesvien charlesvien force-pushed the 04-20-add_auto_permission_mode_for_claude_adapter branch from fe61322 to d027c20 Compare April 21, 2026 19:57
@charlesvien charlesvien merged commit 8a9408d into main Apr 21, 2026
15 of 16 checks passed
Copy link
Copy Markdown
Member Author

Merge activity

@charlesvien charlesvien deleted the 04-20-add_auto_permission_mode_for_claude_adapter branch April 21, 2026 20:05
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