feat(dev): pause a project's auto AFK loop after 3 consecutive failures #78
No reviewers
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos!78
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/65"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Slice 4 of #61 (design locked in ADR-0007): keep a recurring failure from burning an auto-run every scheduler sweep indefinitely. Track consecutive failed AFK runs per project, pause the automatic loop at three, and expose a UI Reset so a human can re-arm it.
What changed
consecutiveFailures(omitempty, likeautoEnabled) with atomic get / increment / reset methods — read-modify-write under the store lock, since the reaper goroutine and the Reset handler write it concurrently.reapAFKRun): the single place the run lifecycle writes the counter — reset on a success reap, increment on a death/timeout failure. A user-initiated Stop never reaches the chokepoint, so it stays neutral. The counter is kind-agnostic (manual and auto runs both feed it); only the auto loop is paused by it.afkAutoDecision/shouldLaunchAuto): aPausedterm populated fromconsecutiveFailures >= afkPauseThreshold. It gates the auto loop only and is deliberately absent from the sharedlaunchAFKRunclaim path, so manual "Start AFK run" still works on a paused project.POST /afk/reset/<project>: zeroes the counter and kicks one sweep to re-arm promptly; mirrors the auto-toggle handler (POST-only, Forgejo-only, shared ok/fail plumbing, no-JS 303 redirect plus fetch/morph#livefragment).afkPauseThreshold: a single tunable constant (default 3).Acceptance criteria
consecutiveFailuresthat round-trips across a store reload.POST /afk/reset/<project>) that zeroes the counter and re-arms.Verification
go build ./...,go vet ./...,gofmt -l ., andgo test -race ./...— all green.fw— OK.Closes #65