Skip to content

fix(github): project sync's board lookup and field provisioning fail closed on a failed read #1376

Closed

Description

@dan-petty

Problem

devops gh project sync still reads the board's fields through _fetch_existing_fields_by_name (github/projects.py). It returns {} when gh project field-list exits non-zero or prints nothing, so sync takes every template field as missing and runs field-create for each. link_project_to_repository turns a failed link into linked=False and drops the error. find_remote_project's reads (_find_project_via_repo, _find_project_via_rest, _find_project_via_cli) treat a failed read as 'not found', so a transient failure can create a duplicate board. #892 made reconcile's field read fail closed (it uses the roadmap store's FieldListingPayload with its totalCount check) but left sync's provisioning and lookup reads as they were.

Proposed remedy

Read the fields through field_list_args and FieldListingPayload, as reconcile does. Raise on a non-zero exit or malformed output in the board lookup, distinguishing 'no such board' from 'could not read'. Report a failed link with gh's error. Sync should then exit 1 instead of guessing. Fold this into #999 if that item takes over sync's provisioning.


Found on 2026-10-08 while implementing #892. Filed directly with no priority; the roadmap service's intake sets Priority, Value and Effort.

Activity

  1. added
    type/bug
    scope/github
    source/agent
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. A correctness bug that can create duplicate boards and fields, but only under transient read failures and the damage is recoverable.
    • Value: Medium. Prevents silent data corruption (duplicate boards/fields) that would require manual cleanup, but only manifests during transient API failures.
    • Effort: Medium. Requires changing multiple functions (_fetch_existing_fields_by_name, link_project_to_repository, find_remote_project) to raise or report errors instead of returning defaults, and distinguishing 'not found' from 'read failed'.
  3. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Linked: #983 and #999. #983's GitHubNotFoundError and GitHubUnreadError are this item's split; #999 keeps provisioning in projects.py, so read fields through the store's fail-closed _read_fields (roadmap/github_store.py:2373), not the builders #999 deletes. Found by the 2026-10-08 backlog review.

  4. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    Amendment (2026-10-18): two more silent project failures, found in #983 PR 3's review

    Both are in base code, not regressions, and they fit this item's "fail closed on a failed read":

    • Field and link provisioning swallow a missing scope as False. With a token that has read:project but not project, _provision_single_field and link_project_to_repository (src/devops_cli/github/projects.py) return False silently. sync_remote_project on an existing board then reports linked=False and fields_provisioned=[] and raises nothing. Only create_remote_project raises, and then as an unclassified GitHubOperationError. After refactor(github): the github session owns transport, ledger, error classes and link pagination #983 PR 3, route their non-zero gh exits through classify_gh_failure, so a missing scope raises GitHubScopeError naming the scope.
    • Project listing hides failures, and an @me fallback caches the wrong owner.
      • _list_projects_via_rest and _list_projects_via_cli (devops gh project list) report any failure as "No GitHub Projects v2 boards found".
      • After a successful @me fallback, _run_project_cli stores _PROJECT_OWNER_ARG_CACHE[org] = "@me". An organisation owner is then answered with the viewer's boards for the rest of the process.
      • A failed listing should raise, and the cache should hold @me only for an owner that is the viewer.
  5. added a commit that references this issue on Oct 26, 2026
    48347c1
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

    scope/githubsource/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions