Skip to content

[q] Update jsweep file selection to use git-based deterministic ordering #31304

@github-actions

Description

@github-actions

Q Workflow Optimization Report

Fixes #31295 (comment)

Problem

The previous file selection strategy used filesystem modification timestamps (mtime) to find the oldest uncleaned file. This is non-deterministic: mtime is not preserved when checking out code in CI, so the selection order could differ between runs or machines.

Changes Made

.github/workflows/jsweep.md

Replaced the "earliest modification timestamp" selection with a git last-commit date query:

for f in *.cjs; do
  [[ "$f" == *.test.cjs ]] && continue
  last=$(git log -1 --format="%ct" -- "$f" 2>/dev/null)
  echo "${last:-0} $f"
done | sort -n | awk '{print $2}'
  • Files are sorted by their last git commit timestamp (Unix epoch), oldest first.
  • Files with no git history (never committed) sort to the top (epoch 0).
  • The sort is deterministic and reproducible across any checkout.
  • Priority 1 (@ts-nocheck files) and Priority 2 (stalest file) now both use this ordered list as the source of truth.
  • Reset logic simplified: on exhaustion, reset cleaned_files to empty and pick from the top of the list.

Expected Improvements

  • Selection order is now reproducible across CI machines and fresh checkouts.
  • Files that have never been touched by jsweep (or git) bubble to the top automatically.
  • No change to any other workflow behaviour.

Validation

  • jsweep compiled successfully via gh-aw MCP compile tool
  • Lock file will be regenerated automatically after merge.

🎩 Equipped by Q · ● 4.3M ·

  • expires on May 12, 2026, 5:34 AM UTC

Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download bundle artifact

The bundle file is available in the agent artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 25620793629 -n agent -D /tmp/agent-25620793629

# Fetch the bundle into a local branch
git fetch /tmp/agent-25620793629/aw-q-jsweep-deterministic-selection.bundle refs/heads/q/jsweep-deterministic-selection:refs/heads/q/jsweep-deterministic-selection-a0f0f5b9b858abc1
git checkout q/jsweep-deterministic-selection-a0f0f5b9b858abc1

# Push the branch to origin
git push origin q/jsweep-deterministic-selection-a0f0f5b9b858abc1

# Create the pull request
gh pr create --title '[q] Update jsweep file selection to use git-based deterministic ordering' --base main --head q/jsweep-deterministic-selection-a0f0f5b9b858abc1 --repo github/gh-aw

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions