Skip to content

Conversation

@doublefx
Copy link

@doublefx doublefx commented Jan 2, 2026

Base Branch

  • This PR targets the develop branch (required for all feature/fix PRs)

Description

Fixes a bug where tasks remained stuck in "human_review" status in the UI after successful merge operations.

Root cause: The worktree implementation_plan.json path was missing the .auto-claude/specs/{specId}/ directory structure, so the plan update after merge wrote to the wrong location.

The fix: Corrects the worktree plan path to include the full spec directory structure:

Related Issue

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 📚 Documentation
  • ♻️ Refactor
  • 🧪 Test

Area

  • Frontend
  • Backend
  • Fullstack

Checklist

  • I've synced with develop branch
  • I've tested my changes locally
  • I've followed the code principles (SOLID, DRY, KISS)
  • My PR is small and focused (< 400 lines ideally) - 3 lines changed

CI/Testing Requirements

  • All CI checks pass
  • All existing tests pass
  • New features include test coverage
  • Bug fixes include regression tests

Feature Toggle

  • N/A - Feature is complete and ready for all users

Breaking Changes

Breaking: No

Summary by CodeRabbit

  • Refactor

    • Moved worktree implementation plan storage to a per-spec directory structure so plans are organized by spec.
  • Bug Fixes

    • Improved reliability when saving plan files by ensuring parent directories are created before write operations.

✏️ Tip: You can customize this high-level summary in your review settings.

The worktree implementation_plan.json path was missing the
.auto-claude/specs/{specId}/ directory structure, causing the
worktree plan to not update after merge operations.

This left tasks stuck in "human_review" in the UI even after
successful merge, because ProjectStore reads the worktree plan
when it exists.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 2, 2026

📝 Walkthrough

Walkthrough

The handlers now place worktree implementation plans under a per-spec directory ({worktreePath}/.auto-claude/specs/{specId} or using project.autoBuildPath), update read/write paths to use that location, and ensure parent directories exist before writing plan files.

Changes

Cohort / File(s) Summary
Worktree plan path & IO
apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
Added worktreeSpecDir derived path ({worktreePath}/.auto-claude/specs/{specId} or project.autoBuildPath); switched non-main worktree plan read/write to that per-spec directory; ensure parent directories are created recursively before writing plan files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #337: Modifies the same worktree-handlers implementation_plan read/write logic to use async/parallel operations and plan-path objects.
  • PR #323: Syncs status between main and worktree plan paths and touches the same plan read/write code paths.
  • PR #286: Adds discovery/operation across per-spec worktree locations and relates to per-spec path determination.

Suggested labels

area/frontend

Suggested reviewers

  • AlexMadera
  • AndyMik90

Poem

🐰 I hop through specs and tidy each nest,
A dot-auto-claude home for every quest,
Plans tucked in pockets, neat and small,
No messy roots — I cheer the call! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: correct worktree plan path in merge handler' directly summarizes the main change: fixing the worktree plan path in the merge handler, which aligns with the core objective of correcting where the implementation_plan.json is written.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36c26cb and 4a496d0.

📒 Files selected for processing (1)
  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: When submitting PRs to the upstream AndyMik90/Auto-Claude repository, always target the `develop` branch, not `main`
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Use git worktrees for isolated agent builds with branches following the naming pattern `auto-claude/{spec-name}`
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Store project-specific data including specs, plans, and QA reports in `.auto-claude/specs/` directory and add to .gitignore
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Use git worktrees for isolated agent builds with branches following the naming pattern `auto-claude/{spec-name}`

Applied to files:

  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
🧬 Code graph analysis (1)
apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts (2)
apps/frontend/scripts/verify-python-bundling.cjs (1)
  • path (8-8)
apps/frontend/src/shared/constants/config.ts (1)
  • AUTO_BUILD_PATHS (81-98)
🔇 Additional comments (3)
apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts (3)

1704-1705: LGTM! Worktree spec directory correctly mirrors main project structure.

The worktreeSpecDir construction properly includes the .auto-claude/specs/{specId}/ directory structure within the worktree, ensuring the plan file is written to the location where ProjectStore expects to find it. This correctly addresses the root cause described in the PR where tasks remained stuck in "human_review" status.


1706-1709: Excellent fix - worktree plan path now includes the full spec directory.

The updated path construction at line 1708 ensures the worktree implementation plan is written to .worktrees/{specId}/.auto-claude/specs/{specId}/implementation_plan.json instead of the incorrect .worktrees/{specId}/implementation_plan.json. This resolves the issue where ProjectStore couldn't find the updated plan after merge operations.


1728-1729: Perfect - directory creation prevents write failures.

The mkdir with { recursive: true } properly ensures the full directory structure exists before attempting to write the plan file. This prevents the ENOENT write failures that were causing the worktree plan updates to silently fail. The placement within the retry loop is correct, ensuring directory existence on each attempt.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @doublefx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical UI bug that prevented tasks from correctly updating their status after a merge. The underlying problem was an improperly constructed file path for the worktree's implementation plan. By correcting this path, the system can now accurately record and reflect task progress, improving the overall user experience and data consistency.

Highlights

  • Bug Fix: This pull request resolves a bug where tasks in the UI would remain stuck in the 'human_review' status even after a successful merge operation.
  • Root Cause Identified: The issue stemmed from an incorrect path used to update the implementation_plan.json file within the worktree. The path was missing the crucial .auto-claude/specs/{specId}/ directory structure.
  • Path Correction: The fix involves correcting the worktree plan path to properly include the full spec directory structure, ensuring the plan updates are written to the correct location.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves a bug where tasks were getting stuck in the 'human_review' status after a merge operation. The root cause was correctly identified as an incorrect path being used to update the implementation_plan.json file within the worktree. The fix is direct and correct, ensuring the path includes the necessary .auto-claude/specs/{specId}/ directory structure. The change is minimal, well-commented, and directly addresses the problem. The code quality is excellent, and I have no further suggestions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3086233 and 36c26cb.

📒 Files selected for processing (1)
  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: When submitting PRs to the upstream AndyMik90/Auto-Claude repository, always target the `develop` branch, not `main`
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Use git worktrees for isolated agent builds with branches following the naming pattern `auto-claude/{spec-name}`
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Store project-specific data including specs, plans, and QA reports in `.auto-claude/specs/` directory and add to .gitignore
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Use git worktrees for isolated agent builds with branches following the naming pattern `auto-claude/{spec-name}`

Applied to files:

  • apps/frontend/src/main/ipc-handlers/task/worktree-handlers.ts

@MikeeBuilds MikeeBuilds added bug Something isn't working area/backend This is backend only labels Jan 2, 2026
@AndyMik90 AndyMik90 self-assigned this Jan 2, 2026
@MikeeBuilds MikeeBuilds added the size/XS Extra small (< 10 lines) label Jan 3, 2026
- Add fsPromises.mkdir() with recursive: true before writeFile
- Prevents silent ENOENT failures when .auto-claude/specs/{specId} doesn't exist
- Addresses CodeRabbit review comment about missing directory creation
@doublefx
Copy link
Author

doublefx commented Jan 3, 2026

CodeRabbit Review - Fix Applied

I've addressed the CodeRabbit review comment about missing parent directory creation.

Issue Identified by CodeRabbit:

The code attempted to write to .worktrees/{specId}/.auto-claude/specs/{specId}/implementation_plan.json without ensuring the parent directories exist first. This caused silent failures when:

  • The .auto-claude/specs/{specId}/ directory didn't exist in the worktree
  • ENOENT errors were treated as success (line 1739-1740)
  • The plan file was never actually written, leaving tasks stuck in "human_review" status

Fix Applied (Commit fd94471):

// Ensure parent directory exists before writing
await fsPromises.mkdir(path.dirname(planPath), { recursive: true });
await fsPromises.writeFile(planPath, JSON.stringify(plan, null, 2));

What this does:

  • Creates the .auto-claude/specs/{specId}/ directory structure if it doesn't exist
  • Uses { recursive: true } to create all intermediate directories
  • Prevents ENOENT write failures that were silently ignored

Why the ENOENT handling is still needed:
The ENOENT check (lines 1739-1740) handles the read operation (line 1719), not the write. If the plan file doesn't exist to read, that's okay - we just skip updating it. This is intentional for worktrees where the plan might not exist yet.

With the mkdir fix in place, the directory will exist, so subsequent writes will succeed instead of silently failing.

Testing:

✅ Build succeeds
✅ No TypeScript errors
✅ Code follows the same pattern used elsewhere in the codebase for ensuring directories exist before file writes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/backend This is backend only bug Something isn't working size/XS Extra small (< 10 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants