Files
openclaude/tests
4a4f379b8c Add full access mode and fix bypass commit prompts (Issue 1097) (#1110)
* Add full access permission mode

Introduce a Full Access mode as a second-level dangerous permission option that bypasses normal confirmation prompts and hard safety-check prompts while still preserving deny decisions.

Wire fullAccess through permission mode types, SDK schemas/types, CLI and REPL control paths, settings, mode cycling, spawned teammate inheritance, prompt speculation, and setup safety checks.

Update permission handling so Full Access skips ask rules, requiresUserInteraction prompts, content-specific ask results, safety-check asks, and hook-forced asks while preserving updatedInput from tool permission checks.

Add a separate Full Access warning acknowledgement and render Full Access selections in red to make the higher-risk mode visually distinct.

Allow the project-local .git/OPENCLAUDE_COMMIT_MSG helper file in dangerous modes for /commit while keeping default mode and other .git paths protected by safety prompts.

Add focused regression tests for Full Access prompt bypass behavior, hook ask handling, commit message file permissions, mode cycling, spawned teammate propagation, and SDK permission mappings.

* fix: restore sdk permission fail-closed behavior

Preserve host canUseTool and onPermissionRequest enforcement in fullAccess instead of short-circuiting around SDK policy callbacks.

Keep the default SDK permission path fail-closed when no host callback is configured, while still allowing interactive tools to surface guidance prompts under fullAccess.

Add focused regression coverage for SDK permission routing and fullAccess user-interaction behavior, plus filesystem coverage for the project-local OPENCLAUDE_COMMIT_MSG path.

* fix: complete full access permission mode integrations

- keep Full Access out of persisted default permission mode settings

- sync Full Access to Claude in Chrome skip-all permission mode

- restore Full Access correctly when exiting plan mode

- add regression coverage for settings, Chrome sync, and plan-mode exit

* test: harden dangerous mode startup flow

* feat: add permission mode management tab

Add a dedicated permission mode tab for switching session modes from the permissions UI.

Keep dangerous modes visible when currently active, route dangerous mode changes through the confirmation dialog without exiting settings, and surface availability errors for auto or bypass modes.

Also add focused tests for permission mode option visibility.

* feat: add full access approval flows

Add fullAccess as an approval option across file, shell, skill, monitor, web fetch, fallback, and plan-exit permission prompts.

Introduce a shared dangerous-mode confirmation hook, wire fullAccess session mode updates through the permission handlers, and gate the new option on dangerous-mode availability.

Also fix the plan-exit follow-up review findings by preserving hook order around the dangerous-mode dialog and restoring Shift+Tab to the explicit accept-edits approval path.

Verified with focused permission tests and Bun module import smoke checks.

* Harden dangerous permission mode boundaries

Tighten fullAccess and bypassPermissions entry paths so elevated mode always respects explicit local confirmation and authoritative org policy gates.

This hardens SDK and bridge activation, Chrome integration, session resume and rewind restoration, team and plan mode transitions, and shared permission update handling. It also keeps session dangerous-mode state in sync and adds focused regression coverage for permission setup, killswitch behavior, conversation recovery, and SDK permission flows.

* refactor: centralize permission mode transitions

Route permission mode changes through shared decision and live-transition helpers so dangerous/full-access confirmation, plan/auto side effects, and mode application stay aligned across CLI, REPL, prompts, and swarm surfaces.

Add a shared UI request hook for resolved dangerous-mode confirmations, persist in-session dangerous-mode acceptance, and remove duplicated request/confirm/apply flows from prompt input, teams, plan exit, and permission settings.

Also fix follow-up correctness issues by validating all setMode updates consistently, applying live permission updates before persisting them, and rebasing those live updates on the latest permission context to avoid partial commits or stale-state overwrites.

* refactor: simplify permission request flows

Centralize permission mode changes behind requestPermissionModeChange and reuse it from the CLI, REPL bridge, inbox poller, and UI callers.

Consolidate duplicated permission request behavior by introducing shared shell and simple permission helpers, routing file permission actions through a shared executor, and unifying remote permission queue-item construction.

Add a shared PermissionScaffold for the common dialog frame, remove redundant shell option/helper modules, and keep focused permission mode transition coverage in permissionSetup tests.

* Enable full access from the permissions UI

Expose bypass/full-access modes in the /permissions picker so dangerous modes can be enabled in-session instead of only via launch flags.

Propagate a session-only bypass-enable signal through the permission mode change flow, preserve the existing dangerous-mode confirmation and policy checks, and keep the session marked as bypass-capable after the user enables one of the dangerous modes.

Also add targeted tests covering picker visibility, local session unlock behavior, and the post-enable session state.

* Refine bypass permissions warning copy

* fix(powershell): anchor commit message .git exception to project root

Align the PowerShell .git write safety exception for
.git/OPENCLAUDE_COMMIT_MSG with the shared filesystem permission rule.
The PowerShell helper was resolving the path from the mutable shell cwd,
which made the bypassPermissions and fullAccess cases order-sensitive in
the full test suite. Resolve the exception from getOriginalCwd() instead
so the temp commit message file is only exempted inside the project root
.git directory while other .git writes still require a safety prompt.

Verified with:
- bun test src/tools/PowerShellTool/powershellPermissions.test.ts --max-concurrency=1
- bun test src/utils/permissions/filesystem.test.ts --max-concurrency=1
- bun test src/tools/PowerShellTool src/utils/permissions --max-concurrency=1

* test: fix dangerous mode prompt suite hang

* Fix monitor permission test isolation

* Harden monitor permission state selector

---------

Co-authored-by: JATMN <12479882+jatmn@users.noreply.github.com>
Co-authored-by: TechBrewBoss <dash@hicap.ai>
2026-05-31 09:03:49 +08:00
..