Skip to content

feat(sweep): daily stranded-work detector for remote branches and local trees - #138

Merged
abrichr merged 2 commits into
mainfrom
feat/workspace-staleness-sweep
Aug 21, 2026
Merged

feat(sweep): daily stranded-work detector for remote branches and local trees#138
abrichr merged 2 commits into
mainfrom
feat/workspace-staleness-sweep

Conversation

@abrichr

@abrichr abrichr commented Aug 21, 2026

Copy link
Copy Markdown
Member

What changed

  • adds a daily scheduled sweep that files ONE issue when work is going stale anywhere we own, following the default-branch-sweep.yml pattern (stdlib only, explicit per_page, one issue rewritten in place, silent when clear)
  • remote detector (hosted-safe): a branch that is not the default branch, has no open pull request, and has been quiet past --stale-days (default 14) is reported as stranded; gh-readonly-queue/*, dependabot/*, fresh branches, and open-PR heads stay quiet
  • local detector (--local-root): bin/oa-fresh ported here, so clones behind origin, unpushed commits, and uncommitted files land in the same issue; duplicate clones of one remote are marked as duplicates instead of double-counting; a runner without workspace visibility says exactly that instead of implying the trees are fine
  • sync dispatch input: fast-forwards clean default-branch clones using bin/oa-fresh's exact safety rule (never touches dirty trees, feature branches, or clones with local commits; the only mutation attempted is git merge --ff-only) and refuses loudly on any runner without OA_SRC_ROOT
  • documents how to attach a workspace self-hosted runner later (export OA_SRC_ROOT, switch runs-on to [self-hosted])

Why

On 2026-08-21 bin/oa-fresh --sync found 32 local clones behind their origin carrying unpushed or uncommitted work. Stale-tree misreads have produced four confident wrong findings this year. oa-fresh answers the local question but nothing schedules it, and no cross-repository detector watches for stranded remote branches at all. This repository already owns the multi-repo registry and files one issue per day from two other scheduled sweeps.

Validation

  • 20 passed in tests/test_sweep_workspace_staleness.py: fire and stay-quiet classifier cases, plus real-git scratch repositories proving sync fast-forwards only clean default branches and cannot touch dirty or feature-branch trees
  • ruff check / ruff format --check clean on both files
  • actionlint clean on the workflow
  • end-to-end smoke run of --local-root <real workspace> produced the expected table against live trees

…al trees

One scheduled job that asks whether work is going stale anywhere we own,
following the default-branch-sweep pattern of one issue rewritten in place.

- remote detector (hosted-safe): branches that are not the default branch,
  have no open pull request, and have been quiet past --stale-days are listed
  as stranded; queue/dependabot machinery and fresh branches stay quiet
- local detector (--local-root): bin/oa-fresh ported so clones behind origin,
  unpushed commits, and uncommitted files land in the same issue; duplicate
  clones of one remote are marked instead of double-counted; a runner without
  workspace visibility says so instead of implying the trees are fine
- sync dispatch input fast-forwards clean default-branch clones only, using
  bin/oa-fresh's exact safety rule, and refuses loudly on any runner without
  OA_SRC_ROOT; nothing else in this job mutates anything

20 offline classifier tests cover the fire and stay-quiet conditions plus
real-git scratch-repository tests proving sync cannot touch dirty or
feature-branch trees.
Copies the default-branch-sweep self-test setup; a bare python -m pytest has
no pytest module on the hosted image.
@abrichr
abrichr merged commit 080713f into main Aug 21, 2026
7 checks passed
@abrichr
abrichr deleted the feat/workspace-staleness-sweep branch August 21, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant