feat: TUI-triggered fix via background worktrees (#279)#282
feat: TUI-triggered fix via background worktrees (#279)#282mariusvniekerk wants to merge 40 commits intoroborev-dev:mainfrom
Conversation
roborev: Combined ReviewVerdict: Not ready to merge; the PR has 3 High and 5 Medium issues requiring fixes. CriticalNone. High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: default, security) |
roborev: Combined ReviewVerdict: Not ready to merge; there are 2 High and 5 Medium issues (security + runtime correctness). High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
roborev: Combined ReviewVerdict: The change is not ready to merge due to 1 High and 4 Medium issues affecting security and workflow safety. High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
|
@mariusvniekerk if you rebase, there are better review_guidelines which may help with the noisy security reviews |
|
Hmmm think i'm already rebased. |
e909462 to
7d763d1
Compare
|
rebased on main due to conflicts. |
roborev: Combined ReviewVerdict: Changes introduce multiple security/correctness risks that should be addressed before merge. High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
roborev: Combined ReviewVerdict: Changes introduce one significant security regression and multiple medium-risk prompt-handling/control-flow issues that should be addressed before merge. High
Medium
Synthesized from 4 reviews (agents: gemini, codex | types: security, default) |
roborev: Combined ReviewVerdict: Not ready to merge — 1 high and 5 medium issues remain after deduplication. High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: security, default) |
roborev: Combined ReviewVerdict: Significant security and correctness risks remain; fix before merge. High
Medium
Synthesized from 4 reviews (agents: codex, gemini | types: default, security) |
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
edb46f1 to
dffbc95
Compare
roborev: Combined Review (
|
Security Finding Responses1. Pathspec injection risk in
|
dfeea72 to
c76d3a0
Compare
roborev: Combined Review (
|
…dev#279) Add JobTypeFix constant, ParentJobID and Patch fields to ReviewJob, DB migration for new columns, SaveJobPatch helper, and updated all scan functions (ClaimJob, ListJobs, GetJobByID) to include new fields. Includes implementation plan in docs/plans/. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rev-dev#279) Move createTempWorktree, applyWorktreeChanges, and submodule helper functions from refine.go to a shared internal/worktree package. Add CapturePatch, ApplyPatch, and CheckPatch functions for reuse by the upcoming fix job worker. Move related tests to worktree_test.go. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…oborev-dev#279) Fix jobs create an isolated worktree via worktree.Create(), run the agent with agentic=true in the worktree, then capture the resulting diff as a patch stored in the DB via SaveJobPatch(). The worktree is cleaned up after the agent completes regardless of success/failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
POST /api/job/fix creates a background fix job for a parent review. It fetches the review output, builds a fix prompt, and enqueues a new fix job with agentic=true. GET /api/job/patch returns the stored patch for a completed fix job as plain text. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rev-dev#279) Add Tasks view (T key) showing fix job status, fix prompt modal (F key) to trigger fixes from review view, and patch apply with dry-run check. Includes rebase detection when patches don't apply cleanly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When applying a fix patch that doesn't merge cleanly, automatically trigger a new fix job with the stale patch as context so the agent can adapt the changes to current HEAD. Add R key in Tasks view for manual rebase trigger. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… QF1012) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add CompleteFixJob that writes patch + status in one transaction, preventing canceled jobs from retaining retrievable patches - Fail fix jobs when patch capture fails or agent produces no changes, instead of silently completing as done - Gate /api/job/patch on job.Status == done so only completed jobs serve patches Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- CheckPatch returns typed PatchConflictError for merge conflicts; only conflict errors trigger auto-rebase, other failures surface as errors - Strip Patch field from /api/jobs by-ID responses; patch is only served via dedicated /api/job/patch endpoint - Add stale_job_id to /api/job/fix so server builds rebase prompt from DB, avoiding large patch round-trips through the client - Move rebase prompt construction to server-side buildRebasePrompt - Raise MaxBytesReader to 50MB for /api/job/fix to support large prompts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix jobs belong in the Tasks view, not the main job queue. Filter them out in handleJobsMsg to avoid confusion with regular reviews. Also fixes go fmt alignment in server.go struct tags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…utput - Capture error-type events from Claude Code's stream-json output - Include partial assistant output (truncated to 500 chars) in error messages when the agent process exits non-zero - Report stream errors separately from stderr for clearer diagnostics - Use agent name instead of hardcoded "claude" in error messages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Refresh fix jobs list on every tick cycle when the Tasks view is active or when any fix jobs are queued/running, matching the main queue's continuous refresh behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Enter on done fix job opens review output - Enter on failed fix job shows error in flash message - t on done fix job opens review output (was no-op) - t on failed fix job shows error (was no-op) - t on running fix job still tails live output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ements - Add patch viewer (p key) with syntax-highlighted diff display - Apply (A) now stages, commits, and marks parent review as addressed - ESC from review returns to originating view (queue or tasks) - Tasks view: readable status labels, dynamic columns, help overlay (?) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Dynamic column widths sized to terminal width (matching main queue) - Header row with separator line for tasks table - Readable status labels (queued/running/ready/failed/canceled) with colors - Help overlay (?) with legend, keybindings, workflow - Patch viewer (p) with syntax-highlighted diff - ESC from review returns to originating view (queue or tasks) - Apply commits patch and marks parent review as addressed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ref and subject now split remaining width (25%/75%) after fixed columns. Ref column adapts to terminal width instead of being hardcoded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- New "applied" job status: done -> applied after successful patch apply - Server endpoint POST /api/job/applied to transition status - Tasks view shows "applied" with green styling, prevents re-applying - Fix job reviews no longer show "Verdict: Fail" (not meaningful for fixes) - Tasks list refreshes immediately after apply to reflect new status Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ompt - Add JobStatusRebased for stale fix jobs that triggered a rebase - Mark stale job as rebased when triggering rebase (terminal state) - Add /api/job/rebased endpoint and MarkJobRebased DB method - Allow viewing reviews and patches for rebased jobs - Enter on running tasks shows prompt view - Allow switching from prompt view to tail for running fix jobs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replaces repeated 3-way status comparisons (done/applied/rebased) with a single method on ReviewJob. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…flows Surface postJSON errors for mark-applied, mark-rebased, and mark-parent-addressed calls so failures are visible in the TUI flash message instead of silently ignored. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The CHECK constraint on review_jobs.status only allowed the original 5 statuses, silently rejecting applied/rebased transitions. Add a migration that rebuilds the table with the updated constraint. Also adds tests for MarkJobApplied and MarkJobRebased, and verifies the migration path from the old schema supports the new statuses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hand-rolled string parsing in patchFiles with the standard go-diff library for parsing unified diffs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
For file moves/renames, git add needs both the old path (to stage the deletion) and the new path (to stage the addition). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The merge resolution for patch_id + parent_job_id added a column but missed adding the corresponding ? placeholder in VALUES. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…re apply - MarkJobApplied and MarkJobRebased now require job_type='fix' in the WHERE clause, preventing non-fix jobs from reaching fix-only terminal states. - Before applying a patch, check if any patch-touched files have uncommitted changes and abort with a clear error if so, preventing unrelated edits from being included in the fix commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…oring - Restore parseStreamJSON as package-level function (method receiver was unneeded since body doesn't use the receiver; fixes cursor.go and tests) - Add missing gitCommitFile and installGitHook helpers to refine_test.go (lost during conflict resolution with upstream roborev-dev#305 test refactoring) - Fix validateRefineContext call sites to include new cwd parameter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c76d3a0 to
a0aacf6
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
…worktree.Create API Rebase conflict resolution accidentally duplicated TestWorktreeCleanupBetweenIterations, TestCreateTempWorktreeIgnoresHooks, and TestCreateTempWorktreeInitializesSubmodules into refine_test.go and main_test.go. These already exist in refine_integration_test.go (behind the integration build tag), causing redeclaration errors in CI. Also updates refine_integration_test.go to use the new worktree.Create API instead of the removed createTempWorktree function. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|

Summary
fixjob type that runs agents in isolated git worktrees, capturing patches stored in DBinternal/worktreepackage (reused byrefine.goand worker pool)/api/job/fixand/api/job/patchAPI endpoints for creating fix jobs and retrieving patchesT), fix prompt modal (F), patch apply (A), and automatic rebase when patches are staleTest plan
go test ./...— all 2531 tests passgo vet ./...— cleanFto trigger fix, monitor in Tasks view (T), apply patch (A)Closes #279
🤖 Generated with Claude Code