feat(dev): claim AFK issues via the afk/<N> branch, not a tracker label #93

Merged
dominik.polakovics merged 1 commit from afk/92 into main 2026-06-04 13:34:24 +02:00

Resolves the claim-flapping / clobbering described in #92 by making an AFK run's claim its local afk/<N> branch instead of a mutable in-progress tracker label.

What changed

  • Claim = branch. launchAFKRun no longer flips ready-for-agent → in-progress; the claim is the worktree it creates on afk/<N>. A failed spawn rolls back by tearing down only the worktree + branch — no label restore.
  • Selection skips claimed issues. New read-only Git.AFKBranches lists local afk/<N> branches (git for-each-ref refs/heads/afk/); selection filters the ready queue to the claimable set before picking the lowest. The scheduler's (N ready) hint and ReadyExists count that same claimable set, so a project whose only ready issues are parked doesn't loop.
  • No claim label anywhere. Tracker loses EnsureLabel/Relabel; the in-progress name/color constants are gone. Re-applying ready-for-agent to a claimed/parked issue can no longer re-claim it or cause flapping.
  • Reaper / 3-strikes / Reset unchanged. A failed run still parks via its surviving afk/<N> branch and increments the per-project failure counter exactly as before.

Docs

  • Adds ADR-0013 (branch-as-claim) with a partial-supersede pointer on ADR-0007 and a corrected incidental mention in ADR-0009.
  • docs/agents/triage-labels.md: drops in-progress as a lifecycle label; states that lab claims via afk/<N> branches, invisible to triage.
  • land-pr skill: drops the "clear the in-progress label" merge step and the in-progress trigger phrasing; keeps the afk/<N> head-branch + Closes #N contract.

Verification

  • go build ./..., go vet ./..., and go test -race ./... pass locally — new tests cover claimableIssues, parseAFKBranch, Git.AFKBranches over a real throwaway repo, and the parked-issue no-flap guarantee at both the handler and the scheduler.
  • Pre-commit dry-build is green for all hosts.

Closes #92

Resolves the claim-flapping / clobbering described in #92 by making an AFK run's claim its local `afk/<N>` branch instead of a mutable `in-progress` tracker label. ## What changed - **Claim = branch.** `launchAFKRun` no longer flips `ready-for-agent → in-progress`; the claim is the worktree it creates on `afk/<N>`. A failed spawn rolls back by tearing down only the worktree + branch — no label restore. - **Selection skips claimed issues.** New read-only `Git.AFKBranches` lists local `afk/<N>` branches (`git for-each-ref refs/heads/afk/`); selection filters the ready queue to the *claimable* set before picking the lowest. The scheduler's `(N ready)` hint and `ReadyExists` count that same claimable set, so a project whose only ready issues are parked doesn't loop. - **No claim label anywhere.** `Tracker` loses `EnsureLabel`/`Relabel`; the `in-progress` name/color constants are gone. Re-applying `ready-for-agent` to a claimed/parked issue can no longer re-claim it or cause flapping. - **Reaper / 3-strikes / Reset unchanged.** A failed run still parks via its surviving `afk/<N>` branch and increments the per-project failure counter exactly as before. ## Docs - Adds **ADR-0013** (branch-as-claim) with a partial-supersede pointer on ADR-0007 and a corrected incidental mention in ADR-0009. - `docs/agents/triage-labels.md`: drops `in-progress` as a lifecycle label; states that lab claims via `afk/<N>` branches, invisible to triage. - `land-pr` skill: drops the "clear the in-progress label" merge step and the in-progress trigger phrasing; keeps the `afk/<N>` head-branch + `Closes #N` contract. ## Verification - `go build ./...`, `go vet ./...`, and `go test -race ./...` pass locally — new tests cover `claimableIssues`, `parseAFKBranch`, `Git.AFKBranches` over a real throwaway repo, and the parked-issue no-flap guarantee at both the handler and the scheduler. - Pre-commit dry-build is green for all hosts. Closes #92
lab claimed a ready-for-agent issue by flipping its label
ready-for-agent -> in-progress before spawning the run. That label was a
shared, mutable tracker field any actor could overwrite: triage (or a
human) re-applying ready-for-agent silently un-claimed the issue, and a
failed run's surviving afk/<N> branch made a re-applied label flap
ready-for-agent <-> in-progress every scheduler tick.

Make the claim the run's local afk/<N> branch instead -- a durable ref on
disk lab already creates, restart-safe and invisible to triage. Issue
selection now lists the local afk/<N> branches and skips any open
ready-for-agent issue that already has one; the scheduler's ready-count
hint and ReadyExists count the same claimable set. The label flip, its
rollback, the in-progress constants, and the Tracker EnsureLabel/Relabel
methods are gone; a failed spawn rolls back by tearing down only the
worktree and branch. The reaper and three-strikes machinery are unchanged.

Adds ADR-0013 (branch-as-claim), a superseded-by pointer on ADR-0007,
updates docs/agents/triage-labels.md, and drops the in-progress label
step from the land-pr skill.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/nixos!93
No description provided.