Repository navigation
Description
Finding
The auto-format workflow decides "treefmt changed something" with a whole-worktree check but stages only the files it passed to the formatter. treefmt's rustfmt invocation can change files that were never in that list — rustfmt formats a file's out-of-line mod children along with it — so a companion change is either stranded or breaks the run:
.github/workflows/auto-format.ymlon current main (0467ae0f9887): line 111 runsnix run .#format -- "${format_files[@]}", line 112 checksgit diff --quiet(whole worktree), line 119 stages withgit add -- "${format_files[@]}"and line 120 commits unconditionally.- If the listed files were already formatted but a companion changed, nothing is staged and
git commitexits 1 ("no changes added to commit"); underset -euo pipefailthe step fails, nothing is pushed, andrecord_successnever runs — so every later 15-minute run re-diffs the same range and fails the same way until the range moves on. - If some listed file did change, the commit succeeds and the companion change is silently discarded with the runner: the unformatted child stays on main.
PR #3198 introduced the restricted staging (it replaced git add -A to keep workflow files out of the bot's push, #3118). The later PAT rework (PR #4797, commit df09437) removed the workflow-file exclusion — format_files is now all changed files and the header comment says nothing is excluded from the write pass — but kept the restricted git add, so the companion gap survived. CodeRabbit flagged exactly this on PR #3198 (Minor / potential_issue, #3198 (comment)); it was never addressed or replied to, and the PR merged as-is (2026-11-02).
Evidence
- PR: fix(ci): prevent workflow format diffs from blocking auto-format push (#3118) #3198 — MERGED, head
1cc7de210e; the hunk replacedgit add -Awithgit add -- "${format_files[@]}"whilegit diff --quietstayed whole-worktree. - Current main
0467ae0f98876cef0dfffe9fc75d61c68aeacd67:.github/workflows/auto-format.yml:111-120as quoted above;treefmt.tomlconfigures rustfmt as plainrustfmt --edition 2024with noskip_children/--skip-children. - Verified on the laptop (2026-11-03, rustfmt 1.9.0): a formatted
parent.rsdeclaringmod child;plus an unformattedchild.rs— runningrustfmt --edition 2024 parent.rs(only the parent passed, treefmt's exact invocation shape) reformatschild.rs. Replaying the workflow's git sequence on that tree:git diff --quietreports dirty,git add -- parent.rsstages nothing,git commitexits 1 with "no changes added to commit". - Dedupe: issue searches for the auto-format staging / companion-file problem (titles and bodies, all states, 2026-11-03) return no covering issue. fix(ci): auto-format push is rejected when the format diff touches workflow files (PR #2148) #3118/fix(ci): prevent workflow format diffs from blocking auto-format push (#3118) #3198 are the closed workflow-push problem; open auto-format: scheduled runs not firing since the 15-minute redesign; record_success can never work with GITHUB_TOKEN (no variables permission scope) — laptop sync installed as the mechanism #4787 is about scheduled runs not firing and the record_success token scope — a different failure.
Why it matters
The auto-format bot is the fleet's formatting safety net: it runs every 15 minutes and keeps main formatted without gating merges. This gap makes it fail loudly and repeatedly for an entire diff range whenever a merged PR leaves an unformatted module child next to a formatted parent (formatting never gates a merge, so drift on main is expected), and in the mixed case it silently throws away formatting it already computed. Either way the bot stops doing the one job it exists for, with no issue on file.
Acceptance criteria
- The write pass stages every tracked change treefmt actually made (or equivalently decides "nothing to commit" from the staged diff, not the worktree diff), so a companion-file change can neither fail the commit with "no changes added to commit" nor be silently discarded.
- Workflow files remain pushable under the current REPO_AUTOMATION_TOKEN PAT arrangement (the fix(ci): auto-format push is rejected when the format diff touches workflow files (PR #2148) #3118 regression does not return in another form).
- A regression test in
scripts/tests/test_auto_format_workflow.py, executing the workflow's real run block like the existing tests, covers the companion case: a listed file already formatted whose formatter run changes an unlisted tracked file — the run exits 0 and the companion change is in the pushed commit. - The existing auto-format workflow tests still pass.
Activity
dezren39 commentedon Nov 3, 2026
🤖 Agent note · filed
git diff --quietstays whole-worktree; rustfmt reformats out-of-linemodchildren of a listed .rs file (verified on the laptop with treefmt's exact invocation), so a companion-only change failsgit commitwith "no changes added to commit" (and wedges every later run on the same range) or is silently discarded. Still live on main 0467ae0 at .github/workflows/auto-format.yml:112/119.developing-today commentedon Nov 3, 2026
agent-note:v1
state: reviewed (coverage loop-back)
Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 8492 (triage, queued, priority 50) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
Found via: coverage loop-back 2026-11-03
5 remaining items
dezren39 commentedon Nov 4, 2026
🤖 Agent note · picked up
Revalidated fresh: issue #5014 OPEN, no hard-stop labels, no open PR covers it, no existing queue/9028 branch. Proceeding on the laptop worktree.
fix(ci): auto-format stages every tracked treefmt change (#5014)
Merge pull request #5304 from developing-today/queue/9028-5014-auto-f…
dezren39 commentedon Nov 4, 2026
🤖 Agent note · done (fixed & merged)
Done: PR #5304 merged (merge commit 0dab47d); this issue auto-closed by the merge.
git add -u) and decides "nothing to commit" from the staged diff, so companion changes (rustfmt mod children) can neither fail the commit nor be silently dropped.scripts/tests/test_auto_format_workflow.py5/5 pass on the laptop worktree, including the new companion-case regression test (fails rc=1 on the unmodified workflow). Note: all 4 pre-existing tests failed on clean main before this PR (REPO_AUTOMATION_TOKEN: unbound variablein the stub env) — harness fixed; two tests updated from the superseded GITHUB_TOKEN workflow-skip expectations to the PAT arrangement (fix(ci): auto-format push is rejected when the format diff touches workflow files (PR #2148) #3118).