Include user comments and tool attempts in fix prompts#622
Include user comments and tool attempts in fix prompts#622wesm merged 28 commits intoroborev-dev:mainfrom
Conversation
The `roborev fix` command was ignoring user comments left on reviews via the TUI, so the fix agent had no visibility into developer feedback (e.g. false-positive flags or preferred approaches). The refine command already included comments via GetCommentsForJob + BuildAddressPrompt, but fix did not. Add fetchComments() and formatComments() helpers and wire them into both fixSingleJob (single-job path) and runFixBatch (batch path). Update buildGenericFixPrompt and buildBatchFixPrompt to render a "User Comments" section when comments are present. Adjust batchEntrySize to account for comment text so prompt-size splitting remains accurate. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BuildAddressPrompt (used by refine) previously dumped all responses under "Previous Addressing Attempts", which misframed user comments like "this is a false positive" as failed fix attempts. Now responses are split by Responder prefix: roborev-* entries stay under "Previous Addressing Attempts", everything else goes under "User Comments" with developer-feedback framing. Add SplitResponses, FormatToolAttempts, and FormatUserComments to the prompt package so both fix and refine share the same rendering. Remove the local formatComments helper from fix.go in favor of the shared prompt.FormatUserComments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix two issues found by review: 1. buildGenericFixPrompt and buildBatchFixPrompt were passing all responses through FormatUserComments, so roborev-fix/roborev-refine tool responses were mislabeled as user comments. Now both paths call SplitResponses first and render FormatToolAttempts + FormatUserComments separately. 2. fetchComments only fetched by job_id, missing legacy SHA-based comments. Mirror the TUI's loadResponses merge logic: when the git ref is a single commit, also fetch by SHA, dedupe by ID, and sort chronologically. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ills Three remaining gaps where comments were not surfaced: 1. Daemon buildFixPromptWithInstructions now fetches comments via GetCommentsForJob and splits them into tool attempts vs user comments, matching the CLI fix behavior. 2. `roborev show --json` now includes a `comments` array in the JSON output so skills and external tools can see developer feedback and prior tool responses. 3. Both claude and codex roborev-fix skills updated to document the new comments field and instruct agents to respect developer feedback (false positives, preferred approaches). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add storage.GetAllCommentsForJob helper that merges job-based and legacy SHA-based comments with dedup and chronological sort. This centralizes the merge logic that was duplicated across TUI, CLI fix, and now needed by daemon fix and show --json. Update all remaining callers: - Daemon buildFixPromptWithInstructions uses GetAllCommentsForJob - show --json fetchShowComments merges both paths - Add batch prompt mixed-response test - Add GetAllCommentsForJob tests covering merge, dedup, range/dirty skip Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GetAllCommentsForJob now accepts commitID (int64) instead of gitRef (string) and calls GetCommentsForCommit directly, avoiding the repo-ambiguous GetCommitBySHA lookup that could fail when the same SHA exists in multiple repos. Fix dedup test to actually exercise the dedup branch by inserting a response with both job_id and commit_id set, so it appears in both queries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add debug log in daemon handleFixJob when GetAllCommentsForJob fails, and a stderr warning in fetchShowComments when the HTTP request fails. Both were silently swallowing errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All three callsites that implement the merge/dedup-by-ID/sort pattern for comments now cross-reference each other so future changes to the merge logic can be kept in sync. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The sync notes missed the original implementation in cmd/roborev/tui/fetch.go loadResponses(). All four callsites now cross-reference each other. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ests GetAllCommentsForJob now accepts gitRef as a fallback for legacy jobs that have no commit_id but do have a single-commit git_ref. Prefers commit_id when available (unambiguous), falls back to SHA lookup only when commit_id is zero. Also: - fetchShowComments now warns on SHA fetch failures (was silent) - Dedup test asserts all three responders are present (not just length) - Added test for SHA fallback when commitID is zero Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add commit_id support to the /api/comments endpoint so CLI callers can avoid ambiguous SHA-based lookups. fetchComments and fetchShowComments now prefer commit_id when available, falling back to SHA only for legacy jobs without commit linkage. Also reuse fetchShowComments for the human-readable show output so both --json and text modes display the same merged comment set. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update TUI loadResponses to prefer commit_id over SHA for legacy comment lookup, matching the fix.go and show.go paths. All four merge/dedup callers now consistently use the unambiguous commit_id when available. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…imestamps GetAllCommentsForJob now returns errors from legacy comment lookups instead of silently discarding them, so callers (daemon handler) can log failures. Test timestamps are now explicit RFC3339 strings with 1-hour spacing, eliminating flaky ordering from same-second inserts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verifies that when the legacy SHA lookup fails (nonexistent SHA), GetAllCommentsForJob returns a wrapped error while still providing the job-based comments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Strengthen the error-path test to verify that both job-linked comments (alice, charlie) are returned with correct ordering, not just a non-empty slice. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…on failures
Gate the SHA-based legacy comment fallback behind looksLikeSHA to
prevent task labels ("run", "analyze") from being treated as commit
SHAs. Add warnings in fetchComments for legacy fetch failures instead
of silently dropping comments.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fetchComments now logs a warning when the legacy comment endpoint returns a non-200 status (e.g. 404 commit not found) instead of silently ignoring the failure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add GetAllCommentsForJob to the HTTP client (daemon.HTTPClient) with the same merge/dedup/sort logic, commit_id preference, and SHA validation as the other callers. Update roborev refine to use it so legacy commit-based comments and prior tool attempts are included in address prompts. Update all sync notes to reference the fifth callsite. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
looksLikeSHA was rejecting uppercase hex and abbreviations shorter than 7 chars, causing legacy comment fallback to silently miss comments for valid git refs. Git accepts abbreviated SHAs as short as 4 characters and is case-insensitive. Update all four copies. Also remove unconditional log.Printf warnings from legacy comment fetch paths in fix.go and client.go — the fallback is best-effort and the noise interferes with --quiet and automation flows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Apply De Morgan's law to looksLikeSHA hex checks (staticcheck QF1001) and use assert.Empty instead of assert.Equal(t, "") in prompt tests (testifylint). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
roborev: Combined Review (
|
The 4-char minimum caused short hex task labels like "dead", "beef", and "cafe" to enter the SHA reachability and legacy comment lookup paths. Since git_ref always stores full 40-char SHAs for commit-based jobs, and GetCommitBySHA does exact matching anyway, supporting short abbreviations added false-positive risk without actual benefit. Restore the 7-char minimum (matching git's default abbreviation length) while keeping mixed-case hex support, which is genuinely needed since some tools store uppercase refs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks for catching these — both findings are valid. Addressed in 13bf6b0: 1. Ambiguous short-SHA fallback: Restored the 7-char minimum for 2. Silent error swallowing in legacy fetch: This is intentional — the legacy comment fetch is best-effort supplementary context. The primary job-based fetch already succeeded and any errors are returned to callers. Adding warnings back would reintroduce the stderr noise that was flagged in an earlier review (the — Comment by Claude Code |
Replace 4 duplicate local looksLikeSHA functions with a single exported git.LooksLikeSHA that reuses the existing isHex helper. Move the test from fix_test.go to git_test.go. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
roborev: Combined Review (
|
|
Duplicate of finding #2 from the previous review cycle (addressed in comment above). The silent error handling in legacy comment fetches is intentional — see rationale there. — Comment by Claude Code |
The merge/dedup-by-ID/sort pattern for combining job-based and legacy commit-based comments was duplicated in 5 callsites. Extract it into storage.MergeResponses and replace all inline copies. Remove stale sync notes that tracked the duplication. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
roborev: Combined Review (
|
Replace assert.Condition(func() bool { return false }) anti-pattern
in compact_test.go with proper require.NotEmpty/assert.Equal calls.
Trim redundant WHAT comment in show.go.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Skill-driven roborev comment calls were using the default $USER responder, making them indistinguishable from human comments in IsToolResponse. Add --commenter roborev-fix / --commenter roborev-refine to match the CLI commands' behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The verbose admonition about checking comments was unnecessary — models naturally read JSON fields. Replace with a concise one-liner. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Take main's branch-filtering revert in compact_test.go while keeping our clean assertion style (no assert.Condition anti-pattern). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
I'm squashing this PR right now -- I can take it from here to get this merged if that works! |
Move the LooksLikeSHA check out of storage.GetAllCommentsForJob and
into callers, so the storage package no longer imports internal/git.
The function now treats its fallbackSHA parameter as pre-validated
(empty string means no SHA fallback).
Add ReviewJob.CommitIDValue() to eliminate the repeated nullable
pointer extraction pattern (if j.CommitID != nil { id = *j.CommitID }).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Give me a few minutes, I'm doing a bit more clean-up! |
Detailed walkthrough and design notesProblemFix agents (both CLI What changed1. Core feature: comments in fix prompts
2. Legacy comment merging Comments can be stored against either a The outer "fetch primary + fetch legacy + merge" pattern is intentionally duplicated across these five sites rather than consolidated into one. Each site uses a different transport (DB queries, 3. The JSON output includes a 4. Skill-driven 5. Four identical local 6. The dedup-by-ID + chronological sort pattern was inlined in 5 places. Extracted into Recent cleanup (last few commits)Based on internal review, the last batch of commits addressed structural concerns:
— Comment by Claude Code |
|
OK, I think this is good to go from my end. I had Claude make a new summary of what we did. |
roborev: Combined Review (
|
|
Both findings are duplicates of previously addressed issues: 1. Legacy tool comments misclassified: This is the exact issue the 2. Legacy comment fallback drops errors silently: Addressed in earlier review cycles (see comments above). The legacy fetch is best-effort supplementary context. The primary job-based fetch already succeeded. The DB path ( — Comment by Claude Code |
|
LGTM. thanks @shoyer ! |
## Summary - When the refine workflow runs a branch-level range review (`mergeBase..HEAD`), the reviewer previously had no context about what individual per-commit reviews had already found, fixed, or dismissed — causing it to re-raise the same issues - Add `writeInRangeReviews()` to include per-commit review results (with verdicts, agent names, and dismissal comments) in range/branch review prompts, with a "do not re-raise" instruction (`InRangeReviewsHeader`) - Extract shared `lookupReviewContexts()` helper to deduplicate the review-fetching loop between `writeInRangeReviews` and `getPreviousReviewContexts` - Update both claude and codex refine skills to note that dismissal comments are included in re-review prompts Companion to #622, which ensures comments reach **fix agents**. This PR ensures per-commit reviews and their comments reach the **reviewing agent** during branch reviews, closing the other half of the duplicate-findings loop. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Stephan Hoyer <stephan@periodiclabs.ai> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
roborev-*) vs user-authored categories with distinct prompt framing via newSplitResponses/FormatToolAttempts/FormatUserCommentshelpers in the prompt packageGetAllCommentsForJobto merge job-linked and legacy commit-linked comments with dedup-by-ID, used consistently across daemon, CLI fix, CLI show, TUI, and the new HTTP client helperroborev show --jsonoutput and update both claude and codex fix skills to document the newcommentsfield and instruct agents to respect developer feedbacklooksLikeSHAfunctions into a single exportedgit.LooksLikeSHAreusing the existingisHexhelper; accepts mixed-case hex, 7-char minimum matching git's default abbreviation length