Skip to content

--yolo launch flag swallowed by the pre-auth fail-closed bypass cap, never re-applied once the policy resolves #4844

Closed

Description

@rameshreddy-adutla

Describe the bug

On interactive startup the CLI applies the managed-settings fail-closed posture that disables bypass-permissions mode, during the brief pre-auth window before the server policy can be fetched. --yolo / --allow-all are applied inside that window via permissions.setMode({mode:"allow-all", source:"cli_flag"}), so the call is rejected.

Roughly 600 ms later the real policy arrives, the runtime correctly logs that bypass is not restricted, and the cap is lifted. But the launch flag is never re-applied. The session therefore runs with the flag silently inert, and every shell command that falls outside permissions-config.json prompts for the rest of the session.

This is a close relative of #4757, but not the same failure. In #4757 the policy resolves as absent and the restriction is never lifted. Here the policy resolves successfully from the server, the restriction is lifted, and the bug is purely that the cli_flag mode set is not retried afterwards.

Startup log (redacted)

Launched as copilot.exe --resume --yolo on 1.0.83, Windows 11:

19:31:52.530 [managedSettings] device MDM: no policy present on this device
19:31:52.530 [managedSettings] server policy fetch skipped: no authenticated GitHub host available
19:31:52.530 [managedSettings] effective policy resolved: source=none, bypassDisabled=false,
                               serverFetchFailed=false, policyHelperFailed=false, policyHelperFailClosed=false
19:31:52.552 [managedSettings] applied: no bypass restriction in force (managed policy absent)
19:31:52.553 [managedSettings] applied: bypass-permissions mode DISABLED by enterprise policy
                               (fail-closed: policy could not be determined)
                               - /allow-all and permission escalation are now blocked
19:31:53.084 [managed_policy]  managed permission policy now caps bypass-permissions escalation
                               (approve-all, unrestricted paths/URLs) {"bypass_blocked":true}
19:31:53.104 [managedSettings] server policy served from fresh cache (age 2960413ms) for https://github.com:
                               bypassDisabled=false, keys=[model,permissions]
19:31:53.104 [managedSettings] effective policy resolved: source=server, bypassDisabled=false,
                               serverFetchFailed=false, policyHelperFailed=false, policyHelperFailClosed=false
19:31:53.105 [managed_policy]  managed permission policy no longer caps bypass-permissions escalation
                               (approve-all, unrestricted paths/URLs) {"bypass_blocked":false}
19:31:53.105 [managedSettings] applied: no bypass restriction in force
                               (managed policy present but does not disable bypass)

The policy on this account explicitly does not disable bypass (bypassDisabled=false). The block is entirely self-inflicted by the pre-auth window, and it lasts 575 ms, which is long enough to swallow the launch flag.

The same flip-flop repeats on every launch. A second process in the same log shows it again at 19:33:38.437 through 19:33:38.899.

Observed effect

In a session started with --yolo, the event log still records permission.requested for shell commands. Only commands matching the location allowlist in permissions-config.json run unprompted, which is the pre---yolo behaviour. Commands the PowerShell parser cannot statically classify prompt every time, including:

  • the call operator, logged as "identifier": "<command with expression as name>"
  • multi-line scripts with assignments or loops, where the whole script collapses into a single identifier
  • anything with hasWriteFileRedirection: true

Those requests also carry "canOfferSessionApproval": false, so there is not even an "approve for session" escape hatch.

Expected behaviour

Either of:

  1. Do not apply the fail-closed cap when the policy is merely undetermined because auth has not resolved yet. server policy fetch skipped: no authenticated GitHub host available is not a failure, and the resolver itself reports serverFetchFailed=false with no failure flag set.
  2. Re-apply pending source:"cli_flag" permission modes once the policy resolves and the cap is lifted.

Option 2 alone fixes this report. Option 1 additionally covers #4757.

Version history

This became reachable in 1.0.60: "Enforce bypass permissions policy for --allow-all-tools, --allow-all-paths, and --allow-all-urls flags". Before that the launch flags skipped the policy check, so the startup race was harmless. permissions.disableBypassPermissionsMode itself landed in 1.0.55, and 1.0.81 tightened handling further.

Workaround

Running /allow-all on after the session is up works, because by then bypass_blocked is false. It has to be repeated on every launch.

Environment

  • CLI 1.0.83, Windows 11 Enterprise x64
  • Corporate-managed device behind a TLS-inspecting proxy, which plausibly widens the pre-auth window
  • Account has a server-side managed policy covering [model, permissions] that does not set disableBypassPermissionsMode

Related

Activity

  1. lexx42xxel commented on Sep 18, 2026

    @lexx42xxel

    really painful, pls fix asap

  2. lexx42xxel commented on Sep 21, 2026

    @lexx42xxel

    Additional data point: this isn't just a slow-fetch race — it's a permanent latch, it can reproduce on a fully fresh (non-resumed) session, it can trigger mid-session after 30+ minutes of working correctly, and once it hits,  /allow-all  (toggled off/on manually) does not recover it.

    Sequence (debug log, GHE enterprise account,  --yolo ):

    15:28:46.415 Auth: UserToken succeeds
    15:28:46.700 "Starting Copilot CLI"
    15:28:46.701 managed_policy: bypass_blocked=true (fail-closed, policy undetermined)
    15:28:46.701 self-fetch starts for enterprise account
    15:28:46.702 resolved from cache -> bypass_blocked=false (heals in ~1ms)
    ...
    15:29:01.6 Permission request (read/shell)
    15:29:02.8 respondToPermission: kind=reject <- required manual action

    Despite  bypass_blocked  flipping back to  false  within 1ms, every later permission request in the session still required manual approval. Toggling  /allow-all off  then  /allow-all on  again in-session does not restore real bypass either.

    Separately, in another session the cap only latched once, ~30 minutes into an otherwise working session — an internal periodic restart of the embedded CLI server appears to re-run the startup gate check every ~7–15 min. From that point on, prompts appeared for actions identical to ones auto-approved earlier in the same session.

    Tested and ruled out as fixes:

    • Pre-warming the managed-settings cache — cap still flips true→false, doesn't prevent the latch.
    •  --no-auto-update  — same latch, no change.
    • Downgrading the CLI to an older version — same latch, so not a recent regression.

    Trigger condition observed: whether the fail-closed tick fires at all seems to depend on whether enterprise auth resolves before the  Starting Copilot CLI  gate check runs. When auth is slower, the gate takes the harmless "managed policy absent" path and bypass works normally for the whole session.

    Core bug: any momentary fail-closed hit — at startup or later via periodic internal re-checks — permanently disables real-time bypass for the rest of the session, even after the policy immediately resolves as non-restrictive, and is not recoverable via  /allow-all .

    CLI downgrade to older version also did not help, it may get more likely when policy retrictions on allow-all are added (we had none and then some were added which seems to have trigger the problem, most were removed again), before there were no issues, now it happens constantly.

    Most people in my company that work with copilot-cli cannot use it all at the moment.

    https://media1.tenor.com/m/SFmuIQmkIkQAAAAC/catfix-funny.gif

  3. lexx42xxel commented on Sep 23, 2026

    @lexx42xxel

    I apply yolo at start and I try to reapply it after it was lost (can be right at the start or mid session) but reapplying has no effect. Not sure I fully understood your question though.

  4. copilot-cli-bot commented on Oct 8, 2026

    @copilot-cli-bot

    This appears to be resolved as of GitHub Copilot CLI v1.0.93. Please update to that release or a newer stable version. We're closing this as completed. If it still happens, please comment with your version and reproduction steps.

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