Add compact command for verifying and consolidating reviews#261
Add compact command for verifying and consolidating reviews#261anshbansal wants to merge 14 commits intoroborev-dev:mainfrom
Conversation
Implements `roborev compact` command that discovers unaddressed review jobs, sends them to an agent for verification against the current codebase, consolidates related findings, and creates a new consolidated review job. Original jobs are marked as addressed after consolidation. This adds a quality layer between `review` and `fix` to reduce false positives and consolidate findings from multiple reviews for easier human review. Features: - Discovers unaddressed jobs with branch filtering (--branch, --all-branches) - Builds verification prompt that instructs agent to check each finding - Creates consolidated task job with agentic mode for codebase search - Streams agent output during verification (unless --quiet) - Marks original jobs as addressed after successful consolidation - Supports --dry-run to preview what would be done - Uses fix agent configuration by default (--agent, --model, --reasoning) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Add isValidConsolidatedReview() to detect agent errors vs valid findings Add extractJobIDs() helper to extract IDs from jobReview slice Add comprehensive unit tests for validation and prompt building Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Critical fixes: - Fix data loss bug: track successfulJobIDs separately, only mark those as addressed - Add output validation: reject agent errors before marking jobs as addressed - Add --limit flag (default 20) to prevent oversized prompts - Remove unused --unaddressed flag Refactoring: - Extract fetchJobReviews() helper for cleaner error handling - Extract verifyAndConsolidate() for separation of concerns - Extract markJobsAsAddressed() for reusability - Reduce runCompact() from 170 lines to ~100 lines - Create job_helpers.go with shared waitForJobCompletion() - Document race condition limitation in code and help text All tests pass, build succeeds. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Validation fixes: - Only check for error patterns at line start (avoid false positives) - Require both severity AND structure markers for validation - Accept words like "cannot" and "error" in review content - Support more file extensions (.js, .ts, not just .go/.py) Progress improvements: - Show enqueued job ID when starting consolidation - Makes it clear which job is running Updated tests to reflect stricter but more accurate validation. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Shows detailed progress when fetching and marking jobs: [1/4] Fetching job 152... done [2/4] Fetching job 151... done [3/4] Fetching job 144... done [4/4] Fetching job 142... done And when marking as addressed: [1/4] Marking job 152... done [2/4] Marking job 151... done ... Makes it clear what's happening during multi-job operations. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Shows progress while waiting for agent to start and process: - "Waiting for agent to start..." (with dots) - "Agent processing..." (with dots until output appears) Provides feedback during the main wait time after job enqueue and before agent output starts streaming. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Compact jobs now get Pass/Fail verdicts computed: - Added JobTypeCompact to distinguish from generic task jobs - Compact jobs are not considered "task jobs" so verdicts are computed - Explicit job_type parameter passed from compact command to daemon Fixes compact reviews showing "-" instead of "F" in TUI when findings exist. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Compact jobs have custom prompts but non-task job types, so they need special handling in worker. Changed prompt selection to check for job.Prompt directly instead of job.IsTaskJob(). Fixes "git log: exit status 128" error when processing compact jobs. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Compact now runs in background by default: - Enqueues consolidation job and returns immediately - User can continue working while consolidation runs - Use --wait flag to block until completion (like analyze --wait) Background mode output: - Shows enqueued job ID - Explains how to check progress (roborev status/tui) - No streaming output to avoid false progress expectations With --wait flag: - Streams agent output - Waits for completion - Validates output - Marks jobs as addressed automatically Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Use singular "review" when count=1, plural "reviews" otherwise: - "1 unaddressed review" (was: "1 unaddressed reviews") - "Verified and consolidated 1 unaddressed review" (was: "reviews") Updated tests to expect correct grammar. Fixes the last remaining issue from Review roborev-dev#164. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Add "Review Verification" section to README explaining how compact automates verification and consolidation of review findings. Include command examples and workflow explanation. Add compact to commands table between analyze and show for logical grouping. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
- Remove ambiguous "wide code search" phrasing - agent uses its search tools, not an inherent capability - Use active voice: clarify that roborev automatically marks jobs as addressed - Split dense sentence into two for better readability Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
roborev: Combined ReviewVerdict: PR has unresolved High and Medium issues; not ready to merge. High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
roborev: Combined ReviewVerdict: Changes are not PR-ready; there are 2 High and 3 Medium issues that should be addressed before merge. High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
Previously, when running `roborev compact` without --wait flag, the
source jobs were never marked as addressed because the CLI returned
immediately after enqueueing. This defeated the purpose of compact.
Solution: Make daemon worker automatically mark source jobs when compact
job completes. Uses temporary JSON files to track source job IDs.
- CLI writes compact-{jobID}.json with source job IDs after enqueue
- Worker reads metadata file when compact job completes successfully
- Worker marks each source job as addressed via MarkReviewAddressedByJobID
- Worker cleans up metadata file after processing
- Gracefully handles legacy compact jobs without metadata files
This works in both --wait and background modes. The --wait mode still
marks jobs immediately for user feedback, but worker is source of truth.
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Addresses multiple critical and medium severity issues identified in review roborev-dev#184 of commit da929f2: 1. Race Condition (Critical): Fixed race where metadata file was written AFTER job was enqueued. Now if metadata write fails, the job is canceled and an error is returned to the user. This prevents source jobs from never being marked as addressed. 2. Error Handling (Critical): Made metadata write failures fatal instead of just logging a warning. If metadata cannot be written, the compact job is canceled via the daemon API and the error is propagated to the user. 3. Duplicate Code (Medium): Removed duplicate getDataDir() function and replaced with config.DataDir() throughout. Added config package import. 4. Missing Tests (Medium): Added comprehensive test coverage: - internal/daemon/compact_test.go: Tests for ReadCompactMetadata, DeleteCompactMetadata, and compactMetadataPath - cmd/roborev/compact_test.go: Tests for writeCompactMetadata including empty source IDs validation 5. Empty Validation (Low): Added early return in writeCompactMetadata for empty sourceJobIDs to avoid creating unnecessary metadata files. 6. Error Messages (Low): Improved error message in markCompactSourceJobs to include job ID for better debugging context. 7. Redundant Logging (Low): Removed per-job success logs in markCompactSourceJobs, keeping only the summary log to reduce noise. Technical changes: - Added cancelJob() helper function to cancel jobs via daemon API - Updated writeCompactMetadata() to validate and fail fast - All tests pass: go test ./... - Code formatted: go fmt ./... - No vet issues: go vet ./... Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
roborev: Combined ReviewVerdict: Not ready to merge — 3 High and 4 Medium issues remain after deduplication. High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
|
Thanks for putting this up. I'm probably going to try to get 0.32.0 out before working on this but give me a day or two, if you have more work you want to continue pushing here feel free otherwise I can take it over and get it to a merge ready state |
|
@wesm I am not sure I will be able to push during the weekdays. Please feel free to take over. I think I was mostly done. |
|
All good. I can take it from here |
PR for #257
I did
and I believe this is working