GeezerVison is showing github.com — github-backup(reconcile): a non-dict JSON line in clone-status.jsonl crashes the failed-clone report path — _clone_status_entries tolerates unparseable lines but not valid non-dict ones · Issue #6606 · developing-today/code
github-backup(reconcile): a non-dict JSON line in clone-status.jsonl crashes the failed-clone report path — _clone_status_entries tolerates unparseable lines but not valid non-dict ones #6606DescriptionProblem
infra/github-backup/bin/reconcile.py — a non-dict JSON line in clone-status.jsonl crashes the weekly reconcile on exactly the run it is most needed: a failed clone pass.
-
_clone_status_entries (reconcile.py:52-66) tolerates a line that does not parse as JSON at all (except Exception: pass, line 62-63) but appends every line that does parse, with no shape check.
-
Its only consumer (reconcile.py:147-152, in the clone_rc != 0 branch) assumes dicts:
clone_failures = sorted(
{e["repo"] for e in _clone_status_entries(root, status_offset)
if e.get("status") == "fail" and e.get("repo")}
)
A line containing 123, "fail", ["owner/bad"], null, or true — all valid JSON, all plausible products of a torn/interleaved append to this shared append-only file, a hand edit, or a future writer change — raises AttributeError: '<type>' object has no attribute 'get'.
-
The crash site is before everything the failed-clone branch exists to produce: the dated report reconcile-YYYY-MM-DD.md is written at reconcile.py:~185 and manifest_mod.build(root) runs at :~192, both after the clone-failure computation. So one poison line converts "clone pass failed, here is the report naming the failed repos" (the github-backup(reconcile): a failed clone pass exits 0 and is absent from the dated report — clone_all's verdict is dropped by its only scheduled caller #3300 contract) into an unhandled traceback with no report, no MANIFEST refresh, and no per-repo failure list — on the one run where the clone pass already failed.
Contrast / oracle in the same estate: clone_all.py:93-100 reads the same file and is safe — its r.get("status") call sits inside the try: whose except Exception: pass swallows the shape error along with parse errors. The two readers of one file disagree about what a line may be; reconcile's is the fragile one.
Distinct from: #6575 (drain_queue queue-event shape poison — different file, different consumer), #3331 (drain owner allowlist shape, closed), #3240 (plan.json/state.json/MANIFEST.json bare json.load on torn object files — clone-status.jsonl is not in its writer/reader list, and its readers already claim per-line tolerance).
Evidence (verified this run, laptop primary @ afdad96)
Probe on the laptop at ~/git/fleet/probe-ghb-reconcile-status/probe.py, importing the real reconcile module from ~/git/code/infra/github-backup/bin and feeding _clone_status_entries a scratch clone-status.jsonl, then applying main's exact consumer expression:
- control, dict entries
[{"repo":"owner/bad","status":"fail"}, {"repo":"owner/good","status":"ok"}] → consumer Ok, failures ['owner/bad']
- control, malformed JSON line
"{torn line" before a fail dict → skipped as designed, consumer Ok, failures ['owner/bad']
- offset control (entries appended after the recorded byte offset only) → Ok
- non-dict
123 → consumer_CRASH AttributeError: 'int' object has no attribute 'get'
- non-dict
"fail" → consumer_CRASH AttributeError: 'str' object has no attribute 'get'
- non-dict
["owner/bad"] → consumer_CRASH AttributeError: 'list' object has no attribute 'get'
- non-dict
null → consumer_CRASH AttributeError: 'NoneType' object has no attribute 'get'
- non-dict
true → consumer_CRASH AttributeError: 'bool' object has no attribute 'get'
Why it matters
Reconcile is the weekly correctness floor of the backup estate. Its clone-failure path (#3300) was specifically built so a failed clone pass is reported, named, and exit-coded. A single non-dict line in the shared status file defeats that path entirely and takes the dated report and the MANIFEST rebuild with it — the failure mode is silent in the place operators look (no report file appears) and the poison line stays in the append-only file, so the next failed-clone reconcile crashes the same way.
Acceptance criteria
-
_clone_status_entries (or its consumer) ignores non-dict JSON lines the way it already ignores unparseable lines — a parsed line is kept only if it is a dict; dicts missing repo/status keep the current filtered behaviour.
- A failed clone pass with a poisoned
clone-status.jsonl still produces the dated report (with the real dict fail entries named, or the existing "no per-repo failures recorded" fallback), still runs manifest_mod.build, and still returns exit 1 — no traceback.
- Regression test: scratch status file mixing a valid fail dict, an unparseable line, and each non-dict JSON shape (
123, "x", [], null, true) → consumer returns exactly the valid fail repos; dict-only and malformed-line controls unchanged.
- The two readers of
clone-status.jsonl (clone_all and reconcile) end up with the same line-shape contract, stated in one place.
Activitydeveloping-today commented on Nov 6, 2026 dezren39 commented on Nov 6, 2026 dezren39 commented on Nov 7, 2026
Picked up by repo-worker-code-a — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-a posts progress markers; after 30 minutes of silence any other worker may pick this up.) dezren39 commented on Nov 7, 2026
Released done by repo-worker-code-z (lane code-z, FALLBACK MODE): PR #6715 merged — merge commit 348f900 — and issue #6606 closed by the merge. Fix: ghb_common.clone_status_record states/implements the clone-status.jsonl line contract in one place (record = JSON object; unparseable and valid-JSON non-object lines ignored) and both readers use it (reconcile._clone_status_entries, clone_all ok_prev scan); both consumers also require a string repo (Codex P2, fixed in a048db9, replied on-thread; final Codex review on that head: completed, no findings). Tests on laptop: full github-backup suite green at e7edf56 (clone-pass 14/14 incl. poisoned-file scenario through reconcile.main()); clone-pass + clone_all suites re-run green at a048db9. scripts-test checks QUEUED in the fleet-wide runner backlog — merged under standing merge authority with local suite verification.
🤖 Agent note · done
dezren39 commented on Nov 9, 2026
🤖 Agent note · done (already done)
- Agent: repo queue worker, lane code-g (repo-worker-code)
- Session / ID: cron repo-queue-worker-shift-g run 2026-11-09 02:23 CST; task 13708 (direct execution lane, lane row 5545)
- Task: task 13708 for issue github-backup(reconcile): a non-dict JSON line in clone-status.jsonl crashes the failed-clone report path — _clone_status_entries tolerates unparseable lines but not valid non-dict ones #6606 (small_fix: non-dict JSON line in clone-status.jsonl crashes reconcile failed-clone report path).
- Verified fresh 2026-11-09T08:47Z: the fix already landed on main via PR fix(github-backup/reconcile): ignore non-dict clone-status lines via shared reader contract (#6606) #6715, MERGED 2026-11-07T03:15:18Z, squash commit 348f900 — ghb_common.clone_status_record is the shared line-shape contract for both readers (reconcile + clone_all), non-dict and unparseable lines are ignored, and the consumer requires a string repo. Issue github-backup(reconcile): a non-dict JSON line in clone-status.jsonl crashes the failed-clone report path — _clone_status_entries tolerates unparseable lines but not valid non-dict ones #6606 was closed at that merge and reopened by developing-today[bot] on 2026-11-08T07:01:52Z with no new failure evidence.
- Tests: on a clean detached worktree at origin/main (1a5d3ad), infra/github-backup/tests/test_reconcile_clone_pass.py passes 14/14, including: poisoned status file -> reconcile still exits 1, report still names the real failing repo, poison shapes never surface as repos, reader keeps only dict records, consumer returns exactly the valid fail repos.
- Outcome: no new code needed. Closing issue github-backup(reconcile): a non-dict JSON line in clone-status.jsonl crashes the failed-clone report path — _clone_status_entries tolerates unparseable lines but not valid non-dict ones #6606 as completed with this evidence; completing task 13708 as already_done.
- Links: task 13708 · issue github-backup(reconcile): a non-dict JSON line in clone-status.jsonl crashes the failed-clone report path — _clone_status_entries tolerates unparseable lines but not valid non-dict ones #6606 · PR fix(github-backup/reconcile): ignore non-dict clone-status lines via shared reader contract (#6606) #6715
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|