Tighten hook classification, add refine targeting flags, improve TUI hint bar#272
Tighten hook classification, add refine targeting flags, improve TUI hint bar#272
Conversation
isHookCausingFailure could misclassify non-hook commit failures (e.g., GPG signing errors) as hook-caused, because the dry-run probe passes for any failure that isn't about staged changes or identity. The retry logic would then waste agent runs on an unfixable root cause. Add a hasCommitHooks guard: if no commit hooks (pre-commit, prepare-commit-msg, commit-msg) are installed, the failure cannot be hook-caused regardless of the probe result. Add tests for the GPG false-positive path and hook detection. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Match the targeting flags from `fix` so the two commands have consistent interfaces: - --branch: validates the user is on the named branch (guardrail, not a branch switch) - --all-branches: discovers branches with failed reviews via the daemon API, checks out each one, runs the refine loop, then restores the original branch - --list: shows failed reviews that would be refined without running - --newest-first: controls processing order for --list and --all-branches Refactors: - runRefine now takes a refineOptions struct instead of 8 positional params - validateRefineContext gains a branchFlag parameter - queryUnaddressedJobs in fix.go now returns []storage.ReviewJob; the old []int64 behavior moves to queryUnaddressedJobIDs - New git.CheckoutBranch helper in internal/git/git.go Co-Authored-By: Claude Opus 4.6 <[email protected]>
Address review findings from job 5469: - --newest-first now sorts branches by most recent failed job timestamp instead of reverse-alphabetical order - --all-branches returns a non-nil error when any branch fails refinement, after attempting all branches and restoring the original branch - Add flag validation tests (mutual exclusivity combos) - Add --branch validation tests (mismatch and match cases) Co-Authored-By: Claude Opus 4.6 <[email protected]>
- --list and --since are now mutually exclusive. Previously --since was silently ignored when combined with --list, making the output misleading about what would actually be refined. - runRefineList now uses GetRepoRoot for branch detection (correct for linked worktrees) and GetMainRepoRoot only for the daemon API query path. Previously both used GetMainRepoRoot, which could read the main worktree's branch instead of the current worktree's. Co-Authored-By: Claude Opus 4.6 <[email protected]>
- runRefineAllBranches now captures original HEAD SHA and restores detached-HEAD state after processing branches (previously left user on the last processed branch) - runRefineList fails fast when not in a git repo instead of silently falling back to cwd for daemon queries - Flag validation tests now catch all validation error patterns, not just "mutually exclusive" Co-Authored-By: Claude Opus 4.6 <[email protected]>
roborev: Combined ReviewVerdict: Changes are mostly solid, but there is one Medium-severity security issue that should be fixed before merge. Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
Add a second hint line above the navigation hints showing key actions (prompt, comment, cancel, rerun, tail, commit msg). Change "?: help" to "?: commands" in all TUI views (review, queue, prompt). Closes #271 Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Remove x/r/t from review hint line (queue-only handlers); replace with a/y which do work in review view - Add IsDir guard in hasCommitHooks to skip directories named like hooks - Defer HEAD resolution in runRefineAllBranches until needed (only for detached-HEAD restore), avoiding failure in unborn repos - Reset dirty working tree between branches in --all-branches to prevent cascade failures after a failed runRefine Co-Authored-By: Claude Opus 4.6 <[email protected]>
roborev: Combined ReviewVerdict: Changes are not clean yet; 3 Medium-severity issues should be addressed before merge. Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
- Gate ResolveSHA("HEAD") with IsUnbornHead check so --all-branches
does not fail in repos with no commits
- Log ResetWorkingTree errors instead of discarding them
- Add test verifying hasCommitHooks ignores directories named like hooks
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Instead of silently skipping HEAD resolution and later failing on restore, reject --all-branches upfront when HEAD is unborn (no commits on current branch). Also guard the restore path against empty originalHEAD to prevent git checkout "". Co-Authored-By: Claude Opus 4.6 <[email protected]>
roborev: Combined ReviewVerdict: 2 Medium security issues were identified; fix before merge. Medium
Synthesized from 4 reviews (agents: gemini, codex | types: security, default) |
Show queue-specific actions (cancel, rerun, tail, prompt, comment, copy, commit msg) on a second hint line above the navigation hints, matching the review view pattern. Co-Authored-By: Claude Opus 4.6 <[email protected]>
roborev: Combined ReviewVerdict: One Medium-severity issue should be fixed before merge; no High or Critical findings. Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
Extract queue help strings as constants and compute wrapping at runtime (matching the review view pattern), instead of hardcoding reservedLines. Prevents layout desync when help lines wrap on terminals narrower than ~90 columns. Co-Authored-By: Claude Opus 4.6 <[email protected]>
roborev: Combined ReviewVerdict: 1 Medium-severity issue should be addressed before merge. Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
|
The windows CI failure is a flake. Merging |
…hint bar (roborev-dev#272) ## Summary - **Tighten hook failure classification**: `isHookCausingFailure` now requires at least one commit hook to be installed before classifying a failure as hook-caused. Prevents GPG signing errors and other non-hook failures from triggering agent retry loops. Includes `IsDir` guard to skip directories named like hooks. - **Add `--branch`, `--all-branches`, `--list`, `--newest-first` to `refine`**: Match the targeting flags from `fix` so the two commands have consistent interfaces. Includes `refineOptions` struct refactor, `queryUnaddressedJobs` returning full jobs, and `git.CheckoutBranch` helper. - **Fix `--newest-first` ordering**: Sort branches by most recent failed job timestamp instead of alphabetical order. - **Fix `--all-branches` error handling**: Return non-nil error when any branch fails refinement. Restore detached-HEAD state correctly. Reset dirty working tree between branches to prevent cascade failures. - **Fix `--list` edge cases**: Reject `--list --since` (previously silently ignored). Use correct worktree root for branch detection in linked worktrees. Fail fast when not in a git repo. - **Tighten test assertions**: Flag validation tests catch all validation error patterns. - **Improve TUI hint bar** (closes roborev-dev#271): Add a second hint line to the review view showing action shortcuts (`p: prompt | c: comment | m: commit msg | a: addressed | y: copy`). Change `?: help` to `?: commands` in all TUI views. Only advertises keys that work in review view. Fixes roborev-dev#271 ## Test plan - [x] `go test ./...` passes - [x] `go vet ./...` clean - [ ] Manual: `roborev refine --list` - [ ] Manual: `roborev refine --list --all-branches` - [ ] Manual: `roborev refine --branch <current-branch>` - [x] Manual: Verify TUI review view shows both hint lines with correct keys 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
Summary
isHookCausingFailurenow requires at least one commit hook to be installed before classifying a failure as hook-caused. Prevents GPG signing errors and other non-hook failures from triggering agent retry loops. IncludesIsDirguard to skip directories named like hooks.--branch,--all-branches,--list,--newest-firsttorefine: Match the targeting flags fromfixso the two commands have consistent interfaces. IncludesrefineOptionsstruct refactor,queryUnaddressedJobsreturning full jobs, andgit.CheckoutBranchhelper.--newest-firstordering: Sort branches by most recent failed job timestamp instead of alphabetical order.--all-brancheserror handling: Return non-nil error when any branch fails refinement. Restore detached-HEAD state correctly. Reset dirty working tree between branches to prevent cascade failures.--listedge cases: Reject--list --since(previously silently ignored). Use correct worktree root for branch detection in linked worktrees. Fail fast when not in a git repo.c(comment) keyboard shortcut #271): Add a second hint line to the review view showing action shortcuts (p: prompt | c: comment | m: commit msg | a: addressed | y: copy). Change?: helpto?: commandsin all TUI views. Only advertises keys that work in review view.Fixes #271
Test plan
go test ./...passesgo vet ./...cleanroborev refine --listroborev refine --list --all-branchesroborev refine --branch <current-branch>🤖 Generated with Claude Code