Repository navigation
AI Fix for Issue #41: Feat: Implement worker for follow-up PR changes - #43
Merged
integry merged 19 commits intoJul 29, 2025
Merged
Conversation
…changes Implemented by Claude Code using opus model. Implementation completed successfully.
- Add model alias mapping configuration with intuitive names: - opus → claude-opus-4-0 - sonnet → claude-sonnet-4-0 (now default) - sonnet37 → claude-3-7-sonnet-latest - sonnet35 → claude-3-5-sonnet-latest - haiku → claude-3-5-haiku-latest - Update model resolution across the codebase: - daemon.js: Resolve aliases from issue labels and PR comments - worker.js: Use aliased default model - claudeService.js: Use aliased default model - Add comprehensive test suite for model alias functionality - Support case-insensitive alias matching - Maintain backward compatibility with full model IDs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Update model aliases to match official Anthropic model IDs: - opus → claude-opus-4-20250514 - sonnet → claude-sonnet-4-20250514 (default) - sonnet37 → claude-3-7-sonnet-20250219 - sonnet35 → claude-3-5-sonnet-20241022 - haiku → claude-3-5-haiku-20241022 - Add support for official Anthropic aliases (claude-opus-4-0, etc.) - Maintain backward compatibility with legacy model names - Fix "Invalid model name" error by using correct model IDs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…" error
- Fix simple-git initialization in commitChanges, ensureBranchAndPush, and pushBranch functions
- Use proper { baseDir: worktreePath } options object instead of plain string parameter
- Add debug logging to confirm worktree path is being used correctly
This ensures all git commands are executed within the correct repository context
when working with git worktrees, resolving the issue where git config --local
was failing.
Fixes the error that was preventing AI-generated changes from being committed
in the worker process.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
- Change worktreePath to worktreeInfo.worktreePath in prompt generation - This fixes the ReferenceError that was causing PR follow-up jobs to fail 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…tails - Extract and use Claude's summary in commit messages - Parse summary to extract key changes (bullet points, numbered lists) - Create more informative commit messages with actual changes instead of generic text - Enhance PR comments to include the full summary of changes made - Add execution metrics (turns, time) to PR comments - Improve formatting with markdown headers and sections - Handle "no changes needed" case with analysis summary Example commit message now includes: - First line from Claude's summary - Key changes as bullet points - PR reference, comment author, and model used Example PR comment now includes: - Full summary of changes section - Organized markdown formatting - Execution metrics at the bottom 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Display cost in PR comments for both successful changes and no-changes cases - Check for both total_cost_usd and cost_usd fields for compatibility - Format cost with 2 decimal places (e.g., $1.74) - Cost appears in the execution metrics section 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
… follow-ups - Check if PR comment has already been processed before starting work - Look for bot comments that reference the comment ID or user mentions - Skip processing if already handled (success or failure) - Post a "starting work" comment when beginning PR follow-up processing - Include comment ID in error messages for better tracking - Return early with 'skipped' status for already processed comments This prevents duplicate processing of the same follow-up request and provides better user feedback about the processing status. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Sort comments by creation time to process them chronologically - Check if subsequent bot comments indicate the comment was already processed - Look for bot responses that mention the comment author and contain specific phrases: - "Starting work on follow-up changes" - "Applied the requested follow-up changes" - "Failed to apply follow-up changes" - "Analyzed the follow-up request" - Or contain the specific Comment ID - Skip queuing comments that have already been handled This prevents the daemon from repeatedly adding the same PR comments to the processing queue on every polling cycle. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
The previous logic was too broad - if ANY comment from a user had been processed, it would skip all subsequent comments from that same user. Changes: - Add specific comment ID to "starting work" message - Check for exact comment ID references instead of just username mentions - Remove overly broad duplicate detection that prevented processing multiple comments from same user This ensures each comment is processed independently, allowing users to make multiple follow-up requests on the same PR. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…remotes Three key improvements for PR follow-up processing reliability: 1. **Enhanced unpushed commit detection**: - Check multiple scenarios: commits ahead of origin, branch not on remote, remote fetch failures - Always attempt to push if there's any indication of local commits - Handle cases where remote doesn't exist or branch hasn't been pushed yet 2. **Add origin remote to worktrees**: - Worktrees don't inherit remote config from parent repository - After creating worktree, copy origin remote URL from parent - Prevents "No such remote 'origin'" errors during push 3. **Better error recovery**: - If git status check fails, still attempt to push - More detailed logging for debugging push failures - Handle edge cases where branch exists locally but not remotely This ensures PR follow-up changes are never lost due to push failures. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Fixed SyntaxError where worktreeGit was declared twice in the createWorktreeFromExistingBranch function. The remote setup code was accidentally duplicated. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add better error handling when worktree creation fails due to .git being a directory - Clean up improperly created worktrees and retry - Add verification that main repository is valid before creating worktree - Log existing worktrees for debugging - Improve cleanup to handle directories with .git that aren't proper worktrees - Add final verification that origin remote is configured after worktree setup - Ensure worktree creation errors are properly propagated and not masked This should fix the issue where PR follow-up processing fails with 'No such remote origin' error
- Add comment explaining why .git might become a directory during processing - Improve cleanup logging to distinguish between invalid worktrees and other errors - Change warning to info log when directory is not a valid worktree during cleanup This addresses the warnings seen when Claude Code or Docker operations convert a worktree into a regular repository during processing.
- Use 'git worktree add -B branchname' to create a local branch tracking the remote - This prevents detached HEAD state which was causing commit/push issues - Clean up commit hash by removing 'HEAD ' prefix from simple-git output - Ensures Claude Code and worker can properly commit and push changes This should fix the issue where PR follow-up changes weren't being pushed to GitHub
CRITICAL FIXES: 1. Mount entire /tmp/git-processor directory in Docker so worktree .git files can find the main repository 2. Add safety rules to Claude prompt to prevent 'rm .git' and 'git init' disasters 3. Use -B flag when creating worktrees to ensure proper branch tracking This prevents the catastrophic issue where Claude Code: - Can't find the main repository from within the worktree - Decides to 'fix' it by deleting .git and running git init - Commits the entire codebase as a new repository with 63 files The root cause was that worktree .git files reference paths like: /tmp/git-processor/clones/owner/repo/.git/worktrees/... But we were only mounting part of the directory structure.
Added detailed logging at critical points: 1. **Before Docker execution**: - Verify worktree .git file structure and content - Check if main repository path exists - Warn if .git is already a directory (disaster waiting to happen) 2. **Docker mount verification**: - Log all volume mounts with source/destination paths - Check if mount sources exist and their types - Show Docker command details and model info 3. **After Claude Code execution**: - Verify worktree .git hasn't been converted to directory - Check for signs of 'git init' (config file in .git directory) - Compare pre/post .git file contents 4. **Git operations**: - Detailed git status before commits (staged, modified, detached state) - List all files being committed with their status - Branch checkout operations with before/after verification - Show exact git worktree add command used 5. **Safety prompt logging**: - Confirm safety rules are included in prompt - Show prompt preview for debugging This comprehensive logging will help quickly identify: - When/why worktrees get corrupted - If Docker mounts are working correctly - Whether Claude is ignoring safety rules - Exact state transitions during git operations
1. Move worktreeGitContent and mainRepoPath to outer scope so they're available for post-execution verification 2. Add optional chaining (?.) to git status properties since simple-git doesn't always provide all properties This fixes: - 'worktreeGitContent is not defined' error in post-execution verification - 'Cannot read properties of undefined (reading length)' error when accessing status.tracked.length etc.
- Instruct Claude NOT to commit changes in PR follow-up prompt - Add note that permission errors are expected when trying to commit - Explain that the system will automatically commit changes This prevents confusion where: 1. Claude tries to commit and gets permission errors 2. Claude reports it couldn't commit 3. But the system successfully commits anyway 4. The GitHub comment shows both success and Claude's error note Now Claude will understand it shouldn't commit and won't report confusing error messages about permissions.
integry
deleted the
ai-fix/41-feat-implement-worker-for-20250722-1039-opus-o9c
branch
July 29, 2025 10:47
propr-dev Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
… to-dos. A duplicate POST or a retry used to complete a to-do the user had reopened, or point it back from a newer issue to the older one. Now it does neither. I fixed F1: replaying an older submission no longer changes to-dos. A duplicate POST or a retry used to complete a to-do the user had reopened, or point it back from a newer issue to the older one. Now it does neither. **Fix** - **New column:** migration `20261013010000_add_task_submission_todos_linked.js` adds a `todos_linked` flag to `task_submissions`, default false. Rolling back drops it. `TaskSubmission` now has the field. - **Route helper:** `linkSubmissionTodos` in `packages/api/routes/taskSubmissionRoutes.ts` now does nothing if the submission's to-dos have already been linked. Otherwise, in one transaction, it sets `todos_linked` (only if it is still false) and completes the to-dos. - If the to-do update fails, the whole transaction rolls back, the flag stays false, and a later retry can still apply it. Failures are still only logged, and the response is unchanged. - If two replays run at the same moment, the one that loses doesn't touch the to-dos. - **Other callers:** `submit`, `retry` and MCP `create_task` all go through the same `resume` wrapper, so the one guard covers all of them. `completeTodosForIssue` itself is unchanged; a genuinely new submission still relinks a reopened to-do to its new issue, as intended. **Tests** (in `packages/api/test/taskSubmissionRoutes.test.ts`) - **New regression:** submission A links issue #42. The user reopens the to-do, then A is replayed by both a duplicate POST and its retry endpoint; the to-do stays open. Then submission B links it to #43, A is replayed again by both paths, and the to-do keeps #43. - **Updated existing test:** duplicates and retries no longer call the completion step again (2 calls instead of 4). A submission whose to-do write failed links the to-do on its later retry. - **Checked against the old code:** both of these tests fail on the old code and pass with the fix. - **Results:** the route, `repoTodosIssueLink`, `taskSubmissionService`, `mcpTaskSubmissions` and `mcpIntegration` suites pass, and type checks pass for the root and `api`. I didn't run the new migration against a real database, only in-memory SQLite. **One side effect:** the issue link records `linked_task_id` from the submission at the moment of linking. The task id is usually set later by the worker, and retries used to fill it in on the to-do afterwards. Since replays now skip that step, `linked_task_id` will usually stay null. The completion and the issue link are unaffected. I left this alone because it's outside F1. There's no visible UI change, so I didn't capture a preview. The claude.ai Gmail, Google Calendar, Google Drive and ProPR connectors need to be authorized in your claude.ai connector settings before they can be used. This task didn't need them. PR: #2887 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
propr-dev Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
…fixed by the previous commit on this branch, so it needed no new changes. The affected suites pass (27 tests), and the two new regression tests fail when the guard is taken out. I added a per-to-do freshness guard for F2. F1 was already fixed by the previous commit on this branch, so it needed no new changes. The affected suites pass (27 tests), and the two new regression tests fail when the guard is taken out. **F1 (replaying a submission undoes later to-do changes).** The required fix is already on the branch: - **The record:** each submission row now has a `todos_linked` flag. It is set in the same transaction as the to-do update. - **Replays:** duplicate POSTs and retries skip the to-do update once the flag is set. - **Failures:** if the update fails, the flag stays false, so a later retry can still apply it. - **Callers:** form submit, the retry endpoint and the MCP `create_task` tool all go through this one guarded path. - **Test:** the existing test reopens the to-do and relaunches it before replaying the older submission. Both cases are covered. **F2 (an older submission's retry replaces a newer issue link).** In `completeTodosForIssue` (`packages/core/src/services/repoTodosService.ts`), a submission now leaves a to-do alone if it is already linked to a higher-numbered issue in the same repository. - **Why issue numbers:** GitHub issue numbers only increase within a repository, so a higher number means a newer launch. This needs no new column. - **Still allowed:** to-dos with no link yet, a re-apply of the same issue, and a link to a higher-numbered issue. If the stored link points to a different repository, the numbers can't be compared, so the update is allowed. - **When a to-do is skipped:** the older submission's flag is still set. It doesn't retry forever and simply counts as replaced by the newer launch. **Regression tests:** - `packages/api/test/taskSubmissionTodos.test.ts`: submission A opens issue #42 but its to-do write fails. Submission B opens #43 and links the to-do. Retrying A leaves the to-do on #43 and sets A's flag, and a further retry doesn't attempt the update again. - `packages/core/test/repoTodosIssueLink.test.ts`: a link from an older issue doesn't replace the newer issue number or task ID, and doesn't complete a reopened to-do. A link from a newer issue still does. **Checks run:** - **Tests:** `repoTodosIssueLink`, `taskSubmissionTodos`, `taskSubmissionRoutes` and `mcpTaskSubmissions` all pass. - **Types:** type checks pass for `api` and `core`. - **Lint:** ESLint passes on the changed service and API test. `packages/core/test` is excluded by the lint config, so the core test file wasn't linted. **One trade-off:** the guard orders launches by when their issue was created, not when they were submitted. Suppose submission A failed before creating an issue, then B created #42, and A's retry later created #43. The to-do would end up on #43, which is the most recently opened issue. There's no visible UI change, so I didn't capture a preview. The claude.ai Gmail, Google Calendar, Google Drive and ProPR connectors need to be authorized in your claude.ai connector settings before they can be used; this task didn't need them. PR: #2887 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
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.
AI Implementation Summary
Closes #41
Model Used: opus
Status: ✅ Implementation Completed
Branch:
ai-fix/41-feat-implement-worker-for-20250722-1039-opus-o9cCommits: ✅ Changes committed (e436e60)
🤖 AI Processing Completed
Execution Details:
Summary:
Implementation Summary
I've successfully implemented the worker functionality for processing follow-up PR comments as requested in issue #41. Here's what was done:
1. Added
processPullRequestCommentJobfunction2. Updated the worker to handle the new job type
createWorkercall to dispatch jobs based on their typeprocessPullRequestCommentJobforprocessPullRequestCommentjobs3. Key implementation details:
The implementation follows the pattern established in the existing code and integrates seamlessly with the daemon's PR comment monitoring functionality from issue #40.
Claude Code Results:
cc2e9911-f994-4f8c-81b5-9226b6079f87📁 Detailed Logs:
Execution logs generated:
cc2e9911-f994-4f8c-81b5-9226b6079f87Log files stored at:
/tmp/claude-logs/issue-41-2025-07-22T08-42-59-757Z-conversation.json/tmp/claude-logs/issue-41-2025-07-22T08-42-59-757Z-output.txt💬 Latest Conversation Messages
Powered by Claude Code v1.0.0
This PR was created automatically by Claude Code after processing issue #41.