Skip to content

fix: documentation.yml passes --files to meta.agent.js, which never parses it, so every push rewrites the whole repo #3602

Closed

Description

@eleshar

Problem

.github/workflows/documentation.yml passes --files "$README_FILES" to meta.agent.js in two steps, but meta.agent.js has never parsed that flag. The argument is silently ignored, and the agent processes every Markdown file in the repository on every push — 11,461 tracked files — instead of the handful of READMEs the workflow identified.

# .github/workflows/documentation.yml
- run: node scripts/agents/meta.agent.js --dry-run --files "$README_FILES"
- run: node scripts/agents/meta.agent.js --files "$README_FILES"

meta.agent.js reads exactly two flags:

// scripts/agents/meta.agent.js:523-524
const verbose = process.argv.includes('--verbose') || process.argv.includes('-v');
const dryRun = process.argv.includes('--dry-run');
...
const results = await processAllMarkdownFiles({ verbose, dryRun });

--files appears nowhere in the file. And processAllMarkdownFiles globs the whole tree:

// scripts/agents/meta.agent.js:481-486
async function processAllMarkdownFiles(options = {}) {
  const { pattern = '**/*.md' } = options;
  const files = globSync(pattern, { cwd: process.cwd(), ignore: [...] });

So README_FILES is computed by the workflow, exported, passed through an env var, and then dropped on the floor. The second step is also a live run — not --dry-run — so this is a write-everything-elsewhere step, not a reporting one.

Why it matters more than a wasted run

The second step rewrites files repo-wide, and the step immediately after it decides whether to open a PR based on git status. Unintended rewrites are therefore not just wasted work — they become the PR, attributed to whatever change triggered the push.

This got materially worse with #3588 (merged as afe166eb51). That PR moved the footer-path exemption out of shouldSkipMeta and into applyFooter, because returning true from shouldSkipMeta was skipping badges, emoji and front matter for ~5,500 exempt files rather than just their footers. That was the right fix. Combined with this unenforced --files, those ~5,500 files are now inside the blast radius of a live run where they previously fell out of it entirely.

Evidence

Verified on develop at afe166eb51:

$ grep -nE "\-\-files|args\.files" scripts/agents/meta.agent.js
(no output)

$ git ls-files -- '*.md' | wc -l
11461

Suggested direction

Three separable decisions, and the first is the safest default:

  1. Honour --files in meta.agent.js — accept a list and pass it to processAllMarkdownFiles instead of globbing. This makes the workflow do what it says, and needs a test for the flag since its absence is exactly the bug.
  2. Fail loudly on an unknown flag rather than ignoring it. An unrecognised argument in a live, repo-writing step is the real hazard; a one-line guard turns this class of bug into a CI failure instead of a silent surprise.
  3. Decide whether a live run should touch the whole repo at all, independent of the flag bug. If the answer is no, the workflow should call the agent with an explicit scope and the "check for content changes" step becomes meaningful.

Not fixing any of this in the #3588 pass — it is unrelated to footer cleanup. Splitting it out here so it is not lost.

Activity

  1. linear-code commented on Sep 27, 2026

    @linear-code
  2. added a commit that references this issue on Sep 27, 2026
    9efdc4c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions