Fix #3: gov why shows historical failures incorrectly#13
Merged
cmtonkinson merged 1 commit intomainfrom Feb 14, 2026
Merged
Conversation
The `gov why` command was incorrectly showing tasks with historical failures even after they had successfully completed. This was caused by the `whyTaskKind()` function checking `task.Attempts.Failed > 0`, which matches any task that has ever failed, regardless of its current state. Root cause: - When `gov stop -w` kills a worker, `Attempts.Failed` is incremented - The task transitions to `blocked` state - When the task is resumed and completes successfully, it transitions to success states (merged, etc.) but `Attempts.Failed` remains > 0 - The `gov why` command would still show the task because of the historical failure count Fix: - Removed the `Attempts.Failed > 0` check from `whyTaskKind()` - Tasks in `TaskStateBlocked` are still shown (currently blocked/failing) - Planning tasks that caused supervisor failure are still shown - Historical failures no longer cause completed tasks to appear in output This preserves the `Attempts.Failed` counter for observability while fixing the display issue. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3
Problem
The
gov whycommand was showing tasks with historical failures even after they had successfully completed.Reproduction Steps
gov stop -wto kill workers (incrementsAttempts.Failed)gov startto restartmerged, etc.)gov why- incorrectly shows the completed tasksRoot Cause
The
whyTaskKind()function inmain.gowas checkingif task.Attempts.Failed > 0to determine if a task should appear in output. This matches any task that has ever failed, not just tasks that are currently failing.When workers are killed:
task.Attempts.Failedis incrementedblockedstateAttempts.Failedis never reset - it remains as historical recordThe old logic showed any task with historical failures, even if it had since recovered.
Solution
Removed the
Attempts.Failed > 0check fromwhyTaskKind(). Now the function only shows:TaskStateBlocked(actively blocked/failing)This preserves the
Attempts.Failedcounter for observability while fixing the incorrectgov whyoutput.Changes
main.go:
if task.Attempts.Failed > 0 { return "failed" }checkmain_test.go:
state: "blocked"instead ofstate: "triaged"withfailed: 1Testing
All tests pass:
Manual verification shows completed tasks with historical failures no longer appear in
gov whyoutput.