Skip to content

[Bug]: A provider refresh can overwrite a newer enriched status with its pending probe snapshot #29593

Closed

Description

@e18cheng

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

Steps to reproduce

  1. Configure a provider that uses background snapshot enrichment (ACP Registry is the clearest case; Claude, Codex, Grok, OpenCode, Pi, Muse and Antigravity also pass enrichSnapshot) and leave it signed out.
  2. Start the app so the startup probe runs, and have any refresh land while that first probe is in flight (at startup this happened on its own).
  3. Make the background enrichment finish before the refresh call returns. With an ACP agent this happens when the agent's probe is fast (about 2 s), because the ACP driver's refresh also waits on refreshMethods after the snapshot refresh.

Expected behavior

Once enrichment finds the provider needs sign-in, Settings > Providers and the provider-status banner show that, and the status cache stores it.

Actual behavior

The provider stays on "Checking ACP authentication, models, and commands in the background..." with no sign-in banner. Pressing Refresh in Settings > Providers fixes it, and so does anything else that republishes the snapshot.

Impact

Minor bug or occasional failure

Version or commit

main @ cbd3e14

Environment

macOS 26 (Darwin 25.6), desktop app, ACP Registry provider (acpRegistry driver) whose agent answers its probe in about 2 s.

Logs or stack traces

Timeline from the trace
19:08:49.113: a refresh interrupts the first startup probe. applySnapshotBase publishes the pending snapshot ("Checking ACP authentication...") and restarts enrichment.
19:08:51.445: enrichment finishes. publishEnrichedSnapshot, then syncProvider and persistProvider (through the source's streamChanges), store the real result: auth required.
19:08:51.450: refreshOneSource reaches its own syncProvider / persistProvider with the value refresh returned, which is the 19:08:49.113 pending snapshot. It overwrites the enriched snapshot in memory and in the status cache.
Root cause
refreshOneSource in apps/server/src/provider/ProviderRegistry.ts syncs the value providerSource.refresh returns. For a managed provider with enrichment, applySnapshotBase in packages/provider-core/src/server/managedProvider.ts publishes the probed snapshot, forks enrichment, and returns that pre-enrichment snapshot. Once enrichment publishes, the returned value is stale. If that happens before refreshOneSource reaches syncProvider, the stale snapshot is upserted and persisted last and wins. With a slow probe, enrichment lands after the refresh's sync, so the bug stays hidden.

Every refresh entry point goes through refreshOneSource (refresh, refreshInstance, refreshAll, reloadSecretsAndRefresh, refreshAfterUpdate).

Screenshots, recordings, or supporting files

No response

Workaround

Press Refresh in Settings > Providers after startup.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Nov 2, 2026
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

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions