bypassPermissions mode resets to 'default' during long sessions at system boundaries

Resolved 💬 9 comments Opened Mar 24, 2026 by carrgust Closed May 13, 2026

Bug Description

The permissionMode set to bypassPermissions in settings (global, user-local, and project-local) spontaneously resets to default during long-running sessions, causing unexpected permission prompts for Edit/Write operations.

Environment

  • Claude Code version: 2.1.81
  • OS: macOS (Darwin 24.5.0)
  • Settings: "defaultMode": "bypassPermissions" configured at all 3 levels (global settings.json, settings.local.json, and project .claude/settings.local.json)
  • skipDangerousModePermissionPrompt: true

Steps to Reproduce

  1. Configure "defaultMode": "bypassPermissions" in ~/.claude/settings.json
  2. Start a long-running session (3+ hours, many tool calls)
  3. Observe that initially all Edit/Write operations are auto-approved
  4. After extended use (system boundaries / file-history-snapshots), the mode resets

Evidence from Session Logs

Extracted from session ab5018b6 JSONL logs, tracking permissionMode field across user messages:

L17   12:15  MODE: None → bypassPermissions    ← Session starts correctly
L477  17:53  MODE: bypassPermissions → default  ← UNEXPECTED RESET
L510  17:58  MODE: default → acceptEdits        ← User selects "allow all edits" from prompt
L581  18:17  MODE: acceptEdits → bypassPermissions  ← Restores spontaneously
L634  18:29  MODE: bypassPermissions → acceptEdits  ← Resets again

Pattern

Every mode reset correlates with a system: {} event followed by a file-history-snapshot:

L474  17:52  assistant: "Tudo concluído..."
L475  17:52  system: {}                    ← SYSTEM BOUNDARY
L476         file-history-snapshot
L477  17:53  user [default]:               ← MODE DROPPED TO DEFAULT

This pattern repeats at every transition point (L508→L510, L632→L634).

Expected Behavior

permissionMode should remain bypassPermissions for the entire session duration, as configured in settings. System boundaries and file-history-snapshots should not affect the permission mode.

Actual Behavior

The mode oscillates between bypassPermissions, default, and acceptEdits within a single session, causing:

  • Unexpected permission prompts interrupting autonomous workflows
  • User has to repeatedly re-approve edits
  • Inconsistent behavior that undermines the bypass setting

Workaround

A PreToolUse hook that forces permissionDecision: "allow" for Edit/Write/MultiEdit tools:

// ~/.claude/settings.json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "$HOME/.claude/hooks/auto-approve-edits.sh"
          }
        ]
      }
    ]
  }
}
#!/bin/bash
# ~/.claude/hooks/auto-approve-edits.sh
echo '{"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "allow"}}'
exit 0

Impact

  • Severity: Medium — disrupts autonomous workflows in bypassPermissions mode
  • Frequency: Occurs in every long session (3+ hours) with many tool calls
  • Affected users: Anyone relying on bypassPermissions for unattended/autonomous operation

View original on GitHub ↗

This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗