Skip to content

review(hardening): update_branch has no non-retryable failure class and no per-class metric (workflow-permission cause resolved 2026-07-24) #9498

Description

@JSONbored

Summary

59% of all update_branch failures are a permission error that retrying can never fix, and the engine retries them anyway — up to 9 times on a single PR. The GitHub App cannot push a branch update to any PR that touches .github/workflows/**, but nothing detects this, so every wake re-attempts it.

Production evidence (edge-nl-01, 7 days to 2026-07-27)

agent.action.update_branch: 159 events — 77 completed, 71 error, 11 denied (45% failure rate). The failure breakdown:

Outcome Failure class Count Distinct PRs
error workflow-permission — unfixable by retry 48 14
error merge conflict 17 8
denied head moved (self-race) 6 2
denied PR no longer open 5 5
error no new commits on base 5 1
error GitHub timeout 1 1

The dominant class is:

refusing to allow a GitHub App to create or update workflow '.github/workflows/…'

Worst repeat offenders — attempts against the same PR:

JSONbored/loopover#8499    9
JSONbored/loopover#8497    7
JSONbored/loopover#8400    6
JSONbored/loopover#7736    5
JSONbored/loopover#8030    4

Each attempt is a wasted GitHub API call, an audit row, and a retry cycle, on an operation that is structurally impossible for that PR until its diff stops touching workflow files.

This corrects an earlier characterisation: the 45% failure rate is not primarily the engine racing its own pushes. Self-race accounts for 6 of 82 failures; missing App permission accounts for 48.

Why it matters beyond the waste

Requirements

  1. A rebase that cannot succeed for a structural reason must not be attempted repeatedly.
  2. A PR touching workflow files must still be reviewable — the inability to rebase it must not become an inability to process it.

Deliverables

  • Detect the workflow-permission failure class explicitly and mark it non-retryable for this PR at this diff shape — do not simply catch and continue, or the next wake repeats it.
  • Skip the staleness rebase up front when the PR's changed-file set includes .github/workflows/**. The changed-file list is already fetched (pull_request_files), so this is a cheap pre-check rather than a failed API round trip.
  • Decide the policy for such PRs and make it explicit: proceed to review un-rebased (the likely right answer given branch protection is strict: false, so being behind blocks nothing), or hold with a named reason. Silently retrying forever is the one option that should be off the table.
  • Consider whether the App should hold the workflows permission at all. If it should not, document that so this is understood as intended rather than as a gap.
  • Add a metric on update_branch outcome by failure class, so the next regression here is visible without a database query.

Tests (must fail against current main)

  • A PR whose diff touches .github/workflows/** does not attempt a staleness rebase.
  • A workflow-permission error is recorded once and not re-attempted on the next wake.
  • A merge-conflict failure still surfaces as it does today (it is genuinely informative and should not be swept into the same bucket).

Related

Metadata

Metadata

Assignees

Labels

gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.maintainer-onlyOwner-only work — yields no Gittensor points.orbGittensory Orb related - maintainer self-hosting analytics.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions