Skip to content

[Bug]: Full access intermittently falls back to approval checks when another Claude process is rewriting remote-settings.json #34557

Open

Description

@THEtheChad

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Impact

Minor bug or occasional failure

Version or commit

t3 0.1.2 (linux-x64 runtime); the same code is on main @ 836b86a

Environment

Ubuntu 24.04 on WSL2, Claude Code 2.1.306, Agent SDK 0.3.276, a Claude provider instance with a custom CLAUDE_CONFIG_DIR, many concurrent Claude threads

Steps to reproduce

Timing-dependent; it shows up when several Claude threads run on one provider instance.

  1. Run several Claude threads in Full access on the same provider instance (same CLAUDE_CONFIG_DIR).
  2. Start a new Claude thread, or resume one, at about the same moment another thread's claude process is starting.
  3. If the new turn's bypass check reads <CLAUDE_CONFIG_DIR>/remote-settings.json while the other process is rewriting it, the turn is downgraded.

Deterministic repro for a test: have fileSystem.readFileString return "" (or a truncated JSON prefix) for remote-settings.json on the first call and {} on the second.

Expected behavior

The turn runs with bypassPermissions. A half-written settings file is a temporary state, not a policy that disables bypass.

Actual behavior

The turn runs with approval checks and shows:

T3 could not confirm Claude bypass permissions here, so Full access is running with approval checks.

The thread's next turn usually checks fine (failures aren't cached), but the notice only appears once per thread, so a later downgrade in the same thread is silent.

Root cause

Claude Code rewrites remote-settings.json in place, emptying it first. In Claude Code 2.1.306:

  • Every new claude process re-downloads the org's managed settings at startup and saves them to <CLAUDE_CONFIG_DIR>/remote-settings.json, even when nothing changed (here it is just {}).
  • Running processes also re-download them in the background.
  • The save opens the file in "w" mode, which empties it, then writes, flushes to disk and closes. There's no temp-file-and-rename, so a reader in that window sees an empty or partial file.

I measured the rewrite at about 370–430 ms after each new process starts. A follow-up turn in an already-running process didn't write the file.

T3 treats a half-written file as "bypass disabled". readBypassSettings in ClaudeAdapterV2.ts only tolerates NotFound. A parse failure (SchemaError: Expected a valid JSON string) fails resolveBypassAvailability. Then queryPolicyForTurn turns any failure into { bypassDisabled: true }:

const resolved = yield* resolveBypassAvailability(cwd).pipe(Effect.option);
if (Option.isNone(resolved)) {
  return claudeRuntimeQueryPolicyForRuntimePolicy(turnInput.runtimePolicy, {
    bypassDisabled: true,
    autoDisabled: false,
  });
}

Failing safe is right (see #4927). The problem is that a temporary half-written file counts as a failure.

A thread never collides with its own process: T3 runs the bypass check about 80 ms before it starts the thread's claude process. The collision is with another thread, a delegated task or a resumed session starting at the same time. All threads on a provider instance share one CLAUDE_CONFIG_DIR, so this gets more likely the more threads are running.

Proposed fix

In readBypassSettings, retry the read and parse a few times with a short backoff (for example 50, 100 and 200 ms) when decoding fails. Only parse failures retry. A missing file still counts as {}, and other errors fail at once.

If every attempt fails, behave as today and downgrade with the notice. The result only uses what was actually read in the current check: nothing is cached or treated as empty, so a policy that really disables bypass is always honored.

Suggested test: a file-system stub that returns "" and then {} for remote-settings.json should resolve with bypass available. One that returns "" every time should still downgrade.

Logs or stack traces

# server.trace.ndjson, the only failure among 12 retained resolveBypassAvailability spans
2026-11-11T20:33:22.897Z ClaudeAdapterV2.resolveBypassAvailability exit=Failure
SchemaError: Expected a valid JSON string
    at ClaudeAdapterV2.resolveBypassAvailability (.../t3-0.1.2-linux-x64/t3:267742:31)
    at ClaudeAdapterV2.startTurn (.../t3:354003:171)
    at RunExecutionService.startRootRun (.../t3:371948:24)
    at ProviderTurnStartService.start (.../t3:372361:58)

# remote-settings.json rewrites vs. new claude processes (50 ms polling)
14:48:31.909 new claude process   14:48:32.337 remote-settings.json rewritten (size 2)
14:48:59.721 new claude process   14:49:00.093 remote-settings.json rewritten (size 2)
(follow-up turn in an existing process: no rewrite)

Screenshots, recordings, or supporting files

The notice as it appears in the thread:

T3 could not confirm Claude bypass permissions notice

Workaround

Send another turn in the thread. The check runs again and normally succeeds.

Activity

  1. added a commit that references this issue on Nov 11, 2026
    2d86863
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions