Skip to content

[flutter_tools] Remove AzureDetector IMDS probe from BotDetector #194405

Closed

Description

@kevmoo

AzureDetector.isRunningOnAzure probes the Azure Instance Metadata Service (http://169.254.169.254/metadata/instance) on startup and caches isRunningOnBot = true in ~/.flutter_tool_state, which classifies every Azure-hosted developer workstation as a CI bot and forces BotDetector.isRunningOnBot to be asynchronous.

  • Root cause: BotDetector.isRunningOnBot falls back to an HTTP GET to 169.254.169.254 whenever no CI environment variable is set, treating any HTTP response (including HttpException at #L108-L111) as a bot and persisting that result in persistentToolState. Meanwhile, bot_detector.dart#L42 checks _platform.environment.containsKey('CI'), treating CI=false and CI=0 as bots.
  • Impact: Human developers using GitHub Codespaces, Microsoft Dev Box, or Azure VMs are permanently flagged as bots—suppressing analytics (NoOpAnalytics()), skipping update checks (flutter_command_runner.dart#L477), and auto-deleting ~/.gradle without prompting on Gradle errors (gradle_errors.dart#L195)—while non-Azure users pay up to a 250ms–1s network timeout on first run or hit proxy redirect issues (see #189456). Azure Pipelines CI runs are already detected synchronously via TF_BUILD (bot_detector.dart#L69).

Proposed Fix

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    team-toolOwned by Flutter Tool team
    on Oct 14, 2026
  2. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Oct 15, 2026
  3. kevmoo commented on Oct 16, 2026

    @kevmoo
    ContributorAuthor

    #194530 removes AzureDetector and PersistentToolState.isRunningOnBot caching and aligns BotDetector.isRunningOnBot with Analytics.isBot (landed in dart-lang/tools#2687).

    Remaining steps to close this issue once package:unified_analytics >= 8.2.0 is published and rolled into flutter_tools:

    • Delegate BotDetector.isRunningOnBot directly to Analytics.isBot(_platform.environment).
    • Migrate BotDetector.isRunningOnBot and globals.isRunningOnBot from Future<bool> to synchronous bool.
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

    P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions