fix(autopilot): mirror-sync could never report failure, and mirroring was dead #5482
gluecron[bot]🤖 botAI Reviewcommented 21d ago
AI review unavailable
The platform's AI balance is exhausted, so AI generation is temporarily unavailable. Nothing was lost. You can queue this as a repair for the internal agent from the repository's Health page, or try again once the balance is restored. The PR is otherwise unchanged.
ccantynzAI Reviewcommented 21d ago
AI Triage
(no summary)
Priority: medium Risk area: mixed
Suggested labels: (no label suggestions) Suggested reviewers: (no reviewer suggestions)
Suggestions only — nothing has been applied. The PR author stays in control.
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
What was actually happening
GitHub→Gluecron mirroring had stopped across the whole estate, and nothing said so:
Every autopilot tick logged
mirror-sync ok. The public/statuspage read "All systems operational". Found on 2026-08-11 only by comparinggit ls-remotebetween the two hosts by hand.Why it was invisible — three layers, each converting failure into silence
1. The task discarded the result.
{ name: "mirror-sync", run: async () => { await syncAllDue(); } }syncAllDue()returns{total, ok, failed}and resolves normally no matter what —runMirrorSyncrecords a failed run and, by its own comment, "never throws out". So the counts were thrown away and the task reported ok because nothing threw.This is the same defect this file's header already documents for the 23 catch-without-rethrow tasks — in a different shape. Those swallowed a throw; this discarded a result. That's precisely why the rethrow fix applied to those could not catch this one.
2.
listDueMirrors()ended incatch { return [] }. An unreadable mirror table produced{total: 0}— indistinguishable from "nothing due" to every caller.3.
total === 0was silent. A wiped or never-created mirror table looked exactly like a host that legitimately has no mirrors.The change
mirror-synclogstotal/ok/failedevery tick and throws whenfailed > 0— including partial failures, because a partial failure is still mirroring that did not happen, and that is how one repo drifts unnoticed.listDueMirrors()logs and rethrows instead of disguising a DB error as nothing-due. Only caller issyncAllDue, reached from this task, which now surfaces it as a failed tick.total === 0resolves (legitimate on a host with no mirrors) but warns every tick, so "nothing to do" can never again read as "everything is mirrored".Verification
The regression test exercises the real task from
defaultTasks(), not a description of it.tsc --noEmitclean · sibling autopilot tests 22 passStill outstanding after this merges
This fixes the reporting, which is what let it run dead for weeks. It does not by itself restore mirroring — the six repos were fast-forwarded manually on 2026-08-11, and whether enabled
repo_mirrorsrows exist for them is unverified. Once this is deployed the next tick will say so out loud: eitherfailed > 0, or theNO mirrorswarning.That is the point — it can no longer be quiet about it.
Found during the fleet dead-surface sweep. Context:
FINDINGS.md(F27) inccantynz/platform-contracts.🤖 Generated with Claude Code