From d94e0174f63224922ee80c63cc50050bcbdca2c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 06:37:25 +0000 Subject: [PATCH 1/4] Initial plan From bee97b2f46dd6c2aa68811c03137595b19d05258 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 06:42:59 +0000 Subject: [PATCH 2/4] chore: outline plan for jsweep file-selection randomization Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/daily-model-inventory.lock.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/daily-model-inventory.lock.yml b/.github/workflows/daily-model-inventory.lock.yml index 61c31237a4e..607ef0eb228 100644 --- a/.github/workflows/daily-model-inventory.lock.yml +++ b/.github/workflows/daily-model-inventory.lock.yml @@ -1787,3 +1787,4 @@ jobs: /tmp/gh-aw/safe-output-items.jsonl /tmp/gh-aw/temporary-id-map.json if-no-files-found: ignore + From d98aec653ca49d7a3106000c129e107f26710987 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 06:47:13 +0000 Subject: [PATCH 3/4] fix(jsweep): randomize fallback file selection among recent candidates Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/jsweep.md | 2 +- pkg/workflow/jsweep_workflow_test.go | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/jsweep.md b/.github/workflows/jsweep.md index 302ec392228..81d816cc911 100644 --- a/.github/workflows/jsweep.md +++ b/.github/workflows/jsweep.md @@ -92,7 +92,7 @@ fi - Exclude test files (`*.test.cjs`) - Exclude files already listed in `cleaned_files` in the loaded state - **Priority 1**: Pick files with `@ts-nocheck` or `// @ts-nocheck` comments (these need type checking enabled) -- **Priority 2**: If no uncleaned files with `@ts-nocheck` remain, pick the **one file** whose most recent git commit is oldest, using a deterministic `git log -1 --format='%ct' -- ` query over the candidate set sorted by path (do not use filesystem modification timestamps) +- **Priority 2**: If no uncleaned files with `@ts-nocheck` remain, pick **one file at random** from the recently modified candidates by ranking files with `git log -1 --format='%ct' -- ` and sampling from the most recently modified group (do not use filesystem modification timestamps) If no uncleaned files remain, start over with the oldest cleaned file (reset `cleaned_files` to only the one just chosen). diff --git a/pkg/workflow/jsweep_workflow_test.go b/pkg/workflow/jsweep_workflow_test.go index 9483a208af6..72f3e9cb1b4 100644 --- a/pkg/workflow/jsweep_workflow_test.go +++ b/pkg/workflow/jsweep_workflow_test.go @@ -122,16 +122,22 @@ func TestJSweepWorkflowConfiguration(t *testing.T) { } }) - // Test 9: Verify the fallback selection is deterministic - t.Run("UsesDeterministicFallbackSelection", func(t *testing.T) { + // Test 9: Verify the fallback selection randomizes among recently modified files + t.Run("UsesRandomizedRecentFallbackSelection", func(t *testing.T) { if !strings.Contains(mdContent, "git log -1 --format='%ct'") { t.Error("jsweep workflow should use a deterministic git query for fallback file selection") } - if !strings.Contains(mdContent, "most recent git commit is oldest") { - t.Error("jsweep workflow should tie the git query to choosing the oldest cleanup candidate") + if !strings.Contains(mdContent, "pick **one file at random**") { + t.Error("jsweep workflow should randomize fallback file selection") } - if !strings.Contains(mdContent, "sorted by path") { - t.Error("jsweep workflow should sort candidate files by path before fallback selection") + if !strings.Contains(mdContent, "most recently modified") { + t.Error("jsweep workflow should limit randomized fallback selection to recently modified files") + } + if strings.Contains(mdContent, "most recent git commit is oldest") { + t.Error("jsweep workflow should not choose the oldest fallback candidate") + } + if strings.Contains(mdContent, "sorted by path") { + t.Error("jsweep workflow should not sort candidates by path for fallback selection") } if strings.Contains(mdContent, "earliest modification timestamp") { t.Error("jsweep workflow should not use filesystem modification timestamps for fallback selection") From 2723adbed429cda1a3c646198fac6b2451497fac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 06:51:22 +0000 Subject: [PATCH 4/4] test(jsweep): clarify randomized recent-candidate fallback guidance Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/jsweep.md | 2 +- pkg/workflow/jsweep_workflow_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/jsweep.md b/.github/workflows/jsweep.md index 81d816cc911..4f701758bbb 100644 --- a/.github/workflows/jsweep.md +++ b/.github/workflows/jsweep.md @@ -92,7 +92,7 @@ fi - Exclude test files (`*.test.cjs`) - Exclude files already listed in `cleaned_files` in the loaded state - **Priority 1**: Pick files with `@ts-nocheck` or `// @ts-nocheck` comments (these need type checking enabled) -- **Priority 2**: If no uncleaned files with `@ts-nocheck` remain, pick **one file at random** from the recently modified candidates by ranking files with `git log -1 --format='%ct' -- ` and sampling from the most recently modified group (do not use filesystem modification timestamps) +- **Priority 2**: If no uncleaned files with `@ts-nocheck` remain, pick **one file at random** from the top 10 most recently modified candidates by ranking files with `git log -1 --format='%ct' -- ` (do not use filesystem modification timestamps) If no uncleaned files remain, start over with the oldest cleaned file (reset `cleaned_files` to only the one just chosen). diff --git a/pkg/workflow/jsweep_workflow_test.go b/pkg/workflow/jsweep_workflow_test.go index 72f3e9cb1b4..068b06b2aa0 100644 --- a/pkg/workflow/jsweep_workflow_test.go +++ b/pkg/workflow/jsweep_workflow_test.go @@ -130,8 +130,8 @@ func TestJSweepWorkflowConfiguration(t *testing.T) { if !strings.Contains(mdContent, "pick **one file at random**") { t.Error("jsweep workflow should randomize fallback file selection") } - if !strings.Contains(mdContent, "most recently modified") { - t.Error("jsweep workflow should limit randomized fallback selection to recently modified files") + if !strings.Contains(mdContent, "top 10 most recently modified candidates") { + t.Error("jsweep workflow should limit randomized fallback selection to top recent candidates") } if strings.Contains(mdContent, "most recent git commit is oldest") { t.Error("jsweep workflow should not choose the oldest fallback candidate")