Skip to content

cargo-target-janitor: queue helper path is dead (~/hatch/tools/repo-queue.py) — every hourly run refuses cleanup while in-scope targets sit at 275G vs the 150G cap #6812

Closed

Description

@developing-today

Problem

The hourly cargo-target-janitor (infra/cargo-target-janitor) — the only mechanism enforcing the 150 GiB fleet Cargo-target cap — fails every run and has deleted nothing while the laptop disk filled to 100% (#6797 triage, 2026-11-07):

cargo-target-janitor: refusing cleanup: queue helper unavailable: /home/user/hatch/tools/repo-queue.py

(journalctl --user -u cargo-target-janitor.service, runs at 03:08Z / 04:00Z / 05:03Z on 2026-11-07, all exit 2.)

The janitor reads its never-delete claimed set through the retired Python repo-queue helper at ~/hatch/tools/repo-queue.py — a path removed by the fleet-binary migration (code#5362/#5412). Fail-closed is the right behaviour for an unavailable safety source; the defect is that the source path is permanently stale, so the refusal is permanent and silent (its run-record dir ~/.local/state/cargo-target-janitor/runs/ holds no recent runs, and nothing alerts on the repeated service failure).

Measured at triage (2026-11-07 ~05:35Z): in-scope targets ~/git/fleet/*/pkgs/id/target alone sum 274,701 MB vs the 150 GiB cap. Separately, two build-output classes sit outside the janitor's configured scope entirely: ~/git/fleet/queue/*/pkgs/id/target ≈ 82 GiB (one level deeper than its glob) and repo-root ~/git/fleet/*/target ≈ 114 GiB. ~/git/fleet totals 604 GiB across 1,704 entries (352 registered worktrees).

Requested change

  1. Restore a live queue-claims source for the janitor on the current fleet path: read claimed task IDs via the fleet queue binary / broker, and — while the queue backend is down (code#6619) — via the GitHub fallback claim markers, which are the claim of record in fallback mode. Preserve fail-closed semantics when no source is readable. Note cargo-target-janitor(queue_claims): offset pagination over the live claimed set can skip a still-claimed task — it loses never-delete protection #6790 (closed 2026-11-07) fixed offset pagination inside this same read; keep that fix and its tests.
  2. Decide the scope question with the numbers above and implement it: either extend discovery to ~/git/fleet/queue/*/pkgs/id/target and ~/git/fleet/*/target (with the same safety rules), or document in the README why those classes are excluded and name what owns them.
  3. A run record (summary JSONL under ~/.local/state/cargo-target-janitor/runs/) is written on every run, including refusals, so a dead janitor is visible in its own state, not only in the systemd journal.
  4. The existing deletion-safety tests cover the new source path (fixture claim sets, no live queue needed). Wiring those tests into CI is ci(cargo-target-janitor): test_cargo_target_janitor.py (13 tests, deletion-safety rules) run by no workflow — hourly timer runs the deleter, never its tests #5952 — coordinate, don't duplicate.

Acceptance

  • A manual dry-run on the laptop completes and prints candidates + protected targets instead of the queue helper unavailable refusal.
  • The hourly user timer's next run after the fix exits 0 (or reports over_cap with named protected targets) and leaves a run record.
  • Claimed-task, open-PR, and live-process protections behave exactly as before (existing tests pass, extended for the new source).
  • If scope is extended: a dry-run enumerates the queue/ and repo-root target classes with sizes; if not, the README names their owner.

Refs: #6797 (triage), #6790 (closed, same read), #5952 (janitor tests in CI), #3372 (prior disk-full occurrence).

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/queue-workerFiled or worked by the queue/worker pilot
    priority/highImportant and time-sensitive
    area/infraInfrastructure, deployment, and operations
    status/triagedTriaged and routed (see agent note)
    on Nov 7, 2026
  2. developing-today commented on Nov 7, 2026

    @developing-today
    ContributorAuthor

    Picked up by repo-worker-code-d — 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-d posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  3. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 7, 2026
  4. developing-today commented on Nov 7, 2026

    @developing-today
    ContributorAuthor

    Progress from repo-worker-code-d: implementation in progress: worktree ~/git/fleet/fb-6812 (branch queue/fallback-6812-janitor-source) at origin/main 4367bcf. Design: helper source kept when the file exists; new GitHub fallback claims source (fleet queue fallback scan live/contested markers + queue/claimed-labelled issues, protection keyed by issue id for fallback-era branches); discovery extended to fleet/queue/* worktrees and repo-root cargo targets; refusal run records. Next: patch + tests.

  5. developing-today commented on Nov 7, 2026

    @developing-today
    ContributorAuthor

    Progress from repo-worker-code-d: targeted_tests_passed: janitor suite 29/29 on laptop (21 pre-existing + 8 new #6812 tests). Next: real dry-run against ~/git/fleet with the fallback claims source, README update, then PR.

  6. developing-today commented on Nov 7, 2026

    @developing-today
    ContributorAuthor

    Progress from repo-worker-code-d: pr_opened: PR #6820 (head e7fd286). Tests 31/31 + two real dry-runs verified (448 GiB enumerated, fallback source). Next: Codex gate, merge, install refreshed binary to ~/.local/bin, release.

  7. added a commit that references this issue on Nov 7, 2026
  8. developing-today commented on Nov 7, 2026

    @developing-today
    ContributorAuthor

    Released by repo-worker-code-d (outcome: done). DONE: PR #6820 merged e380645 (= main HEAD); issue closed. Janitor fixed: claims source falls back to GitHub fallback claims when the retired repo-queue helper is absent (helper stays first choice), scope extended to fleet/queue/* and repo-root targets incl. scratch dirs (448 GiB / 94 targets enumerated), refusals now write run records. Tests 31/31; two real dry-runs clean (nothing deleted); refreshed binary installed to ~/.local/bin so the hourly timer uses it. Follow-up #6813 (fleet-monitor disk-headroom alert) remains queued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/infraInfrastructure, deployment, and operationskind/bugSomething isn't working (prefixed form of the classic bug label)priority/highImportant and time-sensitivesource/queue-workerFiled or worked by the queue/worker pilotstatus/triagedTriaged and routed (see agent note)task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions