Repository navigation
Description
github-backup(clone_all+manifest): a wrong-shape reference/branch field passes validate_plan and crashes both consumers — the #6637 gate checks only repo
Evidence
Verified on the laptop at origin/main e380645a3b7c94e47dabda544564d7fd89c75416. ghb_common.validate_plan (infra/github-backup/bin/ghb_common.py:149-165, the #6637 gate every plan consumer now shares via load_plan) validates exactly one field: an entry is kept iff it is a dict with a string repo. The other plan fields consumers actually compute with — reference and branch — pass through at any JSON shape.
Consumers that break on those fields:
infra/github-backup/bin/clone_all.py:202-214— the main-thread scheduler doesstate.get(ref)(and laterstate.get(ref) == "ok") onp.get("reference"). A list or dictreferenceis unhashable:TypeError: cannot use 'list' as a dict key. The crash is in the scheduling loop, not in a worker thread, so the whole clone run dies: remaining pending repos are never submitted, in-flight results are never recorded toclone-status.jsonl, and noDONEsummary prints.infra/github-backup/bin/clone_all.py:147-149—mirror_path(root, ref)would also fail on a non-string reference (ref + ".git"), but the scheduler crash fires first.infra/github-backup/bin/manifest.py:58—families.setdefault(item["reference"], [])raises the same unhashableTypeErrorfor a list/dict reference;MANIFEST.jsonandFAMILIES.mdare never rewritten.infra/github-backup/bin/manifest.py:81—sorted(families): a numeric reference alongside string references raisesTypeError: '<' not supported between instances of 'str' and 'int'; a lone numeric reference silently writes## anchor: 123into FAMILIES.md.infra/github-backup/bin/manifest.py:15-16,50—head_sha(path, item.get("branch"))builds"refs/heads/" + branch; a non-string branch (int, list) on a repo whose mirror is present raisesTypeError: can only concatenate str (not "int") to str.
Probe (laptop, ~/git/fleet/probe-ghb-reference-shape/probe.py + probe2.py, real ghb_common / clone_all / manifest modules from origin/main, temp roots, controls included):
validate_plan([{repo, reference: [..]}, {repo, reference: {..}}, {repo, reference: "o/anchor"}])→ kept=3, problems=[] — the gate is blind to the field shape.clone_all.mainwithreference: ["o/anchor"]→TypeError: cannot use 'list' as a dict key (unhashable type: 'list'); withreference: {"x": 1}→ same for dict. String and null reference controls complete the run normally.manifest.buildwith list/dict reference → same unhashableTypeError, no manifest written; string control →OK totals={'mirrored': 0, 'missing': 1, 'disk_kb': 0}.manifest.buildwith references123+"o/anchor"in one plan →TypeError: '<' not supported between instances of 'str' and 'int'at thesorted(families)pass.manifest.buildwith a present bare mirror andbranch: 123/branch: ["main"]→TypeError: can only concatenate str (not "int") to str;branch: "main"control → OK, mirrored=1.
Why it matters
plan.json is the shared input to the clone driver and the manifest regenerator, and it is exactly the file class the estate keeps poisoning itself with (hand edits, older/newer writers, torn writes per #3240). #6637 hardened the entry level and #6821 the last_fetch field of state entries, but the plan's own field level was never validated: one wrong-shape reference wedges the resumable clone driver for every repo (not just the poisoned one) and separately wedges MANIFEST regeneration — the disaster-recovery source of record — on every subsequent run until someone hand-edits the JSON. A numeric reference is worse in one way: it does not crash clone_all at all (it is silently ignored there), so the corruption is invisible until manifest's mixed-type sort or a bogus FAMILIES.md anchor surfaces it.
Distinct from: #6637 (plan entry-level shape + state fail_days/drain_*), #6821 (state last_fetch field, fetch consumer), #6653 (manifest entry-level, fixed via load_plan), #6831 (reconcile reading the previous plan bypassing validate_plan), #6822/#6814 (other repos' seed/artifact field shapes). None validates the plan reference/branch fields.
Acceptance criteria
validate_planvalidates the consumed plan fields:referenceandbranch(andparent, copied into the manifest) must be strings or null/absent; a wrong-shape field produces a named problem viareport_problemsand is neutralized (field dropped to None, or the entry skipped with the entry named — either contract is acceptable if explicit and tested), never passed through to a consumer.- With such a plan file,
clone_all.maincompletes its scheduling loop (poisoned entries/repos are reported, other repos still clone or fail on their own merits,DONEprints) andmanifest.buildstill writesMANIFEST.json+FAMILIES.md. - A numeric
referencecan no longer produce a bogus## anchor: 123family or a mixed-type sort crash. - Regression tests in
infra/github-backup/tests/(extendingtest_plan_state_shape.pyand the manifest/clone tests) cover list/dict/intreference, int/listbranchwith a present mirror, and the string/null controls; the existing github-backup suite stays green.
Activity
developing-today commentedon Nov 7, 2026
CODE-2105
dezren39 commentedon Nov 7, 2026
🤖 Agent note · filed
repofield; a list/dictreferencecrashes clone_all's main-thread scheduler (clone_all.py:205, unhashable dict key) and manifest's families grouping (manifest.py:58), a numeric reference crashes manifest's sorted(families) when mixed with strings, and a non-stringbranchcrashes head_sha (manifest.py:16) for present mirrors. Verified with the real modules from origin/main e380645 on the laptop (probe ~/git/fleet/probe-ghb-reference-shape).dezren39 commentedon Nov 8, 2026
🤖 Agent note · picked up
dezren39 commentedon Nov 8, 2026
🤖 Agent note · parked
dezren39 commentedon Nov 8, 2026
Picked up the resumed queue task 11053 for #6834 to recheck PR #7004 after its CI wait. Fresh state remains OPEN with no hard-stop labels; the required checks are still queued.\n\n
dezren39 commentedon Nov 8, 2026
🤖 Agent note · parked for CI\n- Agent: repo-worker-code, OpenChamber scheduled lane 262eb403-3347-4a7c-ba6b-e7bc263ca853\n- Task: 11053 for #6834; PR #7004 remains OPEN.\n- Checks: basic: proxy port fallbacks and scripts-test on Python 3.12/3.14 are still queued after more than 27 minutes; CodeRabbit skipped, no reviews found.\n- Resume: recheck after 20 minutes; this lane holds no claim while CI runs.\n
developing-today commentedon Nov 8, 2026
🤖 Agent note · done
ghb_common.py+ the two test files, Codex review completed with no findings, and the fullinfra/github-backup/tests/suite re-run on the laptop at PR head ea0f944: all test files pass (test_plan_state_shape.py: ALL 47 CHECKS PASSED;test_clone_all_references.py: all cases OK).