Skip to content

2026-11-07: GitHub push mirror run failed after GitHub answered one push with a 500

Kind: reference (incident report)

Severity: warning · Status: resolved · Resolved by: operator agent · Duration: 0:03 from detection to resolution, 00:15:33–00:18:35 UTC (fault from 23:45:51 on 11-06) · Taskbase task: #2649

Summary

At 23:45:51 on 2026-11-06, GitHub answered one push of Gitea's push mirror with Internal Server Error. The mirror got a last_error. The push mirror CronJob's 00:00 run, gitea/github-push-mirror-29900160, recreated the mirror and pushed again, and that push worked. The run still exited 1, because it had found a failed push, so the Job failed and KubeJobFailed fired. The 00:15 run found the mirror healthy, and the operator deleted the failed Job.

Impact

  • Services: one run of the push mirror reconciler (components/gitea/push-mirror) failed. The GitHub bootstrap repository, Flux's fallback source, missed one branch push for about 14 minutes (23:45:51 to the re-push at 00:00:06). That branch was ops/2643-worker-1-stall-source-controller, not main. Flux's bootstrap-cluster GitRepository, which reads main from GitHub, was at main@sha1:84ede6da, the same commit as Gitea main.
  • Users: none noticed; the alert is a warning.
  • Data: none.
  • Duration: the Job failed at 00:00:09. KubeJobFailed fired from 00:15:33 and was resolved at 00:18:35, when Prometheus had no kube_job_failed series for the Job and Alertmanager had no KubeJobFailed alert.

Timeline

All times UTC.

Time Event Source
11-06 23:45:02 The 23:45 run lists the push mirrors (200 OK) and finds the mirror healthy Gitea log
11-06 23:45:51 Gitea's sync-on-commit push of ops/2643-worker-1-stall-source-controller fails: PushRejected Error: … remote: Internal Server Error … ! [remote rejected] … (Internal Server Error), GitHub request ID 9C58:32CD7A:1600A64:1F90CB8:6AEE66AD Gitea log (mirror_push.go:106)
00:00:00 CronJob creates github-push-mirror-29900160 Job creationTimestamp
00:00:03 The run lists the mirrors, deletes remote_mirror_fqLaCUELYi (204), and creates a new mirror (200) Gitea log, pod log
00:00:06 POST /push_mirrors-sync answers 200 OK after 3.3 s; the re-push works Gitea log
00:00:07 Pod exits 1: "created push mirror … and triggered a push", with a failed push found pod log, containerStatuses
00:00:09 Job fails: BackoffLimitExceeded (backoffLimit: 0) Job status.conditions
00:15:05 Next run github-push-mirror-29900175 succeeds: "push mirror … is healthy, last update 2026-11-07T00:08:17Z" CronJob lastSuccessfulTime, pod log
00:15:33 Detected: KubeJobFailed (job_name=github-push-mirror-29900160, fingerprint 0f61a973a4db6f2f) starts firing Alertmanager
00:16:34 Taskbase incident #2649 created Taskbase
~00:17 operator agent confirms the alert is active and not silenced, and finds the cause What the agent did
00:18:24 Operator deletes the failed Job kubectl delete job
00:18:35 Resolved: no kube_job_failed series for the Job, and Alertmanager has no KubeJobFailed alert Prometheus and Alertmanager API

Root cause

The trigger was outside the platform. GitHub answered one push with remote: Internal Server Error and rejected the ref. The repository, the token and branch protection were not the cause: the same mirror, with the same token, pushed again 14 minutes later without error, and the 00:15 run found no last_error.

The mechanism that turned that one error into an incident is in the reconciler, components/gitea/push-mirror/reconcile-push-mirror.py. When a mirror has a last_error, main() deletes and recreates the mirror and triggers a push. It then returns 1 if failed else 0, so the run fails because it found a failed push, even when its own re-push worked. That exit code is on purpose, so that GiteaPushMirrorFailing can see a push that keeps failing. That alert fires only after 50 minutes without success. But the CronJob runs with backoffLimit: 0 and keeps failed Jobs (failedJobsHistoryLimit: 3, ttlSecondsAfterFinished: 86400), and the generic KubeJobFailed is an incident by ADR 0018. So one transient error on one push raises an incident that, left alone, lasts up to 24 hours.

This is the third KubeJobFailed incident from this CronJob, after the backup gate stop (#1591) and the 401 during a database outage (#2507). Both of those fixes kept the reconciler from failing on a Gitea-side window. #2650 does the same here: the run checks the result of its own re-push and fails only when that re-push fails too.

What the agent did

The agent followed the ops runbook section KubeJobFailed for a Job that Flux applies, case CronJob-created Jobs, "a one-off window that is already over".

  1. kubectl -n monitoring port-forward svc/alertmanager-operated 19093:9093, then curl -sG .../api/v2/alerts --data-urlencode 'filter=alertname="KubeJobFailed"': one alert, active, for gitea/github-push-mirror-29900160, with empty silencedBy and inhibitedBy. /api/v2/silences had no active silence.
  2. kubectl -n gitea get cronjob,job -o wide and get pods: the Job is Failed 0/1, and the 00:15 run github-push-mirror-29900175 is Complete 1/1.
  3. kubectl -n gitea get job github-push-mirror-29900160 -o jsonpath=... and kubectl -n gitea logs github-push-mirror-29900160-hv2mc: BackoffLimitExceeded at 00:00:09, and exit code 1 at 00:00:07. The log shows the mirror's last error from GitHub (Internal Server Error, [remote rejected]), then "created push mirror … and triggered a push".
  4. Read components/gitea/push-mirror/reconcile-push-mirror.py and cron-job.yaml: the run exits 1 whenever it found a failed push, and the Job has backoffLimit: 0.
  5. kubectl -n gitea get cronjob github-push-mirror -o jsonpath='{.status}': lastSuccessfulTime 00:15:05, later than the failure, so the runbook allows deleting the Job. The 00:15 run's log reports the mirror healthy, last update 00:08:17.
  6. kubectl -n gitea logs deploy/gitea --since=50m, filtered for the mirror: one push error at 23:45:51, then at 00:00:03–06 the run's DELETE, POST /push_mirrors and POST /push_mirrors-sync, all successful.
  7. flux get kustomizations -A --status-selector ready=false and the same for HelmReleases listed nothing. flux get sources git -A: bootstrap-cluster (GitHub) and gitea-platform are both at main@sha1:84ede6da, the same as git ls-remote origin refs/heads/main.
  8. Write: kubectl -n gitea delete job github-push-mirror-29900160 at 00:18:24. Exit 0. The Job and its Error pod are gone. The Job mounted only its script ConfigMap, so it held no data.
  9. Polled Prometheus (kube_job_failed{namespace="gitea",job_name="github-push-mirror-29900160"} > 0) and Alertmanager: no series and no KubeJobFailed alert at 00:18:35.
  10. Created follow-ups #2650 and #2651, and opened this report's pull request.

No Git change was needed to fix the cause. No Kustomization or HelmRelease was suspended or reconciled, and no silence was set.

Resolution and verification

  • Alertmanager: /api/v2/alerts?filter=alertname="KubeJobFailed" returns [].
  • Prometheus: kube_job_failed{namespace="gitea",job_name="github-push-mirror-29900160"} > 0 returns no series.
  • kubectl -n gitea get job,pod: only the 00:15 run github-push-mirror-29900175, Complete 1/1.
  • flux get kustomizations -A --status-selector ready=false and flux get helmreleases -A --status-selector ready=false list nothing.
  • helm -n gitea history gitea: revision 8 is deployed, chart gitea-12.7.0. https://gitea.prod.skatzi.com/api/healthz returns 200.

Follow-ups

  • 2650 — after recreating the mirror, the reconciler checks its own re-push and exits 0 when the push

    worked. A re-push that fails, for example on an expired token, still fails the run.
  • 2651 — runbooks: tell a GitHub Internal Server Error apart from a branch protection rejection on the

    GiteaPushMirrorFailing page, whose "rejected" bullet points at branch protection. Also name a transient external error as a one-off cause in the ops runbook's CronJob-created Jobs.

References

Open questions

  • Why GitHub answered 500: the agent could not check GitHub's status history for 23:45 UTC. The request ID above is what GitHub support would need.
  • The agent could not read the GitHub repository directly (it is private, and the runner has no GitHub credentials), so ops/2643-worker-1-stall-source-controller on GitHub was not compared ref by ref. The record that the re-push worked is Gitea's: no last_error on the recreated mirror at 00:15.