Skip to content

fix(labels): fall back when GitHub omits per-file patches #5583

Open

Description

@purp

User Story

As an OpenShell maintainer running the label migration in #5151, I encountered eligible PRs that /label-issue could not classify because GitHub omitted per-file patches. I need the helper to recover available evidence while preserving its completeness and freshness checks.

Problem Statement

GitHub's pull-request files endpoint can return a changed file and its addition/deletion counts without a patch field. The labeling helper correctly marks that evidence partial, but has no fallback even when GitHub's raw PR diff contains the missing patch.

Observed during migration:

PR Missing file patch Changed lines Patch in raw diff
#2168 crates/openshell-server/src/grpc/policy.rs 827 additions / 1,073 deletions 109,400 bytes
#3012 sdk/go/proto/openshellv1/openshell.pb.go 1,516 additions / 1,378 deletions 403,081 bytes

GitHub does not explain these omissions. Large diffs are a plausible cause, but the exact trigger is unconfirmed.

Both recovered file patches pass the helper's existing _patch_coverage validation for changed-line counts and hunk completeness in an offline check. No fallback has been implemented or used to change labels.

Impact / Why This Matters

Both PRs remain held with Source coverage/digest/byte count is unresolved or incomplete; neither received migration label changes. Retrying classification does not supply the missing evidence. The rest of the migration can proceed, but these items need a reliable recovery path rather than a completeness-check bypass.

Proposed Design

Keep the existing /label-issue workflow. When a per-file patch is omitted or incomplete, attempt a supported alternative evidence source. GitHub's raw-diff endpoint is a demonstrated candidate. Bind recovered content to the prepared revisions and file identity, validate completeness, and retain evidence provenance. If recovery fails, retain the held/prerequisite result and diagnostics.

Acceptance Criteria

  • Recover omitted/incomplete per-file patches when a complete alternative is available, including both reproductions above or equivalent fixtures.
  • Validate recovered patch identity, completeness and revision binding; record source digests, byte counts and provenance.
  • Preserve existing acceptance, lifecycle, freshness, checkpoint and exact-preview protections.
  • Failed, mismatched, truncated or unavailable fallback evidence stays held; no label writes occur on incomplete evidence.
  • Cover successful recovery and failure paths with offline tests and document the fallback in the labeling workflow.

Reproduction Steps

  1. Prepare /label-issue evidence for feat(policy): add managed maximum permission modes #2168 or feat(api)!: model CPU and memory as typed compute resource requirements #3012 at the revisions below.
  2. Inspect the relevant entry from GET /repos/NVIDIA/OpenShell/pulls/{number}/files: change counts are present and patch is absent.
  3. Preview a classification. The checkpoint/evidence checks reject incomplete source coverage.
  4. Request GET /repos/NVIDIA/OpenShell/pulls/{number} with Accept: application/vnd.github.diff. The omitted file patch is present in that response.

Environment

Alternatives Considered

  • Retry the same file endpoint: omissions persisted.
  • Ignore the missing patch or mark partial evidence complete: rejected because this weakens correctness and checkpoint guarantees.
  • Fetch pinned base/head files and reconstruct the diff: another possible fallback where raw diff retrieval is unavailable.

Relates to #5151 and #5276. This issue records follow-up work; leave the two affected PRs held until recovery is implemented and verified.

Additional migration reproductions

The remaining migration pass also found incomplete patch evidence in these prepared snapshots. Unlike the two original reproductions, alternative-source recovery has not been verified for these cases.

PR Prepared head Partial file evidence
#4230 e87e5c442f96f312c127bb167f2dc93ff7134eac sdk/go/proto/openshellv1/openshell.pb.go
#4629 673928804d5156c4049ab8cf940ca992dd072b19 tests/suites/conformance/Cargo.lock
#4858 0d96b7770e7ef5b4349400cc64142f60407054b7 sdk/go/proto/openshellv1/openshell.pb.go
#5006 e9f4a4269c8350f52ed827eb5d3588a20b25436d 13 file patches, including crates/openshell-policy-cedar/src/analysis.rs
#5121 eb7552dd7f5e5c8c79abf9563311609232a5f43d sdk/go/proto/openshellv1/openshell.pb.go
#5214 11030e5d46b8098bb7def4763caad7e19330fd45 crates/openshell-supervisor-network/src/l7/relay.rs
#5405 ba67e8c8a1bd9828d84be79d53e8def115a7de6f 14 file patches, including crates/openshell-container-runtime/src/local_api_socket.rs

Two larger PRs have compound blockers: #4565 has 73 partial file patches, and #5289 has 254. Their frozen classification inputs also exceeded the model context limit. Recovering missing patches alone will not resolve their input-budget failure; evidence selection/budgeting needs separate handling under #5276. No migration labels were written to these held PRs.

Activity

  1. added
    area:buildCI/CD workflows, releases, build targets, packaging, and artifact publication.
    topic:dxMaking OpenShell easy to contribute to for humans and agents.
    on Nov 15, 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

    area:buildCI/CD workflows, releases, build targets, packaging, and artifact publication.topic:dxMaking OpenShell easy to contribute to for humans and agents.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions