Skip to content

Align Claude bypass mode and session controls#139

Merged
realDuang merged 4 commits intomainfrom
fix/claude-bypass-permissions
Apr 30, 2026
Merged

Align Claude bypass mode and session controls#139
realDuang merged 4 commits intomainfrom
fix/claude-bypass-permissions

Conversation

@realDuang
Copy link
Copy Markdown
Owner

@realDuang realDuang commented Apr 29, 2026

Summary

  • Make Claude Bypass Permissions the first/default Claude mode and wire it through native Claude Code bypass options, while removing Claude autopilot and Auto-Accept exposure.
  • Rework chat session controls into a unified popover for model, reasoning effort, and Codex fast mode, with model-specific effort options.
  • Restore channel /mode as a current-session command, keep /model session-scoped, add /effort, and reconcile effort when channel model changes.

Test plan

  • bun run typecheck
  • bunx vitest run tests/unit/electron/engines/claude/index.test.ts tests/unit/electron/channels/shared/session-commands.test.ts tests/unit/electron/channels/shared/command-parser.test.ts tests/unit/electron/channels/feishu/feishu-card-builder.test.ts
  • bun run build
  • Manual desktop UI and real IM channel smoke tests were not run in this terminal-only environment.

🤖 Generated with Claude Code

Route Claude bypass mode through the Claude Agent SDK permission mode so it matches Claude Code and no longer relies on a Copilot-style autopilot shim.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 29, 2026 09:09
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 75.26% (🎯 50%) 10816 / 14370
🔵 Statements 73.87% (🎯 50%) 11515 / 15588
🔵 Functions 71.13% (🎯 50%) 1809 / 2543
🔵 Branches 68.37% (🎯 50%) 6727 / 9838
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
electron/main/channels/gateway-ws-client.ts 95.58% 83.63% 93.18% 96.82% 181, 328-336
electron/main/channels/dingtalk/dingtalk-adapter.ts 62.74% 60.13% 57.62% 64.74% 86-90, 138-139, 166-235, 317-320, 377-401, 433-434, 448, 457, 459-468, 483-496, 528, 546, 555, 575, 588, 590, 607, 631-650, 670, 719-763, 773, 815-817, 917, 920-926, 928, 960-1099, 1108, 1164-1168, 1173, 1181-1191, 1202, 1226
electron/main/channels/feishu/feishu-card-builder.ts 95.65% 88.88% 100% 95.45% 61
electron/main/channels/shared/command-parser.ts 88.88% 85.71% 100% 100% 43, 47
electron/main/channels/shared/command-types.ts 100% 100% 100% 100%
electron/main/channels/shared/help-text-builder.ts 95.23% 77.77% 50% 95.23% 59-62
electron/main/channels/shared/session-commands.ts 91.79% 82.24% 100% 93.27% 32, 37, 47, 126-127, 142, 186, 190, 219-220, 269
electron/main/channels/weixin-ilink/weixin-ilink-adapter.ts 64.48% 57.47% 62.26% 66.58% 127-128, 147-183, 304-320, 332, 337-338, 348-350, 352-382, 388-408, 503-504, 515, 523, 525-534, 550-563, 594, 607, 614, 633, 645, 647, 683, 730-732, 800, 841-884, 892, 908-922, 941-954, 958, 988, 999-1012
electron/main/engines/claude/index.ts 66.17% 58.19% 58.57% 67.21% 183-194, 211-212, 212, 299-486, 494, 549-562, 611-629, 636-637, 843-847, 893-897, 936, 940-941, 949-952, 990, 998-1000, 1006-1226, 1279-1282, 1389-1481, 1510-1512, 1588-1679, 1718-1734, 1759, 1775, 1776, 1807-1808, 1810-1835, 1841-1865, 1885, 1901-1911, 1916, 1919, 1925, 1929, 1986, 2028, 2047, 2149, 2153-2164, 2216-2238, 2251, 2275-2309, 2321-2323, 2387, 2412-2417, 2466, 2491-2541, 2921, 3004, 3064, 3350, 3406-3407, 3467-3468, 3472-3473, 3510-3574
Generated in workflow #445 for commit 8475e39 by the Vitest Coverage Report Action

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Claude Code engine integration to use Claude’s native bypassPermissions permission mode (instead of a Copilot-style “autopilot” mode), including wiring the required SDK options and adding regression tests.

Changes:

  • Replace the Claude “autopilot” mode with a new bypassPermissions mode and map selected UI mode → SDK permissionMode.
  • Ensure sessions are recreated when entering bypassPermissions unless the session was created with allowDangerouslySkipPermissions.
  • Update UI mode styling/behavior for the new mode and add unit tests covering bypass behavior and session recreation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
electron/main/engines/claude/index.ts Implements bypassPermissions mode, validates/mappings to SDK PermissionMode, and passes allowDangerouslySkipPermissions with session recreation when needed.
tests/unit/electron/engines/claude/index.test.ts Adds coverage for bypass permission pass-through, session recreation rules, and ensures “autopilot” is no longer exposed by getModes().
src/pages/Chat.tsx Updates mode badge styling so bypassPermissions is grouped with the “autonomous/auto-accept” styling bucket.
src/components/PromptInput.tsx Updates mode color/icon/placeholder logic to treat “Bypass Permissions” similarly to “Autopilot” in the UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread electron/main/engines/claude/index.ts Outdated
Comment thread electron/main/engines/claude/index.ts
@realDuang realDuang changed the title Fix Claude bypass permissions mode Align Claude bypass mode and session controls Apr 30, 2026
realDuang and others added 2 commits April 30, 2026 13:04
Keep Claude bypass mode and session model/mode/effort controls consistent across the chat UI and channel commands.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Reuse the Claude session cleanup helper when rebuilding sessions for bypass permissions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread electron/main/engines/claude/index.ts Outdated
Comment thread src/components/SessionControls.tsx
Keep Claude session reuse defaults aligned with new-session defaults and close the session controls popover on Escape from any focused control.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@realDuang realDuang merged commit 8ee400b into main Apr 30, 2026
11 checks passed
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