Skip to content

Deleted GitHub workflows and Azure DevOps pipelines stay in the table forever and keep being polled #340

Open

Description

@matt-edmondson

What's wrong

A build is never removed when its workflow or pipeline definition is deleted, as long as the API keeps answering for it.

GitHub. GitHub.UpdateBuildsAsync adds or renames a Build for every entry in GitHubWorkflows.List(...), but it never removes one and never reads workflow.State. GitHub's "list repository workflows" endpoint keeps returning a workflow whose file was deleted (with state: "deleted") for as long as the workflow has runs. ListByWorkflow for that id still returns 200 with the old runs. So the only removal path, catch (NotFoundException) in UpdateBuildAsync, never fires.

Azure DevOps. AzureDevOps.cs has no removal path at all; it contains no TryRemove. UpdateBuildsAsync only adds definitions from GetDefinitionsAsync, and UpdateBuildAsync has no not-found handling. A deleted definition either keeps its last status, or its exception lands in the generic VssServiceException catch and sets ProviderStatus.Error on every poll.

Failure scenario

  1. A repo has ci.yml and old-release.yml, and the last old-release.yml run failed.
  2. The user deletes old-release.yml.
  3. BuildMonitor shows an "old-release" row with a red Failure status for the rest of the session, and after restarts too, because builds are persisted in AppData.
  4. BuildSync keeps polling the workflow every 60–120 s, spending rate-limit budget on a pipeline that no longer exists.

The Azure DevOps case: after a pipeline is deleted, its row stays forever, and if the API throws for it, the provider status flips to Error on every poll.

PruneOrphanedAndCompletedSyncs would already clean up the sync once the Build leaves repository.Builds, because BuildSync.IsOrphaned becomes true. This is separate from #312, which covers archived or removed repositories.

Suggested fix

  • GitHub:
    • In UpdateBuildsAsync, treat workflows whose State == WorkflowState.Deleted as absent.
    • After a successful and complete listing, remove every repository.Builds entry whose id is not among the live workflows, then call QueueSaveAppData().
    • Workflows.List(owner, repo) returns only the first page (30 by default). Fetch all pages before pruning, or repos with more than 30 workflows would lose real builds.
  • Azure DevOps:
    • In UpdateBuildsAsync, remove builds whose definition id is no longer returned by GetDefinitionsAsync.
    • In UpdateBuildAsync, catch DefinitionNotFoundException and remove the build, matching GitHub's NotFoundException handling.
  • Prune only after the listing request succeeded, so a transient failure never empties a repository.

Acceptance criteria

  • When a listing drops a definition, the repository loses that Build, and its BuildSync is pruned on the next pass.
  • A GitHub workflow with state deleted is not shown.
  • A failed listing removes nothing.
  • A repository with more than 30 workflows keeps all of its live builds.

Activity

  1. added
    bug
    on Oct 6, 2026
  2. matt-edmondson commented on Oct 6, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions