-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix Windows UTF-8 encoding errors across entire backend (251 instances) #782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Fix Windows UTF-8 encoding errors across entire backend (251 instances) #782
Conversation
- Add comprehensive branching strategy documentation - Explain main, develop, feature, fix, release, and hotfix branches - Clarify that all PRs should target develop (not main) - Add release process documentation for maintainers - Update PR process to branch from develop - Expand table of contents with new sections
* refactor: restructure project to Apps/frontend and Apps/backend - Move auto-claude-ui to Apps/frontend with feature-based architecture - Move auto-claude to Apps/backend - Switch from pnpm to npm for frontend - Update Node.js requirement to v24.12.0 LTS - Add pre-commit hooks for lint, typecheck, and security audit - Add commit-msg hook for conventional commits - Fix CommonJS compatibility issues (postcss.config, postinstall scripts) - Update README with comprehensive setup and contribution guidelines - Configure ESLint to ignore .cjs files - 0 npm vulnerabilities Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * feat(refactor): clean code and move to npm * feat(refactor): clean code and move to npm * chore: update to v2.7.0, remove Docker deps (LadybugDB is embedded) * feat: v2.8.0 - update workflows and configs for Apps/ structure, npm * fix: resolve Python lint errors (F401, I001) * fix: update test paths for Apps/backend structure * fix: add missing facade files and update paths for Apps/backend structure - Fix ruff lint error I001 in auto_claude_tools.py - Create missing facade files to match upstream (agent, ci_discovery, critique, etc.) - Update test paths from auto-claude/ to Apps/backend/ - Update .pre-commit-config.yaml paths for Apps/ structure - Add pytest to pre-commit hooks (skip slow/integration/Windows-incompatible tests) - Fix Unicode encoding in test_agent_architecture.py for Windows Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> * feat: improve readme * fix: new path * fix: correct release workflow and docs for Apps/ restructure - Fix ARM64 macOS build: pnpm → npm, auto-claude-ui → Apps/frontend - Fix artifact upload paths in release.yml - Update Node.js version to 24 for consistency - Update CLI-USAGE.md with Apps/backend paths - Update RELEASE.md with Apps/frontend/package.json paths 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: rename Apps/ to apps/ and fix backend path resolution - Rename Apps/ folder to apps/ for consistency with JS/Node conventions - Update all path references across CI/CD workflows, docs, and config files - Fix frontend Python path resolver to look for 'backend' instead of 'auto-claude' - Update path-resolver.ts to correctly find apps/backend in development mode This completes the Apps restructure from PR AndyMik90#122 and prepares for v2.8.0 release. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(electron): correct preload script path from .js to .mjs electron-vite builds the preload script as ESM (index.mjs) but the main process was looking for CommonJS (index.js). This caused the preload to fail silently, making the app fall back to browser mock mode with fake data and non-functional IPC handlers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * - Introduced `dev:debug` script to enable debugging during development. - Added `dev:mcp` script for running the frontend in MCP mode. These enhancements streamline the development process for frontend developers. * refactor(memory): make Graphiti memory mandatory and remove Docker dependency Memory is now a core component of Auto Claude rather than optional: - Python 3.12+ is required for the backend (not just memory layer) - Graphiti is enabled by default in .env.example - Removed all FalkorDB/Docker references (migrated to embedded LadybugDB) - Deleted guides/DOCKER-SETUP.md and docker-handlers.ts - Updated onboarding UI to remove "optional" language - Updated all documentation to reflect LadybugDB architecture 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat: add cross-platform Windows support for npm scripts - Add scripts/install-backend.js for cross-platform Python venv setup - Auto-detects Python 3.12 (py -3.12 on Windows, python3.12 on Unix) - Handles platform-specific venv paths - Add scripts/test-backend.js for cross-platform pytest execution - Update package.json to use Node.js scripts instead of shell commands - Update CONTRIBUTING.md with correct paths and instructions: - apps/backend/ and apps/frontend/ paths - Python 3.12 requirement (memory system now required) - Platform-specific install commands (winget, brew, apt) - npm instead of pnpm - Quick Start section with npm run install:all 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * remove doc * fix(frontend): correct Ollama detector script path after apps restructure The Ollama status check was failing because memory-handlers.ts was looking for ollama_model_detector.py at auto-claude/ but the script is now at apps/backend/ after the directory restructure. This caused "Ollama not running" to display even when Ollama was actually running and accessible. * chore: bump version to 2.7.2 Downgrade version from 2.8.0 to 2.7.2 as the Apps/ restructure is better suited as a patch release rather than a minor release. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * chore: update package-lock.json for Windows compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * docs(contributing): add hotfix workflow and update paths for apps/ structure Add Git Flow hotfix workflow documentation with step-by-step guide and ASCII diagram showing the branching strategy. Update all paths from auto-claude/auto-claude-ui to apps/backend/apps/frontend and migrate package manager references from pnpm to npm to match the new project structure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(ci): remove duplicate ARM64 build from Intel runner The Intel runner was building both x64 and arm64 architectures, while a separate ARM64 runner also builds arm64 natively. This caused duplicate ARM64 builds, wasting CI resources. Now each runner builds only its native architecture: - Intel runner: x64 only - ARM64 runner: arm64 only 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Alex Madera <[email protected]> Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <[email protected]>
…Mik90#141) * feat(ollama): add real-time download progress tracking for model downloads Implement comprehensive download progress tracking with: - NDJSON parsing for streaming progress data from Ollama API - Real-time speed calculation (MB/s, KB/s, B/s) with useRef for delta tracking - Time remaining estimation based on download speed - Animated progress bars in OllamaModelSelector component - IPC event streaming from main process to renderer - Proper listener management with cleanup functions Changes: - memory-handlers.ts: Parse NDJSON from Ollama stderr, emit progress events - OllamaModelSelector.tsx: Display progress bars with speed and time remaining - project-api.ts: Implement onDownloadProgress listener with cleanup - ipc.ts types: Define onDownloadProgress listener interface - infrastructure-mock.ts: Add mock implementation for browser testing This allows users to see real-time feedback when downloading Ollama models, including percentage complete, current download speed, and estimated time remaining. * test: add focused test coverage for Ollama download progress feature Add unit tests for the critical paths of the real-time download progress tracking: - Progress calculation tests (52 tests): Speed/time/percentage calculations with comprehensive edge case coverage (zero speeds, NaN, Infinity, large numbers) - NDJSON parser tests (33 tests): Streaming JSON parsing from Ollama, buffer management for incomplete lines, error handling All 562 unit tests passing with clean dependencies. Tests focus on critical mathematical logic and data processing - the most important paths that need verification. Test coverage: ✅ Speed calculation and formatting (B/s, KB/s, MB/s) ✅ Time remaining calculations (seconds, minutes, hours) ✅ Percentage clamping (0-100%) ✅ NDJSON streaming with partial line buffering ✅ Invalid JSON handling ✅ Real Ollama API responses ✅ Multi-chunk streaming scenarios * docs: add comprehensive JSDoc docstrings for Ollama download progress feature - Enhanced OllamaModelSelector component with detailed JSDoc * Documented component props, behavior, and usage examples * Added docstrings to internal functions (checkInstalledModels, handleDownload, handleSelect) * Explained progress tracking algorithm and useRef usage - Improved memory-handlers.ts documentation * Added docstring to main registerMemoryHandlers function * Documented all Ollama-related IPC handlers (check-status, list-embedding-models, pull-model) * Added JSDoc to executeOllamaDetector helper function * Documented interface types (OllamaStatus, OllamaModel, OllamaEmbeddingModel, OllamaPullResult) * Explained NDJSON parsing and progress event structure - Enhanced test file documentation * Added docstrings to NDJSON parser test utilities with algorithm explanation * Documented all calculation functions (speed, time, percentage) * Added detailed comments on formatting and bounds-checking logic - Improved overall code maintainability * Docstring coverage now meets 80%+ threshold for code review * Clear explanation of progress tracking implementation details * Better context for future maintainers working with download streaming * feat: add batch task creation and management CLI commands - Handle batch task creation from JSON files - Show status of all specs in project - Cleanup tool for completed specs - Full integration with new apps/backend structure - Compatible with implementation_plan.json workflow * test: add batch task test file and testing checklist - batch_test.json: Sample tasks for testing batch creation - TESTING_CHECKLIST.md: Comprehensive testing guide for Ollama and batch tasks - Includes UI testing steps, CLI testing steps, and edge cases - Ready for manual and automated testing * chore: update package-lock.json to match v2.7.2 * test: update checklist with verification results and architecture validation * docs: add comprehensive implementation summary for Ollama + Batch features * docs: add comprehensive Phase 2 testing guide with checklists and procedures * docs: add NEXT_STEPS guide for Phase 2 testing * fix: resolve merge conflict in project-api.ts from Ollama feature cherry-pick * fix: remove duplicate Ollama check status handler registration * test: update checklist with Phase 2 bug findings and fixes --------- Co-authored-by: ray <[email protected]>
Implemented promise queue pattern in PythonEnvManager to handle concurrent initialization requests. Previously, multiple simultaneous requests (e.g., startup + merge) would fail with "Already initializing" error. Also fixed parsePythonCommand() to handle file paths with spaces by checking file existence before splitting on whitespace. Changes: - Added initializationPromise field to queue concurrent requests - Split initialize() into public and private _doInitialize() - Enhanced parsePythonCommand() with existsSync() check Co-authored-by: Joris Slagter <[email protected]>
) Removes the legacy 'auto-claude' path from the possiblePaths array in agent-process.ts. This path was from before the monorepo restructure (v2.7.2) and is no longer needed. The legacy path was causing spec_runner.py to be looked up at the wrong location: - OLD (wrong): /path/to/auto-claude/auto-claude/runners/spec_runner.py - NEW (correct): /path/to/apps/backend/runners/spec_runner.py This aligns with the new monorepo structure where all backend code lives in apps/backend/. Fixes AndyMik90#147 Co-authored-by: Joris Slagter <[email protected]>
* fix: Linear API authentication and GraphQL types - Remove Bearer prefix from Authorization header (Linear API keys are sent directly) - Change GraphQL variable types from String! to ID! for teamId and issue IDs - Improve error handling to show detailed Linear API error messages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: Radix Select empty value error in Linear import modal Use '__all__' sentinel value instead of empty string for "All projects" option, as Radix Select does not allow empty string values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat: add CodeRabbit configuration file Introduce a new .coderabbit.yaml file to configure CodeRabbit settings, including review profiles, automatic review options, path filters, and specific instructions for different file types. This enhances the code review process by providing tailored guidelines for Python, TypeScript, and test files. * fix: correct GraphQL types for Linear team queries Linear API uses different types for different queries: - team(id:) expects String! - issues(filter: { team: { id: { eq: } } }) expects ID! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: refresh task list after Linear import Call loadTasks() after successful Linear import to update the kanban board without requiring a page reload. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * cleanup * cleanup * fix: address CodeRabbit review comments for Linear integration - Fix unsafe JSON parsing: check response.ok before parsing JSON to handle non-JSON error responses (e.g., 503 from proxy) gracefully - Use ID! type instead of String! for teamId in LINEAR_GET_PROJECTS query for GraphQL type consistency - Remove debug console.log (ESLint config only allows warn/error) - Refresh task list on partial import success (imported > 0) instead of requiring full success - Fix pre-existing TypeScript and lint issues blocking commit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * version sync logic * lints for develop branch * chore: update CI workflow to include develop branch - Modified the CI configuration to trigger on pushes and pull requests to both main and develop branches, enhancing the workflow for development and integration processes. * fix: update project directory auto-detection for apps/backend structure The project directory auto-detection was checking for the old `auto-claude/` directory name but needed to check for `apps/backend/`. When running from `apps/backend/`, the directory name is `backend` not `auto-claude`, so the check would fail and `project_dir` would incorrectly remain as `apps/backend/` instead of resolving to the project root (2 levels up). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: use GraphQL variables instead of string interpolation in LINEAR_GET_ISSUES Replace direct string interpolation of teamId and linearProjectId with proper GraphQL variables. This prevents potential query syntax errors if IDs contain special characters like double quotes, and aligns with the variable-based approach used elsewhere in the file. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(ui): correct logging level and await loadTasks on import complete - Change console.warn to console.log for import success messages (warn is incorrect severity for normal completion) - Make onImportComplete callback async and await loadTasks() to prevent potential unhandled promise rejections Applies CodeRabbit review feedback across 3 LinearTaskImportModal usages. * fix(hooks): use POSIX-compliant find instead of bash glob The pre-commit hook uses #!/bin/sh but had bash-specific ** glob pattern for staging ruff-formatted files. The ** pattern only works in bash with globstar enabled - in POSIX sh it expands literally and won't match subdirectories, causing formatted files in nested directories to not be staged. --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
…_progress When a user drags a running task back to Planning (or any other column), the process was not being stopped, leaving a "ghost" process that prevented deletion with "Cannot delete a running task" error. Now the task process is automatically killed when status changes away from in_progress, ensuring the process state stays in sync with the UI.
* feat: add UI scale feature * refactor: extract UI scale bounds to shared constants * fix: duplicated import
…90#154) * fix: analyzer Python compatibility and settings integration Fixes project index analyzer failing with TypeError on Python type hints. Changes: - Added 'from __future__ import annotations' to all analysis modules - Fixed project discovery to support new analyzer JSON format - Read Python path directly from settings.json instead of pythonEnvManager - Added stderr/stdout logging for analyzer debugging Resolves 'Discovered 0 files' and 'TypeError: unsupported operand type' issues. * auto-claude: subtask-1-1 - Hide status badge when execution phase badge is showing When a task has an active execution (planning, coding, etc.), the execution phase badge already displays the correct state with a spinner. The status badge was also rendering, causing duplicate/confusing badges (e.g., both "Planning" and "Pending" showing at the same time). This fix wraps the status badge in a conditional that only renders when there's no active execution, eliminating the redundant badge display. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(ipc): remove unused pythonEnvManager parameter and fix ES6 import Address CodeRabbit review feedback: - Remove unused pythonEnvManager parameter from registerProjectContextHandlers and registerContextHandlers (the code reads Python path directly from settings.json instead) - Replace require('electron').app with proper ES6 import for consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * chore(lint): fix import sorting in analysis module Run ruff --fix to resolve I001 lint errors after merging develop. All 23 files in apps/backend/analysis/ now have properly sorted imports. --------- Co-authored-by: Joris Slagter <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]>
* fix(core): add task persistence, terminal handling, and HTTP 300 fixes Consolidated bug fixes from PRs AndyMik90#168, AndyMik90#170, AndyMik90#171: - Task persistence (AndyMik90#168): Scan worktrees for tasks on app restart to prevent loss of in-progress work and wasted API credits. Tasks in .worktrees/*/specs are now loaded and deduplicated with main. - Terminal buttons (AndyMik90#170): Fix "Open Terminal" buttons silently failing on macOS by properly awaiting createTerminal() Promise. Added useTerminalHandler hook with loading states and error display. - HTTP 300 errors (AndyMik90#171): Handle branch/tag name collisions that cause update failures. Added validation script to prevent conflicts before releases and user-friendly error messages with manual download links. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(platform): add path resolution, spaces handling, and XDG support This commit consolidates multiple bug fixes from community PRs: - PR AndyMik90#187: Path resolution fix - Update path detection to find apps/backend instead of legacy auto-claude directory after v2.7.2 restructure - PR AndyMik90#182/AndyMik90#155: Python path spaces fix - Improve parsePythonCommand() to handle quoted paths and paths containing spaces without splitting - PR AndyMik90#161: Ollama detection fix - Add new apps structure paths for ollama_model_detector.py script discovery - PR AndyMik90#160: AppImage support - Add XDG Base Directory compliant paths for Linux sandboxed environments (AppImage, Flatpak, Snap). New files: - config-paths.ts: XDG path utilities - fs-utils.ts: Filesystem utilities with fallback support - PR AndyMik90#159: gh CLI PATH fix - Add getAugmentedEnv() utility to include common binary locations (Homebrew, snap, local) in PATH for child processes. Fixes gh CLI not found when app launched from Finder/Dock. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: address CodeRabbit/Cursor review comments on PR AndyMik90#185 Fixes from code review: - http-client.ts: Use GITHUB_CONFIG instead of hardcoded owner in HTTP 300 error message - validate-release.js: Fix substring matching bug in branch detection that could cause false positives (e.g., v2.7 matching v2.7.2) - bump-version.js: Remove unnecessary try-catch wrapper (exec() already exits on failure) - execution-handlers.ts: Capture original subtask status before mutation for accurate logging - fs-utils.ts: Add error handling to safeWriteFile with proper logging Dismissed as trivial/not applicable: - config-paths.ts: Exhaustive switch check (over-engineering) - env-utils.ts: PATH priority documentation (existing comments sufficient) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: address additional CodeRabbit review comments (round 2) Fixes from second round of code review: - fs-utils.ts: Wrap test file cleanup in try-catch for Windows file locking - fs-utils.ts: Add error handling to safeReadFile for consistency with safeWriteFile - http-client.ts: Use GITHUB_CONFIG in fetchJson (missed in first round) - validate-release.js: Exclude symbolic refs (origin/HEAD -> origin/main) from branch check - python-detector.ts: Return cleanPath instead of pythonPath for empty input edge case Dismissed as trivial/not applicable: - execution-handlers.ts: Redundant checkSubtasksCompletion call (micro-optimization) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
* chore: update README version to 2.7.1 Updated the version badge and download links in the README to reflect the new release version 2.7.1, ensuring users have the correct information for downloading the latest builds. * feat(releases): add beta release system with user opt-in Implements a complete beta release workflow that allows users to opt-in to receiving pre-release versions. This enables testing new features before they're included in stable releases. Changes: - Add beta-release.yml workflow for creating beta releases from develop - Add betaUpdates setting with UI toggle in Settings > Updates - Add update channel support to electron-updater (beta vs latest) - Extract shared settings-utils.ts to reduce code duplication - Add prepare-release.yml workflow for automated release preparation - Document beta release process in CONTRIBUTING.md and RELEASE.md Users can enable beta updates in Settings > Updates, and maintainers can trigger beta releases via the GitHub Actions workflow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * workflow update --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
* chore: update README version to 2.7.1 Updated the version badge and download links in the README to reflect the new release version 2.7.1, ensuring users have the correct information for downloading the latest builds. * feat(releases): add beta release system with user opt-in Implements a complete beta release workflow that allows users to opt-in to receiving pre-release versions. This enables testing new features before they're included in stable releases. Changes: - Add beta-release.yml workflow for creating beta releases from develop - Add betaUpdates setting with UI toggle in Settings > Updates - Add update channel support to electron-updater (beta vs latest) - Extract shared settings-utils.ts to reduce code duplication - Add prepare-release.yml workflow for automated release preparation - Document beta release process in CONTRIBUTING.md and RELEASE.md Users can enable beta updates in Settings > Updates, and maintainers can trigger beta releases via the GitHub Actions workflow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * workflow update * ci(github): update Discord link and redirect feature requests to discussions Update Discord invite link to correct URL (QhRnz9m5HE) across all GitHub templates and workflows. Redirect feature requests from issue template to GitHub Discussions for better community engagement. Changes: - config.yml: Add feature request link to Discussions, fix Discord URL - question.yml: Update Discord link in pre-question guidance - welcome.yml: Update Discord link in first-time contributor message --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
- Change branch reference from main to develop - Fix contribution guide link to use full URL - Remove hyphen from "Auto Claude" in welcome message
…tup (AndyMik90#180 AndyMik90#167) (AndyMik90#208) This fixes critical bug where macOS users with default Python 3.9.6 couldn't use Auto-Claude because claude-agent-sdk requires Python 3.10+. Root Cause: - Auto-Claude doesn't bundle Python, relies on system Python - python-detector.ts accepted any Python 3.x without checking minimum version - macOS ships with Python 3.9.6 by default (incompatible) - GitHub Actions runners didn't explicitly set Python version Changes: 1. python-detector.ts: - Added getPythonVersion() to extract version from command - Added validatePythonVersion() to check if >= 3.10.0 - Updated findPythonCommand() to skip Python < 3.10 with clear error messages 2. python-env-manager.ts: - Import and use findPythonCommand() (already has version validation) - Simplified findSystemPython() to use shared validation logic - Updated error message from "Python 3.9+" to "Python 3.10+" with download link 3. .github/workflows/release.yml: - Added Python 3.11 setup to all 4 build jobs (macOS Intel, macOS ARM64, Windows, Linux) - Ensures consistent Python version across all platforms during build Impact: - macOS users with Python 3.9 now see clear error with download link - macOS users with Python 3.10+ work normally - CI/CD builds use consistent Python 3.11 - Prevents "ModuleNotFoundError: dotenv" and dependency install failures Fixes AndyMik90#180, AndyMik90#167 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 4.5 <[email protected]>
* feat: Add OpenRouter as LLM/embedding provider Add OpenRouter provider support for Graphiti memory integration, enabling access to multiple LLM providers through a single API. Changes: Backend: - Created openrouter_llm.py: OpenRouter LLM provider using OpenAI-compatible API - Created openrouter_embedder.py: OpenRouter embedder provider - Updated config.py: Added OpenRouter to provider enums and configuration - New fields: openrouter_api_key, openrouter_base_url, openrouter_llm_model, openrouter_embedding_model - Validation methods updated for OpenRouter - Updated factory.py: Added OpenRouter to LLM and embedder factories - Updated provider __init__.py files: Exported new OpenRouter functions Frontend: - Updated project.ts types: Added 'openrouter' to provider type unions - GraphitiProviderConfig extended with OpenRouter fields - Updated GraphitiStep.tsx: Added OpenRouter to provider arrays - LLM_PROVIDERS: 'Multi-provider aggregator' - EMBEDDING_PROVIDERS: 'OpenAI-compatible embeddings' - Added OpenRouter API key input field with show/hide toggle - Link to https://openrouter.ai/keys - Updated env-handlers.ts: OpenRouter .env generation and parsing - Template generation for OPENROUTER_* variables - Parsing from .env files with proper type casting Documentation: - Updated .env.example with OpenRouter section - Configuration examples - Popular model recommendations - Example configuration (AndyMik90#6) Fixes AndyMik90#92 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * refactor: address CodeRabbit review comments for OpenRouter - Add globalOpenRouterApiKey to settings types and store updates - Initialize openrouterApiKey from global settings - Update documentation to include OpenRouter in provider lists - Add OpenRouter handling to get_embedding_dimension() method - Add openrouter to provider cleanup list - Add OpenRouter to get_available_providers() function - Clarify Legacy comment for openrouterLlmModel These changes complete the OpenRouter integration by ensuring proper settings persistence and provider detection across the application. * fix: apply ruff formatting to OpenRouter code - Break long error message across multiple lines - Format provider list with one item per line - Fixes lint CI failure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.5 <[email protected]>
…Mik90#209) Implements distributed file-based locking for spec number coordination across main project and all worktrees. Previously, parallel spec creation could assign the same number to different specs (e.g., 042-bmad-task and 042-gitlab-integration both using number 042). The fix adds SpecNumberLock class that: - Acquires exclusive lock before calculating spec numbers - Scans ALL locations (main project + worktrees) for global maximum - Creates spec directories atomically within the lock - Handles stale locks via PID-based detection with 30s timeout Applied to both Python backend (spec_runner.py flow) and TypeScript frontend (ideation conversion, GitHub/GitLab issue import). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <[email protected]>
* fix(ideation): add missing event forwarders for status sync - Add event forwarders in ideation-handlers.ts for progress, log, type-complete, type-failed, complete, error, and stopped events - Fix ideation-type-complete to load actual ideas array from JSON files instead of emitting only the count Resolves UI getting stuck at 0/3 complete during ideation generation. * fix(ideation): fix UI not updating after actions - Fix getIdeationSummary to count only active ideas (exclude dismissed/archived) This ensures header stats match the visible ideas count - Add transformSessionFromSnakeCase to properly transform session data from backend snake_case to frontend camelCase on ideation-complete event - Transform raw session before emitting ideation-complete event Resolves header showing stale counts after dismissing/deleting ideas. * fix(ideation): improve type safety and async handling in ideation type completion - Replace synchronous readFileSync with async fsPromises.readFile in ideation-type-complete handler - Wrap async file read in IIFE with proper error handling to prevent unhandled promise rejections - Add type validation for IdeationType with VALID_IDEATION_TYPES set and isValidIdeationType guard - Add validateEnabledTypes function to filter out invalid type values and log dropped entries - Handle ENOENT separately * fix(ideation): improve generation state management and error handling - Add explicit isGenerating flag to prevent race conditions during async operations - Implement 5-minute timeout for generation with automatic cleanup and error state - Add ideation-stopped event emission when process is intentionally killed - Replace console.warn/error with proper ideation-error events in agent-queue - Add resetGeneratingTypes helper to transition all generating types to a target state - Filter out dismissed/ * refactor(ideation): improve event listener cleanup and timeout management - Extract event handler functions in ideation-handlers.ts to enable proper cleanup - Return cleanup function from registerIdeationHandlers to remove all listeners - Replace single generationTimeoutId with Map to support multiple concurrent projects - Add clearGenerationTimeout helper to centralize timeout cleanup logic - Extract loadIdeationType IIFE to named function for better error context - Enhance error logging with projectId, * refactor: use async file read for ideation and roadmap session loading - Replace synchronous readFileSync with async fsPromises.readFile - Prevents blocking the event loop during file operations - Consistent with async pattern used elsewhere in the codebase - Improved error handling with proper event emission * fix(agent-queue): improve roadmap completion handling and error reporting - Add transformRoadmapFromSnakeCase to convert backend snake_case to frontend camelCase - Transform raw roadmap data before emitting roadmap-complete event - Add roadmap-error emission for unexpected errors during completion - Add roadmap-error emission when project path is unavailable - Remove duplicate ideation-type-complete emission from error handler (event already emitted in loadIdeationType) - Update error log message
Adds 'from __future__ import annotations' to spec/discovery.py for Python 3.9+ compatibility with type hints. This completes the Python compatibility fixes that were partially applied in previous commits. All 26 analysis and spec Python files now have the future annotations import. Related: AndyMik90#128 Co-authored-by: Joris Slagter <[email protected]>
…#241) * fix: resolve Python detection and backend packaging issues - Fix backend packaging path (auto-claude -> backend) to match path-resolver.ts expectations - Add future annotations import to config_parser.py for Python 3.9+ compatibility - Use findPythonCommand() in project-context-handlers to prioritize Homebrew Python - Improve Python detection to prefer Homebrew paths over system Python on macOS This resolves the following issues: - 'analyzer.py not found' error due to incorrect packaging destination - TypeError with 'dict | None' syntax on Python < 3.10 - Wrong Python interpreter being used (system Python instead of Homebrew Python 3.10+) Tested on macOS with packaged app - project index now loads successfully. * refactor: address PR review feedback - Extract findHomebrewPython() helper to eliminate code duplication between findPythonCommand() and getDefaultPythonCommand() - Remove hardcoded version-specific paths (python3.12) and rely only on generic Homebrew symlinks for better maintainability - Remove unnecessary 'from __future__ import annotations' from config_parser.py since backend requires Python 3.12+ where union types are native These changes make the code more maintainable, less fragile to Python version changes, and properly reflect the project's Python 3.12+ requirement.
…#250) * feat(github): add GitHub automation system for issues and PRs Implements comprehensive GitHub automation with three major components: 1. Issue Auto-Fix: Automatically creates specs from labeled issues - AutoFixButton component with progress tracking - useAutoFix hook for config and queue management - Backend handlers for spec creation from issues 2. GitHub PRs Tool: AI-powered PR review sidebar - New sidebar tab (Cmd+Shift+P) alongside GitHub Issues - PRList/PRDetail components for viewing PRs - Review system with findings by severity - Post review comments to GitHub 3. Issue Triage: Duplicate/spam/feature-creep detection - Triage handlers with label application - Configurable detection thresholds Also adds: - Debug logging (DEBUG=true) for all GitHub handlers - Backend runners/github module with orchestrator - AI prompts for PR review, triage, duplicate/spam detection - dev:debug npm script for development with logging 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(github-runner): resolve import errors for direct script execution Changes runner.py and orchestrator.py to handle both: - Package import: `from runners.github import ...` - Direct script: `python runners/github/runner.py` Uses try/except pattern for relative vs direct imports. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(github): correct argparse argument order for runner.py Move --project global argument before subcommand so argparse can correctly parse it. Fixes "unrecognized arguments: --project" error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * logs when debug mode is on * refactor(github): extract service layer and fix linting errors Major refactoring to improve maintainability and code quality: Backend (Python): - Extracted orchestrator.py (2,600 → 835 lines, 68% reduction) into 7 service modules: - prompt_manager.py: Prompt template management - response_parsers.py: AI response parsing - pr_review_engine.py: PR review orchestration - triage_engine.py: Issue triage logic - autofix_processor.py: Auto-fix workflow - batch_processor.py: Batch issue handling - Fixed 18 ruff linting errors (F401, C405, C414, E741): - Removed unused imports (BatchValidationResult, AuditAction, locked_json_write) - Optimized collection literals (set([n]) → {n}) - Removed unnecessary list() calls - Renamed ambiguous variable 'l' to 'label' throughout Frontend (TypeScript): - Refactored IPC handlers (19% overall reduction) with shared utilities: - autofix-handlers.ts: 1,042 → 818 lines - pr-handlers.ts: 648 → 543 lines - triage-handlers.ts: 437 lines (no duplication) - Created utils layer: logger, ipc-communicator, project-middleware, subprocess-runner - Split github-store.ts into focused stores: issues, pr-review, investigation, sync-status - Split ReviewFindings.tsx into focused components All imports verified, type checks passing, linting clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
…ndyMik90#250)" (AndyMik90#251) This reverts commit 348de6d.
* Add multilingual support and i18n integration - Implemented i18n framework using `react-i18next` for translation management. - Added support for English and French languages with translation files. - Integrated language selector into settings. - Updated all text strings in UI components to use translation keys. - Ensured smooth language switching with live updates. * Migrate remaining hard-coded strings to i18n system - TaskCard: status labels, review reasons, badges, action buttons - PhaseProgressIndicator: execution phases, progress labels - KanbanBoard: drop zone, show archived, tooltips - CustomModelModal: dialog title, description, labels - ProactiveSwapListener: account switch notifications - AgentProfileSelector: phase labels, custom configuration - GeneralSettings: agent framework option Added translation keys for en/fr locales in tasks.json, common.json, and settings.json for complete i18n coverage. * Add i18n support to dialogs and settings components - AddFeatureDialog: form labels, validation messages, buttons - AddProjectModal: dialog steps, form fields, actions - RateLimitIndicator: rate limit notifications - RateLimitModal: account switching, upgrade prompts - AdvancedSettings: updates and notifications sections - ThemeSettings: theme selection labels - Updated dialogs.json locales (en/fr) * Fix truncated 'ready' message in dialogs locales * Fix backlog terminology in i18n locales Change "Planning"/"Planification" to standard PM term "Backlog" * Migrate settings navigation and integration labels to i18n - AppSettings: nav items, section titles, buttons - IntegrationSettings: Claude accounts, auto-switch, API keys labels - Added settings nav/projectSections/integrations translation keys - Added buttons.saving to common translations * Migrate AgentProfileSettings and Sidebar init dialog to i18n - AgentProfileSettings: migrate phase config labels, section title, description, and all hardcoded strings to settings namespace - Sidebar: migrate init dialog strings to dialogs namespace with common buttons from common namespace - Add new translation keys for agent profile settings and update dialog * Migrate AppSettings navigation labels to i18n - Add useTranslation hook to AppSettings.tsx - Replace hardcoded section labels with dynamic translations - Add projectSections translations for project settings nav - Add rerunWizardDescription translation key * Add explicit typing to notificationItems array Import NotificationSettings type and use keyof to properly type the notification item keys, removing manual type assertion.
…AndyMik90#266) * ci: implement enterprise-grade PR quality gates and security scanning * ci: implement enterprise-grade PR quality gates and security scanning * fix:pr comments and improve code * fix: improve commit linting and code quality * Removed the dependency-review job (i added it) * fix: address CodeRabbit review comments - Expand scope pattern to allow uppercase, underscores, slashes, dots - Add concurrency control to cancel duplicate security scan runs - Add explanatory comment for Bandit CLI flags - Remove dependency-review job (requires repo settings) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * docs: update commit lint examples with expanded scope patterns Show slashes and dots in scope examples to demonstrate the newly allowed characters (api/users, package.json) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * chore: remove feature request issue template Feature requests are directed to GitHub Discussions via the issue template config.yml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: address security vulnerabilities in service orchestrator - Fix port parsing crash on malformed docker-compose entries - Fix shell injection risk by using shlex.split() with shell=False Prevents crashes when docker-compose.yml contains environment variables in port mappings (e.g., '${PORT}:8080') and eliminates shell injection vulnerabilities in subprocess execution. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
…90#252) * feat(github): add GitHub automation system for issues and PRs Implements comprehensive GitHub automation with three major components: 1. Issue Auto-Fix: Automatically creates specs from labeled issues - AutoFixButton component with progress tracking - useAutoFix hook for config and queue management - Backend handlers for spec creation from issues 2. GitHub PRs Tool: AI-powered PR review sidebar - New sidebar tab (Cmd+Shift+P) alongside GitHub Issues - PRList/PRDetail components for viewing PRs - Review system with findings by severity - Post review comments to GitHub 3. Issue Triage: Duplicate/spam/feature-creep detection - Triage handlers with label application - Configurable detection thresholds Also adds: - Debug logging (DEBUG=true) for all GitHub handlers - Backend runners/github module with orchestrator - AI prompts for PR review, triage, duplicate/spam detection - dev:debug npm script for development with logging 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(github-runner): resolve import errors for direct script execution Changes runner.py and orchestrator.py to handle both: - Package import: `from runners.github import ...` - Direct script: `python runners/github/runner.py` Uses try/except pattern for relative vs direct imports. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(github): correct argparse argument order for runner.py Move --project global argument before subcommand so argparse can correctly parse it. Fixes "unrecognized arguments: --project" error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * logs when debug mode is on * refactor(github): extract service layer and fix linting errors Major refactoring to improve maintainability and code quality: Backend (Python): - Extracted orchestrator.py (2,600 → 835 lines, 68% reduction) into 7 service modules: - prompt_manager.py: Prompt template management - response_parsers.py: AI response parsing - pr_review_engine.py: PR review orchestration - triage_engine.py: Issue triage logic - autofix_processor.py: Auto-fix workflow - batch_processor.py: Batch issue handling - Fixed 18 ruff linting errors (F401, C405, C414, E741): - Removed unused imports (BatchValidationResult, AuditAction, locked_json_write) - Optimized collection literals (set([n]) → {n}) - Removed unnecessary list() calls - Renamed ambiguous variable 'l' to 'label' throughout Frontend (TypeScript): - Refactored IPC handlers (19% overall reduction) with shared utilities: - autofix-handlers.ts: 1,042 → 818 lines - pr-handlers.ts: 648 → 543 lines - triage-handlers.ts: 437 lines (no duplication) - Created utils layer: logger, ipc-communicator, project-middleware, subprocess-runner - Split github-store.ts into focused stores: issues, pr-review, investigation, sync-status - Split ReviewFindings.tsx into focused components All imports verified, type checks passing, linting clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * fixes during testing of PR * feat(github): implement PR merge, assign, and comment features - Add auto-assignment when clicking "Run AI Review" - Implement PR merge functionality with squash method - Add ability to post comments on PRs - Display assignees in PR UI - Add Approve and Merge buttons when review passes - Update backend gh_client with pr_merge, pr_comment, pr_assign methods - Create IPC handlers for new PR operations - Update TypeScript interfaces and browser mocks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Improve PR review AI * fix(github): use temp files for PR review posting to avoid shell escaping issues When posting PR reviews with findings containing special characters (backticks, parentheses, quotes), the shell command was interpreting them as commands instead of literal text, causing syntax errors. Changed both postPRReview and postPRComment handlers to write the body content to temporary files and use gh CLI's --body-file flag instead of --body with inline content. This safely handles ALL special characters without escaping issues. Fixes shell errors when posting reviews with suggested fixes containing code snippets. * fix(i18n): add missing GitHub PRs translation and document i18n requirements Fixed missing translation key for GitHub PRs feature that was causing "items.githubPRs" to display instead of the proper translated text. Added comprehensive i18n guidelines to CLAUDE.md to ensure all future frontend development follows the translation key pattern instead of using hardcoded strings. Also fixed missing deletePRReview mock function in browser-mock.ts to resolve TypeScript compilation errors. Changes: - Added githubPRs translation to en/navigation.json - Added githubPRs translation to fr/navigation.json - Added Development Guidelines section to CLAUDE.md with i18n requirements - Documented translation file locations and namespace usage patterns - Added deletePRReview mock function to browser-mock.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * fix ui loading * Github PR fixes * improve claude.md * lints/tests * fix(github): handle PRs exceeding GitHub's 20K line diff limit - Add PRTooLargeError exception for large PR detection - Update pr_diff() to catch and raise PRTooLargeError for HTTP 406 errors - Gracefully handle large PRs by skipping full diff and using individual file patches - Add diff_truncated flag to PRContext to track when diff was skipped - Large PRs will now review successfully using per-file diffs instead of failing Fixes issue with PR AndyMik90#252 which has 100+ files exceeding the 20,000 line limit. * fix: implement individual file patch fetching for large PRs The PR review was getting stuck for large PRs (>20K lines) because when we skipped the full diff due to GitHub API limits, we had no code to analyze. The individual file patches were also empty, leaving the AI with just file names and metadata. Changes: - Implemented _get_file_patch() to fetch individual patches via git diff - Updated PR review engine to build composite diff from file patches when diff_truncated is True - Added missing 'state' field to PRContext dataclass - Limits composite diff to first 50 files for very large PRs - Shows appropriate warnings when using reconstructed diffs This allows AI review to proceed with actual code analysis even when the full PR diff exceeds GitHub's limits. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * 1min reduction * docs: add GitHub Sponsors funding configuration Enable the Sponsor button on the repository by adding FUNDING.yml with the AndyMik90 GitHub Sponsors profile. * feat(github-pr): add orchestrating agent for thorough PR reviews Implement a new Opus 4.5 orchestrating agent that performs comprehensive PR reviews regardless of size. Key changes: - Add orchestrator_reviewer.py with strategic review workflow - Add review_tools.py with subagent spawning capabilities - Add pr_orchestrator.md prompt emphasizing thorough analysis - Add pr_security_agent.md and pr_quality_agent.md subagent prompts - Integrate orchestrator into pr_review_engine.py with config flag - Fix critical bug where findings were extracted but not processed (indentation issue in _parse_orchestrator_output) The orchestrator now correctly identifies issues in PRs that were previously approved as "trivial". Testing showed 7 findings detected vs 0 before the fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * i18n * fix(github-pr): restrict pr_reviewer to read-only permissions The PR review agent was using qa_reviewer agent type which has Bash access, allowing it to checkout branches and make changes during review. Created new pr_reviewer agent type with BASE_READ_TOOLS only (no Bash, no writes, no auto-claude tools). This prevents the PR review from accidentally modifying code or switching branches during analysis. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(github-pr): robust category mapping and JSON parsing for PR review The orchestrator PR review was failing to extract findings because: 1. AI generates category names like 'correctness', 'consistency', 'testing' that aren't in our ReviewCategory enum - added flexible mapping 2. JSON sometimes embedded in markdown code blocks (```json) which broke parsing - added code block extraction as first parsing attempt Changes: - Add _CATEGORY_MAPPING dict to map AI categories to valid enum values - Add _map_category() helper function with fallback to QUALITY - Add severity parsing with fallback to MEDIUM - Add markdown code block detection (```json) before raw JSON parsing - Add _extract_findings_from_data() helper to reduce code duplication - Apply same fixes to review_tools.py for subagent parsing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(pr-review): improve post findings UX with batch support and feedback - Fix post findings failing on own PRs by falling back from REQUEST_CHANGES to COMMENT when GitHub returns 422 error - Change status badge to show "Reviewed" instead of "Commented" until findings are actually posted to GitHub - Add success notification when findings are posted (auto-dismisses after 3s) - Add batch posting support: track posted findings, show "Posted" badge, allow posting remaining findings in additional batches - Show loading state on button while posting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(github): resolve stale timestamp and null author bugs - Fix stale timestamp in batch_issues.py: Move updated_at assignment BEFORE to_dict() serialization so the saved JSON contains the correct timestamp instead of the old value - Fix AttributeError in context_gatherer.py: Handle null author/user fields when GitHub API returns null for deleted/suspended users instead of an empty object 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(security): address all high and medium severity PR review findings HIGH severity fixes: - Command Injection in autofix-handlers.ts: Use execFileSync with args array - Command Injection in pr-handlers.ts (3 locations): Use execFileSync + validation - Command Injection in triage-handlers.ts: Use execFileSync + label validation - Token Exposure in bot_detection.py: Pass token via GH_TOKEN env var MEDIUM severity fixes: - Environment variable leakage in subprocess-runner.ts: Filter to safe vars only - Debug logging in subprocess-runner.ts: Only log in development mode - Delimiter escape bypass in sanitize.py: Use regex pattern for variations - Insecure file permissions in trust.py: Use os.open with 0o600 mode - No file locking in learning.py: Use FileLock + atomic_write utilities - Bare except in confidence.py: Log error with specific exception info - Fragile module import in pr_review_engine.py: Import at module level - State transition validation in models.py: Enforce can_transition_to() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * PR followup * fix(security): add usedforsecurity=False to MD5 hash calls MD5 is used for generating unique IDs/cache keys, not for security purposes. Adding usedforsecurity=False resolves Bandit B324 warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(security): address all high-priority PR review findings Fixes 5 high-priority issues from Auto Claude PR Review: 1. orchestrator_reviewer.py: Token budget tracking now increments total_tokens from API response usage data 2. pr_review_engine.py: Async exceptions now re-raise RuntimeError instead of silently returning empty results 3. batch_issues.py: IssueBatch.save() now uses locked_json_write for atomic file operations with file locking 4. project-middleware.ts: Added validateProjectPath() to prevent path traversal attacks (checks absolute, no .., exists, is dir) 5. orchestrator.py: Exception handling now logs full traceback and preserves exception type/context in error messages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(security): address all high-priority PR review findings Fixes 5 high-priority issues from Auto Claude PR Review: 1. orchestrator_reviewer.py: Token budget tracking now increments total_tokens from API response usage data 2. pr_review_engine.py: Async exceptions now re-raise RuntimeError instead of silently returning empty results 3. batch_issues.py: IssueBatch.save() now uses locked_json_write for atomic file operations with file locking 4. project-middleware.ts: Added validateProjectPath() to prevent path traversal attacks (checks absolute, no .., exists, is dir) 5. orchestrator.py: Exception handling now logs full traceback and preserves exception type/context in error messages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(ui): add PR status labels to list view Add secondary status badges to the PR list showing review state at a glance: - "Changes Requested" (warning) - PRs with blocking issues (critical/high) - "Ready to Merge" (green) - PRs with only non-blocking suggestions - "Ready for Follow-up" (blue) - PRs with new commits since last review The "Ready for Follow-up" badge uses a cached new commits check from the store, only shown after the detail view confirms new commits via SHA comparison. This prevents false positives from PR updatedAt timestamp changes (which can happen from comments, labels, etc). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * PR labels * auto-claude: Initialize subtask-based implementation plan - Workflow type: feature - Phases: 3 - Subtasks: 6 - Ready for autonomous implementation --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
…yMik90#272) Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 4.0.15 to 4.0.16. - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v4.0.16/packages/vitest) --- updated-dependencies: - dependency-name: vitest dependency-version: 4.0.16 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@electron/rebuild](https://github.com/electron/rebuild) from 3.7.2 to 4.0.2. - [Release notes](https://github.com/electron/rebuild/releases) - [Commits](electron/rebuild@v3.7.2...v4.0.2) --- updated-dependencies: - dependency-name: "@electron/rebuild" dependency-version: 4.0.2 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andy <[email protected]>
Co-authored-by: danielfrey63 <[email protected]> Co-authored-by: Andy <[email protected]>
* fix(planning): accept bug_fix workflow_type alias * style(planning): ruff format * fix: refatored common logic * fix: remove ruff errors * fix: remove duplicate _normalize_workflow_type method Remove the incorrectly placed duplicate method inside ContextLoader class. The module-level function is the correct implementation being used. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: danielfrey63 <[email protected]> Co-authored-by: Andy <[email protected]> Co-authored-by: AndyMik90 <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]>
…ow (AndyMik90#276) When dry_run=true, the workflow skipped creating the version tag but build jobs still tried to checkout that non-existent tag, causing all 4 platform builds to fail with "git failed with exit code 1". Now build jobs checkout develop branch for dry runs while still using the version tag for real releases. Closes: GitHub Actions run #20464082726
Thorough verification found 3 additional issues: - runners/github/file_lock.py:462 - os.fdopen missing encoding - runners/github/trust.py:442 - os.fdopen missing encoding - runners/insights_runner.py:372 - duplicate encoding parameter All fixed. Final count: 251 instances with encoding="utf-8"
…ces) Gemini Code Assist review found instances we missed: - Path.read_text() without encoding: 77 instances → fixed - Path.write_text() without encoding: 22 instances → fixed Total UTF-8 encoding fixes: 350 instances across codebase - open() operations: 251 instances - Path.read_text(): 98 instances - Path.write_text(): 30 instances All text file operations now explicitly use encoding="utf-8". Addresses feedback from PR AndyMik90#782 review.
- Fix os.getpid() syntax error in core/workspace/models.py (2 instances) Changed: os.getpid(, encoding="utf-8") -> str(os.getpid()) - Fix json.dumps invalid encoding parameter (3 instances) json.dumps() doesn't accept encoding parameter Changed: json.dumps(data, encoding="utf-8") -> json.dumps(data) Files: runners/ai_analyzer/cache_manager.py, runners/github/test_file_lock.py - Fix tempfile.NamedTemporaryFile missing encoding Added encoding="utf-8" to spec/requirements.py:22 - Fix subprocess.run text=True to encoding Changed: text=True -> encoding="utf-8" in core/workspace/setup.py:375 All critical syntax errors from CodeRabbit review resolved.
- Line 78: Move encoding="utf-8" outside of JS string content
Changed: write_text("...encoding="utf-8"...")
To: write_text("...", encoding="utf-8")
- Line 102: Move encoding="utf-8" outside of JS string content
Changed: write_text("...encoding="utf-8"...")
To: write_text("...", encoding="utf-8")
Fixes syntax errors where encoding parameter was incorrectly placed
inside the JavaScript code string instead of as write_text() parameter.
- Add UnicodeDecodeError to exception handling in agents/utils.py and spec/validate_pkg/auto_fix.py - Fix trailing newline preservation in merge/file_merger.py (2 locations) - Add encoding parameter to atomic_write() in runners/github/file_lock.py These fixes ensure robust error handling for malformed UTF-8 files and preserve file formatting during merge operations.
Update spec_file fixture in tests/conftest.py to write spec file with encoding="utf-8" to match how it's read in validators. This ensures consistency between test fixtures and production code.
c686009 to
a7818b3
Compare
…ndyMik90#748) * fix(frontend): ensure PATH includes system directories when launched from Finder Fixes 'Claude CLI not found' error in Insights panel when Auto-Claude is launched from Finder/Dock on macOS. When Electron apps launch from GUI (not terminal), process.env.PATH is minimal or empty and doesn't include essential system directories. The Claude Agent SDK requires /usr/bin/security to access the macOS Keychain for OAuth tokens. Without this in PATH, SDK initialization fails and Insights falls back to simple mode with 120s timeout. Changes: - env-utils.ts: Ensure /usr/bin, /bin, /usr/sbin, /sbin are always in PATH - Only appends missing paths to respect user's PATH configuration - Applies to both macOS and Linux (platform !== 'win32') Tested by building DMG and launching from Finder - Insights now responds without timeout. * refactor(frontend): address AI review feedback on PATH handling Improves code consistency and empty string handling based on AI review: 1. Extract essential paths to module-level constant - Created ESSENTIAL_SYSTEM_PATHS constant following file's pattern - Consistent with existing COMMON_BIN_PATHS constant - Self-documenting with JSDoc comment 2. Add .filter(Boolean) to second currentPathSet creation - Line 138 now matches line 126's pattern - Ensures consistent empty string filtering throughout function - Addresses @dertuerke's concern about proper falsy value handling These changes improve code maintainability without affecting functionality. The original PATH fix still works correctly - this just makes the code more consistent with project patterns. * refactor(frontend): improve code clarity from second AI review Based on second AI review iteration, made three improvements: 1. Add explicit type annotation to ESSENTIAL_SYSTEM_PATHS - Consistent with adjacent COMMON_BIN_PATHS constant - const ESSENTIAL_SYSTEM_PATHS: string[] = [...] 2. Rename inner variable to avoid shadowing - pathSetForEssentials instead of currentPathSet (inner scope) - Makes it clear this Set checks for missing essentials - Outer currentPathSet (line 137) still has clear purpose 3. Remove unnecessary intermediate variable - Use ESSENTIAL_SYSTEM_PATHS directly instead of essentialPaths alias - Reduces indirection, constant name is already descriptive All changes improve code readability without affecting functionality. * fix: ensure essential paths are always written to env.PATH Previously, env.PATH was only updated when pathsToAdd had items. This caused the fix to fail on minimal systems without Homebrew/npm where pathsToAdd would be empty, leaving env.PATH unset even though currentPath contained the essential system paths. Now we always write currentPath to env.PATH, ensuring essential paths are present even when no additional paths are found. Fixes Auto Claude review finding ce703185936f * fix: apply essential paths logic to async version Applied the same fixes to getAugmentedEnvAsync(): 1. Added essential system paths logic for macOS Keychain access 2. Added .filter(Boolean) to prevent empty string in currentPathSet 3. Removed conditional PATH update to ensure essential paths always written This ensures async code paths (Claude CLI detection, tool validation) also work correctly when app launches from Finder/Dock. Fixes Auto Claude review HIGH severity finding --------- Co-authored-by: Andy <[email protected]>
…ndyMik90#780) * feat(pr-review): add prominent verdict summary to PR review comments Add a "Bottom Line" summary that appears prominently right after the review header, making it easy to quickly scan the key outcome without scrolling through the full review. The summary intelligently distinguishes between: - Ready to merge (all clear) - Ready once CI passes (only waiting on CI, no code issues) - Needs revision (actual code issues to fix) - Blocked (merge conflicts, failing CI, etc.) This improves UX by showing the verdict at a glance - especially helpful when CI is pending but the code review is actually approved. Changes: - parallel_followup_reviewer.py: Add ci_status param and _generate_bottom_line() - orchestrator.py: Add matching _generate_bottom_line() for initial reviews 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: address PR feedback - logic and consistency improvements Fixes based on Gemini, Cursor Bot, and Auto Claude PR Review feedback: - HIGH: Reorder NEEDS_REVISION conditions to check code issues (blocking_findings, code_blockers, new_count) BEFORE checking pending CI. This prevents misleading "Ready once CI passes" when code issues actually exist. - MEDIUM: Standardize emojis across both reviewers: - BLOCKED: Use 🔴 consistently (was 🚫 in followup) - MERGE_WITH_CHANGES: Use 🟡 consistently (was⚠️ in followup) - MEDIUM: Fix type inconsistency - awaiting_approval default changed from False (bool) to 0 (int) to match the integer count returned by CI status. - FIX: Apply ruff formatting for CI compliance (line wrapping). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> Co-authored-by: Gemini Code Assist <[email protected]> * fix: complete emoji standardization for full consistency Align all emojis in parallel_followup_reviewer.py with orchestrator.py: - status_emoji dict: Use 🟠 for NEEDS_REVISION (was 🔄), 🟡 for MERGE_WITH_CHANGES (was⚠️ ), 🔴 for BLOCKED (was 🚫) - _generate_bottom_line: Use 🟠 for NEEDS_REVISION (was 🔄) Now both files use identical emoji conventions: - ✅ READY_TO_MERGE - 🟡 MERGE_WITH_CHANGES - 🟠 NEEDS_REVISION - 🔴 BLOCKED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: Gemini Code Assist <[email protected]> Co-authored-by: Alex <[email protected]>
- Remove unused tree-sitter methods in semantic_analyzer.py that caused F821 undefined name errors - Fix regex injection vulnerability in bump-version.js by properly escaping all regex special characters - Add escapeRegex() function to prevent security issues when version string is used in RegExp constructor Resolves ruff linting failures and CodeQL security alerts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 12
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (15)
apps/backend/runners/roadmap/executor.py (1)
38-44: Replacetext=Truewithencoding="utf-8"for consistency.The
text=Trueparameter defaults to the system locale encoding (cp1252 on Windows), which can cause the same encoding errors this PR aims to fix. If executed scripts output UTF-8 text with non-ASCII characters, stdout/stderr decoding will fail on Windows.According to the PR objectives, subprocess.run calls should use
encoding="utf-8"instead oftext=True.🔧 Proposed fix
result = subprocess.run( cmd, cwd=self.project_dir, capture_output=True, - text=True, + encoding="utf-8", timeout=300, )apps/backend/services/recovery.py (1)
428-434: Consider replacingtext=Truewithencoding="utf-8"for consistency.The subprocess.run call uses
text=True, which decodes output using the locale encoding (cp1252 on Windows). Git typically outputs UTF-8, which could cause decoding errors if commit messages or filenames contain non-ASCII characters. Per the PR objectives, subprocess.run calls should useencoding="utf-8"instead.🔧 Suggested fix
result = subprocess.run( ["git", "reset", "--hard", commit_hash], cwd=self.project_dir, capture_output=True, - text=True, + encoding="utf-8", check=True, )apps/backend/services/orchestrator.py (1)
305-311: Missed instance: Replacetext=Truewithencoding="utf-8"in subprocess.run().Line 309 uses
text=True, which defaults to cp1252 encoding on Windows—the same issue this PR addresses. Docker-compose output (accessed at line 314 viaproc.stderr) can contain UTF-8 characters in service names, paths, or error messages, potentially causingUnicodeDecodeErroron Windows.🔧 Proposed fix
proc = subprocess.run( cmd, cwd=self.project_dir, capture_output=True, - text=True, + encoding="utf-8", timeout=timeout, )apps/backend/security/scan_secrets.py (2)
367-372: Replacetext=Truewithencoding="utf-8"for consistency.This
subprocess.runcall usestext=True, which defaults to the system encoding (cp1252 on Windows). According to the PR objectives, all subprocess.run calls should explicitly useencoding="utf-8"instead oftext=Truefor consistent cross-platform behavior.🔧 Proposed fix
result = subprocess.run( ["git", "diff", "--cached", "--name-only", "--diff-filter=ACM"], capture_output=True, - text=True, + encoding="utf-8", check=True, )
382-387: Replacetext=Truewithencoding="utf-8"for consistency.Same issue as in
get_staged_files(): thissubprocess.runcall usestext=Trueinstead of explicitly specifyingencoding="utf-8", which can lead to encoding issues on Windows when git outputs filenames with non-ASCII characters.🔧 Proposed fix
result = subprocess.run( ["git", "ls-files"], capture_output=True, - text=True, + encoding="utf-8", check=True, )apps/backend/ideation/prioritizer.py (1)
100-109: UTF-8 encoding correctly added; consider using existing content.The encoding parameter at line 105 correctly implements the PR's UTF-8 standardization goal. However, the file is read twice: once at line 51 (stored in
content) and again here. Since thecontentvariable is in scope within this exception handler, you could reuse it.♻️ Optional refactor to avoid redundant file read
except json.JSONDecodeError as e: debug_error("ideation_prioritizer", "JSON parse error", error=str(e)) return { "success": False, "error": f"Invalid JSON: {e}", - "current_content": output_file.read_text(encoding="utf-8") - if output_file.exists() - else "", + "current_content": content, "count": 0, }apps/backend/runners/ai_analyzer/claude_client.py (1)
112-121: Usecreate_simple_client()instead of directClaudeSDKClientinstantiation.The coding guidelines specify avoiding direct
ClaudeSDKClientinitialization. For simple message calls without full agent sessions (as in this analysis wrapper), usecreate_simple_client()fromcore.simple_clientinstead. Thecreate_client()function is designed for full agent sessions with security hooks, MCP servers, and extended thinking—it requires aspec_dirparameter that this class doesn't have and would be over-engineered for read-only analysis queries.apps/backend/ideation/formatter.py (2)
42-49: AddUnicodeDecodeErrorto the exception handling.When reading files with explicit UTF-8 encoding, a
UnicodeDecodeErrorcan occur if the file contains invalid UTF-8 sequences (e.g., corrupted file or wrong encoding). The currentexceptblock only catchesJSONDecodeError.Proposed fix
try: with open(ideation_file, encoding="utf-8") as f: existing_session = json.load(f) existing_ideas = existing_session.get("ideas", []) print_status( f"Preserving {len(existing_ideas)} existing ideas", "info" ) - except json.JSONDecodeError: + except (json.JSONDecodeError, UnicodeDecodeError): pass
59-65: AddUnicodeDecodeErrorto the exception handling.Same issue as above—reading with UTF-8 encoding can raise
UnicodeDecodeErrorif the file contains invalid byte sequences.Proposed fix
try: with open(type_file, encoding="utf-8") as f: data = json.load(f) ideas = data.get(ideation_type, []) new_ideas.extend(ideas) output_files.append(str(type_file)) - except (json.JSONDecodeError, KeyError): + except (json.JSONDecodeError, KeyError, UnicodeDecodeError): passapps/backend/core/progress.py (1)
29-59: Consider extracting repeated JSON loading logic into a helper.There are 6 functions in this file that load
implementation_plan.jsonwith identical error handling patterns. A helper method like_load_plan(spec_dir: Path) -> dict | Nonewould reduce duplication and centralize the encoding/error-handling logic.Example helper
def _load_plan(spec_dir: Path) -> dict | None: """Load implementation plan with proper error handling.""" plan_file = spec_dir / "implementation_plan.json" if not plan_file.exists(): return None try: with open(plan_file, encoding="utf-8") as f: return json.load(f) except (OSError, json.JSONDecodeError, UnicodeDecodeError): return Noneapps/backend/ideation/runner.py (1)
234-240: Add error handling for file read and JSON parsing.The encoding addition is correct, but this code block lacks error handling. If
ideation.jsonexists but is corrupted, has invalid UTF-8 sequences, or contains malformed JSON, an unhandled exception will propagate and potentially crash the summary display.Proposed fix
ideation_file = self.output_dir / "ideation.json" if ideation_file.exists(): - with open(ideation_file, encoding="utf-8") as f: - ideation = json.load(f) - - ideas = ideation.get("ideas", []) - summary = ideation.get("summary", {}) - by_type = summary.get("by_type", {}) + try: + with open(ideation_file, encoding="utf-8") as f: + ideation = json.load(f) + + ideas = ideation.get("ideas", []) + summary = ideation.get("summary", {}) + by_type = summary.get("by_type", {}) + except (OSError, json.JSONDecodeError, UnicodeDecodeError): + print_status("Could not read ideation summary", "warning") + returnapps/backend/init.py (1)
96-122: Critical: Missing UTF-8 encoding parameters.The
ensure_all_gitignore_entriesfunction is missingencoding="utf-8"parameters on Lines 96 and 122, which is inconsistent with the rest of this file and defeats the purpose of this PR. On Windows, these operations will still default to cp1252, causing encoding errors when reading/writing .gitignore files with non-ASCII characters.🐛 Proposed fix
# Read existing content or start fresh if gitignore_path.exists(): - content = gitignore_path.read_text() + content = gitignore_path.read_text(encoding="utf-8") lines = content.splitlines() else: content = ""for entry in entries_to_add: content += entry + "\n" added_entries.append(entry) - gitignore_path.write_text(content) + gitignore_path.write_text(content, encoding="utf-8") return added_entriesapps/backend/runners/github/file_lock.py (1)
293-299: Missingencodingparameter inlocked_writefunction.The
locked_writeasync context manager opens the temp file at line 295 without passing an encoding parameter, whileatomic_writeandlocked_json_updateboth correctly useencoding="utf-8". This inconsistency will cause Windows encoding issues when callers uselocked_writedirectly for text files.🔧 Proposed fix
@asynccontextmanager async def locked_write( - filepath: str | Path, timeout: float = 5.0, mode: str = "w" + filepath: str | Path, timeout: float = 5.0, mode: str = "w", encoding: str = "utf-8" ) -> Any: """ Async context manager combining file locking and atomic writes. Acquires exclusive lock, writes to temp file, atomically replaces target. This is the recommended way to safely write shared state files. Args: filepath: Target file path timeout: Lock timeout in seconds (default: 5.0) mode: File open mode (default: "w") + encoding: Text encoding (default: "utf-8") ... """ filepath = Path(filepath) # Acquire lock lock = FileLock(filepath, timeout=timeout, exclusive=True) await lock.__aenter__() try: # Atomic write in thread pool (since it uses sync file I/O) fd, tmp_path = await asyncio.get_running_loop().run_in_executor( None, lambda: tempfile.mkstemp( dir=filepath.parent, prefix=f".{filepath.name}.tmp.", suffix="" ), ) try: # Open temp file and yield to caller - f = os.fdopen(fd, mode) + f = os.fdopen(fd, mode, encoding=encoding) try: yield fapps/backend/spec/validate_pkg/validators/implementation_plan_validator.py (1)
46-54: Consider catching UnicodeDecodeError for consistency.The exception handling only catches
json.JSONDecodeError. For consistency with the fix already applied inauto_fix.py(line 29 of this PR), consider also catchingUnicodeDecodeErrorto handle files with invalid UTF-8 sequences gracefully.♻️ Recommended enhancement for robust encoding error handling
try: with open(plan_file, encoding="utf-8") as f: plan = json.load(f) - except json.JSONDecodeError as e: + except (json.JSONDecodeError, UnicodeDecodeError) as e: errors.append(f"implementation_plan.json is invalid JSON: {e}") fixes.append( "Regenerate with: python auto-claude/planner.py --spec-dir " + str(self.spec_dir) ) return ValidationResult(False, "plan", errors, warnings, fixes)apps/backend/qa/criteria.py (1)
18-27: Add UnicodeDecodeError handling for consistency.The UTF-8 encoding additions are correct. However, for consistency with
auto_fix.py(which catches bothjson.JSONDecodeErrorandUnicodeDecodeErrorat line 29), consider catchingUnicodeDecodeErrorhere as well to handle files with invalid UTF-8 sequences gracefully.♻️ Recommended enhancement for robust encoding error handling
try: with open(plan_file, encoding="utf-8") as f: return json.load(f) - except (OSError, json.JSONDecodeError): + except (OSError, json.JSONDecodeError, UnicodeDecodeError): return None
🤖 Fix all issues with AI agents
In @apps/backend/analysis/test_discovery.py:
- Line 401: The Path.read_text calls (e.g., the pyproject read at content =
pyproject.read_text(encoding="utf-8")) need try/except wrapping like the open()
usage at line 303: catch OSError/UnicodeError, log or handle the error, and fall
back to a safe default (e.g., empty string) so the test discovery process
doesn't crash; apply the same pattern to the other read_text uses (the
requirements read at line 421 and the Gemfile read at line 499) following the
error-handling style used in config_parser.py.
In @apps/backend/core/progress.py:
- Around line 83-84: The JSON file loads using open(..., encoding="utf-8") can
raise UnicodeDecodeError but the except blocks only catch other exceptions;
update the exception handlers around the plan load (where plan_file is opened
and json.load(f) is called) and the second load (the results_file json.load at
the other location) to include UnicodeDecodeError in their except clauses so
decoding errors are handled consistently with the explicit encoding.
- Around line 418-419: The code that opens plan_file with encoding="utf-8" and
calls json.load(plan) currently doesn't handle UnicodeDecodeError; update the
except clauses that handle JSON/file errors to also catch UnicodeDecodeError
(i.e., add UnicodeDecodeError to the exception tuple alongside the existing
exceptions that wrap the open/json.load), and apply the same change to the other
occurrence that handles plan_file at the second block (around the plan_file
handling at lines 454-455) so both read paths handle invalid-encoding failures.
- Around line 378-379: The code that opens plan_file and calls
json.load(plan_file) (creating the variable plan) can raise UnicodeDecodeError
when reading non-UTF-8 content; update the corresponding exception handling
around the open/json.load calls (the block that currently catches
JSONDecodeError/Exception for plan_file at the plan = json.load(...) sites) to
also catch UnicodeDecodeError and handle it the same way as the other decoding
errors (e.g., log the error with the file path and rethrow or handle
consistently). Apply the same change for the second occurrence that handles plan
loading at the other plan_file location (lines around plan = json.load(...) at
the 398-399 spot).
- Around line 304-305: The JSON file read using open(plan_file,
encoding="utf-8") then json.load(f) can raise UnicodeDecodeError; update the
exception handlers that currently catch JSONDecodeError/ValueError (around the
plan_file read at the shown snippet and the similar block at lines 357-358) to
also include UnicodeDecodeError in the except tuple so the decode error is
handled the same way as other JSON errors for the plan_file read operations
(i.e., add UnicodeDecodeError alongside existing exceptions where
json.load(plan_file) is wrapped).
- Around line 45-46: The try/except that opens and json.loads the plan file (the
with open(plan_file, encoding="utf-8") as f: plan = json.load(f) block)
currently catches OSError and JSONDecodeError but misses UnicodeDecodeError;
update the exception handlers to also catch UnicodeDecodeError alongside OSError
and JSONDecodeError and handle it the same way (e.g., log/raise/return as
existing logic dictates). Apply the same change to the second similar block
around the code at lines 58-59 that reads another JSON file so both file reads
handle invalid UTF-8 sequences.
- Around line 184-185: The JSON file reads use a broad exception handler that
doesn't account for text decoding failures; update the exception clauses that
wrap the open(spec_dir / "implementation_plan.json", encoding="utf-8") -> plan
and the similar block at the second occurrence (lines ~232-233) to include
UnicodeDecodeError in the except tuple so decoding errors are caught and handled
alongside existing exceptions; locate the blocks using the symbols spec_dir and
plan and add UnicodeDecodeError to their except statements.
In @apps/backend/core/workspace/setup.py:
- Around line 409-415: The call to run_git([...], cwd=project_dir,
capture_output=True, encoding="utf-8") is passing unsupported keyword arguments;
remove the encoding and capture_output keywords and call run_git with only the
accepted params (e.g., run_git(["rev-parse", "HEAD"], cwd=project_dir)) so that
result and branch_point logic (result.returncode and result.stdout.strip())
continue to work with the function's built-in UTF-8/text handling and default
output capture.
In @apps/backend/ideation/formatter.py:
- Around line 142-145: The try/except around reading and json.load of
context_file only catches json.JSONDecodeError but should also catch
UnicodeDecodeError like other reads in this file; update the exception handler
in the block that opens context_file and calls json.load (the with
open(context_file, encoding="utf-8") as f: / context_data = json.load(f)
section) to catch both json.JSONDecodeError and UnicodeDecodeError (e.g., an
except tuple) so binary/encoding issues are ignored consistently.
In @apps/backend/merge/semantic_analyzer.py:
- Around line 173-196: This tree-sitter subsystem is unused and causes
undefined-name errors; remove the unused methods and related dead-code instead
of leaving broken stubs: delete the _analyze_with_tree_sitter and
_extract_elements methods and remove any imports or references to Tree, Node,
extract_python_elements, extract_js_elements, and any tree-sitter parser setup
that only supported those methods, and ensure analyze_diff only uses the
remaining working analysis path (so no dangling calls remain).
- Around line 121-171: The tree-sitter implementation is incomplete and unused;
remove or relocate the dangling code: delete the methods
_analyze_with_tree_sitter and _extract_elements (which reference undefined
symbols like self._parsers, ChangeType, compare_elements,
extract_python_elements and extract_js_elements), and remove any imports or
attributes added solely for them; if tree-sitter support is intended later, move
these methods into a new TreeSitterAnalyzer class/module that initializes
parsers in its __init__ and imports compare_elements and ChangeType explicitly,
and ensure analyze_diff continues to call the existing analyze_with_regex to
avoid changing runtime behavior.
In @apps/backend/runners/ai_analyzer/cache_manager.py:
- Line 51: Wrap the json.loads(self.cache_file.read_text(encoding="utf-8")) call
in a try/except that catches json.JSONDecodeError (and optionally
FileNotFoundError/ValueError), log a warning that the cache is corrupted
including the exception, delete or truncate the corrupt self.cache_file if
appropriate, and return a safe empty value (e.g., {} or None) to force
re-analysis instead of letting the exception crash the process; use
json.JSONDecodeError, json.loads and self.cache_file.read_text to locate the
code to change.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (120)
.github/workflows/release.ymlapps/backend/agents/coder.pyapps/backend/agents/tools_pkg/tools/memory.pyapps/backend/agents/tools_pkg/tools/progress.pyapps/backend/agents/tools_pkg/tools/qa.pyapps/backend/agents/tools_pkg/tools/subtask.pyapps/backend/agents/utils.pyapps/backend/analysis/analyzers/__init__.pyapps/backend/analysis/analyzers/base.pyapps/backend/analysis/analyzers/context/auth_detector.pyapps/backend/analysis/analyzers/context/jobs_detector.pyapps/backend/analysis/analyzers/context/monitoring_detector.pyapps/backend/analysis/analyzers/database_detector.pyapps/backend/analysis/analyzers/project_analyzer_module.pyapps/backend/analysis/analyzers/route_detector.pyapps/backend/analysis/ci_discovery.pyapps/backend/analysis/insight_extractor.pyapps/backend/analysis/test_discovery.pyapps/backend/cli/batch_commands.pyapps/backend/cli/build_commands.pyapps/backend/cli/followup_commands.pyapps/backend/cli/input_handlers.pyapps/backend/context/builder.pyapps/backend/context/main.pyapps/backend/context/serialization.pyapps/backend/core/client.pyapps/backend/core/debug.pyapps/backend/core/progress.pyapps/backend/core/workspace/models.pyapps/backend/core/workspace/setup.pyapps/backend/ideation/analyzer.pyapps/backend/ideation/formatter.pyapps/backend/ideation/generator.pyapps/backend/ideation/phase_executor.pyapps/backend/ideation/prioritizer.pyapps/backend/ideation/runner.pyapps/backend/init.pyapps/backend/integrations/graphiti/config.pyapps/backend/integrations/linear/config.pyapps/backend/integrations/linear/integration.pyapps/backend/integrations/linear/updater.pyapps/backend/memory/codebase_map.pyapps/backend/memory/patterns.pyapps/backend/memory/sessions.pyapps/backend/merge/file_evolution/storage.pyapps/backend/merge/file_merger.pyapps/backend/merge/install_hook.pyapps/backend/merge/models.pyapps/backend/merge/semantic_analyzer.pyapps/backend/merge/timeline_persistence.pyapps/backend/phase_config.pyapps/backend/planner_lib/context.pyapps/backend/prediction/main.pyapps/backend/prediction/memory_loader.pyapps/backend/project/analyzer.pyapps/backend/project/config_parser.pyapps/backend/project/stack_detector.pyapps/backend/prompts_pkg/prompt_generator.pyapps/backend/prompts_pkg/prompts.pyapps/backend/qa/criteria.pyapps/backend/qa/fixer.pyapps/backend/qa/report.pyapps/backend/review/formatters.pyapps/backend/review/state.pyapps/backend/runners/ai_analyzer/cache_manager.pyapps/backend/runners/ai_analyzer/claude_client.pyapps/backend/runners/ai_analyzer_runner.pyapps/backend/runners/github/audit.pyapps/backend/runners/github/batch_issues.pyapps/backend/runners/github/batch_validator.pyapps/backend/runners/github/bot_detection.pyapps/backend/runners/github/cleanup.pyapps/backend/runners/github/context_gatherer.pyapps/backend/runners/github/duplicates.pyapps/backend/runners/github/file_lock.pyapps/backend/runners/github/learning.pyapps/backend/runners/github/lifecycle.pyapps/backend/runners/github/memory_integration.pyapps/backend/runners/github/models.pyapps/backend/runners/github/multi_repo.pyapps/backend/runners/github/onboarding.pyapps/backend/runners/github/override.pyapps/backend/runners/github/purge_strategy.pyapps/backend/runners/github/runner.pyapps/backend/runners/github/test_context_gatherer.pyapps/backend/runners/github/test_file_lock.pyapps/backend/runners/github/trust.pyapps/backend/runners/gitlab/glab_client.pyapps/backend/runners/gitlab/models.pyapps/backend/runners/gitlab/runner.pyapps/backend/runners/insights_runner.pyapps/backend/runners/roadmap/competitor_analyzer.pyapps/backend/runners/roadmap/executor.pyapps/backend/runners/roadmap/graph_integration.pyapps/backend/runners/roadmap/orchestrator.pyapps/backend/runners/roadmap/phases.pyapps/backend/runners/spec_runner.pyapps/backend/security/scan_secrets.pyapps/backend/services/context.pyapps/backend/services/orchestrator.pyapps/backend/services/recovery.pyapps/backend/spec/compaction.pyapps/backend/spec/complexity.pyapps/backend/spec/context.pyapps/backend/spec/discovery.pyapps/backend/spec/phases/requirements_phases.pyapps/backend/spec/phases/spec_phases.pyapps/backend/spec/pipeline/agent_runner.pyapps/backend/spec/pipeline/models.pyapps/backend/spec/pipeline/orchestrator.pyapps/backend/spec/requirements.pyapps/backend/spec/validate_pkg/auto_fix.pyapps/backend/spec/validate_pkg/validators/context_validator.pyapps/backend/spec/validate_pkg/validators/implementation_plan_validator.pyapps/backend/spec/validate_pkg/validators/spec_document_validator.pyapps/backend/spec/validation_strategy.pyapps/backend/spec/validator.pyapps/backend/spec/writer.pyapps/backend/ui/status.pyapps/frontend/src/main/index.ts
🧰 Additional context used
📓 Path-based instructions (8)
apps/backend/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
apps/backend/**/*.py: Always use the Claude Agent SDK (claude-agent-sdkpackage) for all AI interactions, never use the Anthropic API directly
Use thecreate_client()function fromapps/backend/core/client.pyto instantiate Claude SDK clients, not directClaudeSDKClientinitialization
Files:
apps/backend/analysis/analyzers/__init__.pyapps/backend/integrations/linear/config.pyapps/backend/ideation/phase_executor.pyapps/backend/review/formatters.pyapps/backend/runners/github/cleanup.pyapps/backend/runners/github/onboarding.pyapps/backend/merge/install_hook.pyapps/backend/prompts_pkg/prompts.pyapps/backend/agents/coder.pyapps/backend/runners/github/purge_strategy.pyapps/backend/spec/context.pyapps/backend/runners/ai_analyzer/cache_manager.pyapps/backend/runners/github/trust.pyapps/backend/analysis/insight_extractor.pyapps/backend/runners/roadmap/competitor_analyzer.pyapps/backend/runners/github/audit.pyapps/backend/spec/phases/requirements_phases.pyapps/backend/runners/github/learning.pyapps/backend/integrations/linear/updater.pyapps/backend/merge/models.pyapps/backend/spec/validate_pkg/auto_fix.pyapps/backend/ideation/generator.pyapps/backend/runners/github/batch_issues.pyapps/backend/runners/roadmap/graph_integration.pyapps/backend/services/orchestrator.pyapps/backend/runners/github/test_context_gatherer.pyapps/backend/runners/github/runner.pyapps/backend/runners/gitlab/runner.pyapps/backend/core/client.pyapps/backend/memory/sessions.pyapps/backend/cli/batch_commands.pyapps/backend/agents/utils.pyapps/backend/runners/gitlab/models.pyapps/backend/analysis/ci_discovery.pyapps/backend/runners/github/test_file_lock.pyapps/backend/phase_config.pyapps/backend/runners/spec_runner.pyapps/backend/runners/github/batch_validator.pyapps/backend/spec/validation_strategy.pyapps/backend/runners/github/override.pyapps/backend/analysis/analyzers/route_detector.pyapps/backend/prediction/main.pyapps/backend/planner_lib/context.pyapps/backend/spec/complexity.pyapps/backend/spec/requirements.pyapps/backend/services/context.pyapps/backend/runners/github/duplicates.pyapps/backend/spec/phases/spec_phases.pyapps/backend/project/analyzer.pyapps/backend/runners/github/lifecycle.pyapps/backend/runners/gitlab/glab_client.pyapps/backend/merge/semantic_analyzer.pyapps/backend/cli/input_handlers.pyapps/backend/qa/report.pyapps/backend/runners/ai_analyzer/claude_client.pyapps/backend/spec/pipeline/agent_runner.pyapps/backend/project/config_parser.pyapps/backend/integrations/linear/integration.pyapps/backend/runners/github/memory_integration.pyapps/backend/agents/tools_pkg/tools/progress.pyapps/backend/core/workspace/models.pyapps/backend/core/workspace/setup.pyapps/backend/spec/discovery.pyapps/backend/runners/github/multi_repo.pyapps/backend/runners/roadmap/phases.pyapps/backend/core/progress.pyapps/backend/spec/validate_pkg/validators/context_validator.pyapps/backend/memory/patterns.pyapps/backend/spec/validator.pyapps/backend/memory/codebase_map.pyapps/backend/ideation/runner.pyapps/backend/qa/criteria.pyapps/backend/context/builder.pyapps/backend/agents/tools_pkg/tools/subtask.pyapps/backend/cli/build_commands.pyapps/backend/prediction/memory_loader.pyapps/backend/merge/timeline_persistence.pyapps/backend/runners/github/file_lock.pyapps/backend/review/state.pyapps/backend/runners/roadmap/orchestrator.pyapps/backend/merge/file_merger.pyapps/backend/analysis/analyzers/context/jobs_detector.pyapps/backend/agents/tools_pkg/tools/qa.pyapps/backend/integrations/graphiti/config.pyapps/backend/cli/followup_commands.pyapps/backend/spec/compaction.pyapps/backend/runners/insights_runner.pyapps/backend/merge/file_evolution/storage.pyapps/backend/runners/github/bot_detection.pyapps/backend/ideation/prioritizer.pyapps/backend/spec/pipeline/models.pyapps/backend/runners/roadmap/executor.pyapps/backend/ideation/formatter.pyapps/backend/analysis/analyzers/database_detector.pyapps/backend/analysis/analyzers/base.pyapps/backend/services/recovery.pyapps/backend/qa/fixer.pyapps/backend/spec/writer.pyapps/backend/prompts_pkg/prompt_generator.pyapps/backend/core/debug.pyapps/backend/context/main.pyapps/backend/analysis/test_discovery.pyapps/backend/runners/github/context_gatherer.pyapps/backend/project/stack_detector.pyapps/backend/analysis/analyzers/context/monitoring_detector.pyapps/backend/runners/ai_analyzer_runner.pyapps/backend/init.pyapps/backend/spec/pipeline/orchestrator.pyapps/backend/runners/github/models.pyapps/backend/spec/validate_pkg/validators/implementation_plan_validator.pyapps/backend/analysis/analyzers/context/auth_detector.pyapps/backend/ideation/analyzer.pyapps/backend/agents/tools_pkg/tools/memory.pyapps/backend/analysis/analyzers/project_analyzer_module.pyapps/backend/context/serialization.pyapps/backend/security/scan_secrets.pyapps/backend/spec/validate_pkg/validators/spec_document_validator.pyapps/backend/ui/status.py
⚙️ CodeRabbit configuration file
apps/backend/**/*.py: Focus on Python best practices, type hints, and async patterns.
Check for proper error handling and security considerations.
Verify compatibility with Python 3.12+.
Files:
apps/backend/analysis/analyzers/__init__.pyapps/backend/integrations/linear/config.pyapps/backend/ideation/phase_executor.pyapps/backend/review/formatters.pyapps/backend/runners/github/cleanup.pyapps/backend/runners/github/onboarding.pyapps/backend/merge/install_hook.pyapps/backend/prompts_pkg/prompts.pyapps/backend/agents/coder.pyapps/backend/runners/github/purge_strategy.pyapps/backend/spec/context.pyapps/backend/runners/ai_analyzer/cache_manager.pyapps/backend/runners/github/trust.pyapps/backend/analysis/insight_extractor.pyapps/backend/runners/roadmap/competitor_analyzer.pyapps/backend/runners/github/audit.pyapps/backend/spec/phases/requirements_phases.pyapps/backend/runners/github/learning.pyapps/backend/integrations/linear/updater.pyapps/backend/merge/models.pyapps/backend/spec/validate_pkg/auto_fix.pyapps/backend/ideation/generator.pyapps/backend/runners/github/batch_issues.pyapps/backend/runners/roadmap/graph_integration.pyapps/backend/services/orchestrator.pyapps/backend/runners/github/test_context_gatherer.pyapps/backend/runners/github/runner.pyapps/backend/runners/gitlab/runner.pyapps/backend/core/client.pyapps/backend/memory/sessions.pyapps/backend/cli/batch_commands.pyapps/backend/agents/utils.pyapps/backend/runners/gitlab/models.pyapps/backend/analysis/ci_discovery.pyapps/backend/runners/github/test_file_lock.pyapps/backend/phase_config.pyapps/backend/runners/spec_runner.pyapps/backend/runners/github/batch_validator.pyapps/backend/spec/validation_strategy.pyapps/backend/runners/github/override.pyapps/backend/analysis/analyzers/route_detector.pyapps/backend/prediction/main.pyapps/backend/planner_lib/context.pyapps/backend/spec/complexity.pyapps/backend/spec/requirements.pyapps/backend/services/context.pyapps/backend/runners/github/duplicates.pyapps/backend/spec/phases/spec_phases.pyapps/backend/project/analyzer.pyapps/backend/runners/github/lifecycle.pyapps/backend/runners/gitlab/glab_client.pyapps/backend/merge/semantic_analyzer.pyapps/backend/cli/input_handlers.pyapps/backend/qa/report.pyapps/backend/runners/ai_analyzer/claude_client.pyapps/backend/spec/pipeline/agent_runner.pyapps/backend/project/config_parser.pyapps/backend/integrations/linear/integration.pyapps/backend/runners/github/memory_integration.pyapps/backend/agents/tools_pkg/tools/progress.pyapps/backend/core/workspace/models.pyapps/backend/core/workspace/setup.pyapps/backend/spec/discovery.pyapps/backend/runners/github/multi_repo.pyapps/backend/runners/roadmap/phases.pyapps/backend/core/progress.pyapps/backend/spec/validate_pkg/validators/context_validator.pyapps/backend/memory/patterns.pyapps/backend/spec/validator.pyapps/backend/memory/codebase_map.pyapps/backend/ideation/runner.pyapps/backend/qa/criteria.pyapps/backend/context/builder.pyapps/backend/agents/tools_pkg/tools/subtask.pyapps/backend/cli/build_commands.pyapps/backend/prediction/memory_loader.pyapps/backend/merge/timeline_persistence.pyapps/backend/runners/github/file_lock.pyapps/backend/review/state.pyapps/backend/runners/roadmap/orchestrator.pyapps/backend/merge/file_merger.pyapps/backend/analysis/analyzers/context/jobs_detector.pyapps/backend/agents/tools_pkg/tools/qa.pyapps/backend/integrations/graphiti/config.pyapps/backend/cli/followup_commands.pyapps/backend/spec/compaction.pyapps/backend/runners/insights_runner.pyapps/backend/merge/file_evolution/storage.pyapps/backend/runners/github/bot_detection.pyapps/backend/ideation/prioritizer.pyapps/backend/spec/pipeline/models.pyapps/backend/runners/roadmap/executor.pyapps/backend/ideation/formatter.pyapps/backend/analysis/analyzers/database_detector.pyapps/backend/analysis/analyzers/base.pyapps/backend/services/recovery.pyapps/backend/qa/fixer.pyapps/backend/spec/writer.pyapps/backend/prompts_pkg/prompt_generator.pyapps/backend/core/debug.pyapps/backend/context/main.pyapps/backend/analysis/test_discovery.pyapps/backend/runners/github/context_gatherer.pyapps/backend/project/stack_detector.pyapps/backend/analysis/analyzers/context/monitoring_detector.pyapps/backend/runners/ai_analyzer_runner.pyapps/backend/init.pyapps/backend/spec/pipeline/orchestrator.pyapps/backend/runners/github/models.pyapps/backend/spec/validate_pkg/validators/implementation_plan_validator.pyapps/backend/analysis/analyzers/context/auth_detector.pyapps/backend/ideation/analyzer.pyapps/backend/agents/tools_pkg/tools/memory.pyapps/backend/analysis/analyzers/project_analyzer_module.pyapps/backend/context/serialization.pyapps/backend/security/scan_secrets.pyapps/backend/spec/validate_pkg/validators/spec_document_validator.pyapps/backend/ui/status.py
apps/backend/agents/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Use Graphiti memory system (
integrations/graphiti/) for cross-session context and knowledge graph management in agents
Files:
apps/backend/agents/coder.pyapps/backend/agents/utils.pyapps/backend/agents/tools_pkg/tools/progress.pyapps/backend/agents/tools_pkg/tools/subtask.pyapps/backend/agents/tools_pkg/tools/qa.pyapps/backend/agents/tools_pkg/tools/memory.py
apps/backend/core/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Implement dynamic command allowlisting based on detected project stack using
core/security.pyfor bash command validation
Files:
apps/backend/core/client.pyapps/backend/core/workspace/models.pyapps/backend/core/workspace/setup.pyapps/backend/core/progress.pyapps/backend/core/debug.py
apps/backend/core/client.py
📄 CodeRabbit inference engine (CLAUDE.md)
Implement agent-specific tool permissions in the Claude SDK client based on agent role (planner, coder, qa_reviewer, qa_fixer)
Files:
apps/backend/core/client.py
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/index.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/index.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/index.ts
apps/backend/integrations/graphiti/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Use the Graphiti-provided multi-provider support for LLMs (OpenAI, Anthropic, Azure OpenAI, Ollama, Google AI) via
integrations/graphiti/graphiti_providers.py
Files:
apps/backend/integrations/graphiti/config.py
🧠 Learnings (8)
📓 Common learnings
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:45.209Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
📚 Learning: 2026-01-04T23:59:45.209Z
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:45.209Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
Applied to files:
apps/backend/spec/validate_pkg/auto_fix.pyapps/backend/runners/github/test_context_gatherer.pyapps/backend/agents/utils.pyapps/backend/runners/github/test_file_lock.pyapps/backend/project/config_parser.pyapps/backend/core/workspace/models.pyapps/backend/spec/validate_pkg/validators/spec_document_validator.py
📚 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: Applies to apps/backend/core/client.py : Implement agent-specific tool permissions in the Claude SDK client based on agent role (planner, coder, qa_reviewer, qa_fixer)
Applied to files:
apps/backend/core/client.py
📚 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: Applies to apps/backend/**/*.py : Always use the Claude Agent SDK (`claude-agent-sdk` package) for all AI interactions, never use the Anthropic API directly
Applied to files:
apps/backend/core/client.pyapps/backend/runners/ai_analyzer/claude_client.py
📚 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: Applies to apps/backend/spec_agents/**/*.py : Implement multi-phase spec creation pipeline with complexity-based phase selection (SIMPLE: 3 phases, STANDARD: 6-7 phases, COMPLEX: 8 phases)
Applied to files:
apps/backend/spec/complexity.pyapps/backend/core/progress.py
📚 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: Applies to apps/backend/.env* : Enable Electron MCP for E2E testing by setting `ELECTRON_MCP_ENABLED=true` in `.env` and starting the Electron app with `npm run dev`
Applied to files:
apps/frontend/src/main/index.ts
📚 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: Applies to apps/backend/agents/**/*.py : Use Graphiti memory system (`integrations/graphiti/`) for cross-session context and knowledge graph management in agents
Applied to files:
apps/backend/integrations/graphiti/config.py
📚 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: Applies to apps/backend/integrations/graphiti/**/*.py : Use the Graphiti-provided multi-provider support for LLMs (OpenAI, Anthropic, Azure OpenAI, Ollama, Google AI) via `integrations/graphiti/graphiti_providers.py`
Applied to files:
apps/backend/integrations/graphiti/config.py
🧬 Code graph analysis (42)
apps/backend/merge/install_hook.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/prompts_pkg/prompts.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/runners/ai_analyzer/cache_manager.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/analysis/insight_extractor.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/integrations/linear/updater.py (1)
apps/backend/runners/github/onboarding.py (1)
state_file(293-295)
apps/backend/ideation/generator.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/services/orchestrator.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/analysis/ci_discovery.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/runners/spec_runner.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/spec/validation_strategy.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/analysis/analyzers/route_detector.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/planner_lib/context.py (3)
tests/conftest.py (1)
spec_file(471-475)apps/backend/project/config_parser.py (1)
read_text(59-65)apps/backend/review/state.py (1)
load(92-106)
apps/backend/services/context.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/cli/input_handlers.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/qa/report.py (2)
tests/conftest.py (1)
spec_file(471-475)apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/spec/pipeline/agent_runner.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/runners/github/memory_integration.py (3)
apps/backend/runners/github/batch_issues.py (1)
load(361-369)apps/backend/runners/github/bot_detection.py (1)
load(79-87)apps/backend/runners/github/models.py (3)
load(535-542)load(648-655)load(782-789)
apps/backend/core/workspace/models.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/memory/patterns.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/prediction/memory_loader.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/merge/timeline_persistence.py (9)
apps/backend/integrations/graphiti/config.py (1)
load(514-524)apps/backend/integrations/linear/config.py (1)
load(133-143)apps/backend/integrations/linear/updater.py (1)
load(88-98)apps/backend/runners/github/batch_issues.py (1)
load(361-369)apps/backend/runners/github/bot_detection.py (1)
load(79-87)apps/backend/runners/github/models.py (3)
load(535-542)load(648-655)load(782-789)apps/backend/runners/github/multi_repo.py (1)
load(347-356)apps/backend/runners/gitlab/models.py (1)
load(191-198)apps/backend/runners/github/lifecycle.py (1)
get(406-414)
apps/backend/review/state.py (1)
apps/backend/runners/github/onboarding.py (1)
state_file(293-295)
apps/backend/merge/file_merger.py (1)
apps/frontend/scripts/download-python.cjs (1)
lines(568-568)
apps/backend/analysis/analyzers/context/jobs_detector.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/cli/followup_commands.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/spec/compaction.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/runners/github/bot_detection.py (1)
apps/backend/runners/github/onboarding.py (1)
state_file(293-295)
apps/backend/ideation/prioritizer.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/runners/roadmap/executor.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/analysis/analyzers/base.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/qa/fixer.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/prompts_pkg/prompt_generator.py (2)
apps/backend/project/config_parser.py (1)
read_text(59-65)apps/frontend/scripts/download-python.cjs (1)
lines(568-568)
apps/backend/analysis/test_discovery.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/analysis/analyzers/context/monitoring_detector.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/runners/ai_analyzer_runner.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/init.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/analysis/analyzers/context/auth_detector.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/ideation/analyzer.py (2)
tests/conftest.py (1)
spec_file(471-475)apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/agents/tools_pkg/tools/memory.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/analysis/analyzers/project_analyzer_module.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/security/scan_secrets.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/spec/validate_pkg/validators/spec_document_validator.py (2)
tests/conftest.py (1)
spec_file(471-475)apps/backend/project/config_parser.py (1)
read_text(59-65)
🪛 GitHub Actions: Lint
apps/backend/merge/semantic_analyzer.py
[error] 145-145: Ruff check failed: F821 Undefined name 'compare_elements'.
🪛 GitHub Check: python
apps/backend/merge/semantic_analyzer.py
[failure] 183-183: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:183:28: F821 Undefined name Node
[failure] 175-175: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:175:15: F821 Undefined name Tree
[failure] 165-165: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:165:17: F821 Undefined name ChangeType
[failure] 164-164: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:164:17: F821 Undefined name ChangeType
[failure] 161-161: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:161:40: F821 Undefined name ChangeType
[failure] 159-159: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:159:40: F821 Undefined name ChangeType
[failure] 157-157: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:157:40: F821 Undefined name ChangeType
[failure] 154-154: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:154:17: F821 Undefined name ChangeType
[failure] 153-153: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:153:17: F821 Undefined name ChangeType
[failure] 145-145: Ruff (F821)
apps/backend/merge/semantic_analyzer.py:145:19: F821 Undefined name compare_elements
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: CodeQL (javascript-typescript)
- GitHub Check: CodeQL (python)
| pyproject = project_dir / "pyproject.toml" | ||
| if pyproject.exists(): | ||
| content = pyproject.read_text() | ||
| content = pyproject.read_text(encoding="utf-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider adding error handling for robustness.
While the UTF-8 encoding additions are correct, the Path.read_text() calls lack error handling. If any of these files have permission issues, I/O errors, or encoding problems, the exception will propagate and could crash the entire test discovery process.
For consistency with the pattern used at line 303 (which wraps open() in try-except), consider adding error handling around these calls to allow graceful degradation.
♻️ Suggested error handling pattern
For line 401 (pyproject.toml):
pyproject = project_dir / "pyproject.toml"
if pyproject.exists():
- content = pyproject.read_text(encoding="utf-8")
+ try:
+ content = pyproject.read_text(encoding="utf-8")
+ except (OSError, UnicodeDecodeError):
+ returnApply similar patterns to lines 421 and 499 for requirements.txt and Gemfile respectively.
This matches the error handling approach used at line 303 and in the referenced config_parser.py module.
Also applies to: 421-421, 499-499
🤖 Prompt for AI Agents
In @apps/backend/analysis/test_discovery.py at line 401, The Path.read_text
calls (e.g., the pyproject read at content =
pyproject.read_text(encoding="utf-8")) need try/except wrapping like the open()
usage at line 303: catch OSError/UnicodeError, log or handle the error, and fall
back to a safe default (e.g., empty string) so the test discovery process
doesn't crash; apply the same pattern to the other read_text uses (the
requirements read at line 421 and the Gemfile read at line 499) following the
error-handling style used in config_parser.py.
| with open(plan_file, encoding="utf-8") as f: | ||
| plan = json.load(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add UnicodeDecodeError to the exception handling.
With explicit UTF-8 encoding, UnicodeDecodeError can be raised if the file contains invalid sequences. This should be caught alongside OSError and JSONDecodeError.
Proposed fix
- except (OSError, json.JSONDecodeError):
+ except (OSError, json.JSONDecodeError, UnicodeDecodeError):
return 0, 0Also applies to: 58-59
🤖 Prompt for AI Agents
In @apps/backend/core/progress.py around lines 45 - 46, The try/except that
opens and json.loads the plan file (the with open(plan_file, encoding="utf-8")
as f: plan = json.load(f) block) currently catches OSError and JSONDecodeError
but misses UnicodeDecodeError; update the exception handlers to also catch
UnicodeDecodeError alongside OSError and JSONDecodeError and handle it the same
way (e.g., log/raise/return as existing logic dictates). Apply the same change
to the second similar block around the code at lines 58-59 that reads another
JSON file so both file reads handle invalid UTF-8 sequences.
| with open(plan_file, encoding="utf-8") as f: | ||
| plan = json.load(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add UnicodeDecodeError to the exception handling.
Same issue—add UnicodeDecodeError for consistency with the encoding change.
Proposed fix
- except (OSError, json.JSONDecodeError):
+ except (OSError, json.JSONDecodeError, UnicodeDecodeError):
return resultAlso applies to: 96-97
🤖 Prompt for AI Agents
In @apps/backend/core/progress.py around lines 83 - 84, The JSON file loads
using open(..., encoding="utf-8") can raise UnicodeDecodeError but the except
blocks only catch other exceptions; update the exception handlers around the
plan load (where plan_file is opened and json.load(f) is called) and the second
load (the results_file json.load at the other location) to include
UnicodeDecodeError in their except clauses so decoding errors are handled
consistently with the explicit encoding.
| with open(spec_dir / "implementation_plan.json", encoding="utf-8") as f: | ||
| plan = json.load(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add UnicodeDecodeError to the exception handling.
Proposed fix
- except (OSError, json.JSONDecodeError):
+ except (OSError, json.JSONDecodeError, UnicodeDecodeError):
passAlso applies to: 232-233
🤖 Prompt for AI Agents
In @apps/backend/core/progress.py around lines 184 - 185, The JSON file reads
use a broad exception handler that doesn't account for text decoding failures;
update the exception clauses that wrap the open(spec_dir /
"implementation_plan.json", encoding="utf-8") -> plan and the similar block at
the second occurrence (lines ~232-233) to include UnicodeDecodeError in the
except tuple so decoding errors are caught and handled alongside existing
exceptions; locate the blocks using the symbols spec_dir and plan and add
UnicodeDecodeError to their except statements.
| with open(plan_file, encoding="utf-8") as f: | ||
| plan = json.load(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add UnicodeDecodeError to the exception handling.
Proposed fix
- except (OSError, json.JSONDecodeError):
+ except (OSError, json.JSONDecodeError, UnicodeDecodeError):
return {Also applies to: 357-358
🤖 Prompt for AI Agents
In @apps/backend/core/progress.py around lines 304 - 305, The JSON file read
using open(plan_file, encoding="utf-8") then json.load(f) can raise
UnicodeDecodeError; update the exception handlers that currently catch
JSONDecodeError/ValueError (around the plan_file read at the shown snippet and
the similar block at lines 357-358) to also include UnicodeDecodeError in the
except tuple so the decode error is handled the same way as other JSON errors
for the plan_file read operations (i.e., add UnicodeDecodeError alongside
existing exceptions where json.load(plan_file) is wrapped).
| result = run_git( | ||
| ["rev-parse", "HEAD"], | ||
| cwd=project_dir, | ||
| capture_output=True, | ||
| encoding="utf-8", | ||
| ) | ||
| branch_point = result.stdout.strip() if result.returncode == 0 else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, let's find the git_executable.py file
find . -name "git_executable.py" -type f
# Then search for the run_git function definition
rg -n "def run_git" --type=py -A 15Repository: AndyMik90/Auto-Claude
Length of output: 1254
🏁 Script executed:
# Get the full run_git function implementation
sed -n '100,150p' ./apps/backend/core/git_executable.pyRepository: AndyMik90/Auto-Claude
Length of output: 1382
Remove encoding="utf-8" and capture_output=True from the run_git() call; these parameters are not accepted by the function.
The run_git() function signature does not include encoding or capture_output parameters. Passing them will raise TypeError: run_git() got an unexpected keyword argument. The function internally handles encoding (uses encoding="utf-8" with text=True) and always captures output by default, so these parameters should be removed from the call.
🤖 Prompt for AI Agents
In @apps/backend/core/workspace/setup.py around lines 409 - 415, The call to
run_git([...], cwd=project_dir, capture_output=True, encoding="utf-8") is
passing unsupported keyword arguments; remove the encoding and capture_output
keywords and call run_git with only the accepted params (e.g.,
run_git(["rev-parse", "HEAD"], cwd=project_dir)) so that result and branch_point
logic (result.returncode and result.stdout.strip()) continue to work with the
function's built-in UTF-8/text handling and default output capture.
| with open(context_file, encoding="utf-8") as f: | ||
| context_data = json.load(f) | ||
| except json.JSONDecodeError: | ||
| pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add UnicodeDecodeError to the exception handling.
Consistent with the other read operations in this file.
Proposed fix
try:
with open(context_file, encoding="utf-8") as f:
context_data = json.load(f)
- except json.JSONDecodeError:
+ except (json.JSONDecodeError, UnicodeDecodeError):
pass📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| with open(context_file, encoding="utf-8") as f: | |
| context_data = json.load(f) | |
| except json.JSONDecodeError: | |
| pass | |
| try: | |
| with open(context_file, encoding="utf-8") as f: | |
| context_data = json.load(f) | |
| except (json.JSONDecodeError, UnicodeDecodeError): | |
| pass |
🤖 Prompt for AI Agents
In @apps/backend/ideation/formatter.py around lines 142 - 145, The try/except
around reading and json.load of context_file only catches json.JSONDecodeError
but should also catch UnicodeDecodeError like other reads in this file; update
the exception handler in the block that opens context_file and calls json.load
(the with open(context_file, encoding="utf-8") as f: / context_data =
json.load(f) section) to catch both json.JSONDecodeError and UnicodeDecodeError
(e.g., an except tuple) so binary/encoding issues are ignored consistently.
|
|
||
| print(f"✓ Using cached AI insights ({hours_old:.1f} hours old)") | ||
| return json.loads(self.cache_file.read_text()) | ||
| return json.loads(self.cache_file.read_text(encoding="utf-8")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
UTF-8 encoding addition is correct; consider adding error handling for corrupted cache files.
The encoding="utf-8" parameter is correctly placed in Path.read_text(). However, json.loads() can raise JSONDecodeError if the cache file is corrupted. Consider wrapping this in a try-except block to gracefully fall back to re-analysis instead of crashing.
🛡️ Proposed error handling
- print(f"✓ Using cached AI insights ({hours_old:.1f} hours old)")
- return json.loads(self.cache_file.read_text(encoding="utf-8"))
+ print(f"✓ Using cached AI insights ({hours_old:.1f} hours old)")
+ try:
+ return json.loads(self.cache_file.read_text(encoding="utf-8"))
+ except (json.JSONDecodeError, OSError) as e:
+ print(f"⚠️ Cache file corrupted or unreadable ({e}), re-analyzing...")
+ return None🤖 Prompt for AI Agents
In @apps/backend/runners/ai_analyzer/cache_manager.py at line 51, Wrap the
json.loads(self.cache_file.read_text(encoding="utf-8")) call in a try/except
that catches json.JSONDecodeError (and optionally FileNotFoundError/ValueError),
log a warning that the cache is corrupted including the exception, delete or
truncate the corrupt self.cache_file if appropriate, and return a safe empty
value (e.g., {} or None) to force re-analysis instead of letting the exception
crash the process; use json.JSONDecodeError, json.loads and
self.cache_file.read_text to locate the code to change.
1354230 to
f611332
Compare
Apply formatting fixes to meet line length requirements: - context/builder.py: Split long line with array slicing - planner_lib/context.py: Split long ternary expression - spec/requirements.py: Split long tempfile.NamedTemporaryFile call Resolves ruff format check failures.
There was a problem hiding this 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
🤖 Fix all issues with AI agents
In @apps/backend/planner_lib/context.py:
- Around line 94-95: The file opens requirements.json with encoding="utf-8" but
the exception handlers that currently catch (json.JSONDecodeError, KeyError)
don’t handle UnicodeDecodeError; update the except tuples in the blocks that
parse requirements_file and complexity_assessment.json to include
UnicodeDecodeError (i.e., catch (json.JSONDecodeError, KeyError,
UnicodeDecodeError)) so corrupted or non-UTF-8 files are handled gracefully
during workflow type detection.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
apps/backend/context/builder.pyapps/backend/planner_lib/context.pyapps/backend/spec/requirements.py
🧰 Additional context used
📓 Path-based instructions (1)
apps/backend/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
apps/backend/**/*.py: Always use the Claude Agent SDK (claude-agent-sdkpackage) for all AI interactions, never use the Anthropic API directly
Use thecreate_client()function fromapps/backend/core/client.pyto instantiate Claude SDK clients, not directClaudeSDKClientinitialization
Files:
apps/backend/context/builder.pyapps/backend/planner_lib/context.pyapps/backend/spec/requirements.py
⚙️ CodeRabbit configuration file
apps/backend/**/*.py: Focus on Python best practices, type hints, and async patterns.
Check for proper error handling and security considerations.
Verify compatibility with Python 3.12+.
Files:
apps/backend/context/builder.pyapps/backend/planner_lib/context.pyapps/backend/spec/requirements.py
🧠 Learnings (1)
📓 Common learnings
Learnt from: MikeeBuilds
Repo: AndyMik90/Auto-Claude PR: 661
File: apps/frontend/src/renderer/components/onboarding/OllamaModelSelector.tsx:176-189
Timestamp: 2026-01-04T23:59:45.209Z
Learning: In the AndyMik90/Auto-Claude repository, pre-existing i18n issues (hardcoded user-facing strings that should be localized) can be deferred to future i18n cleanup passes rather than requiring immediate fixes in PRs that don't introduce new i18n violations.
🧬 Code graph analysis (2)
apps/backend/context/builder.py (1)
apps/backend/project/config_parser.py (1)
read_text(59-65)
apps/backend/planner_lib/context.py (3)
tests/conftest.py (1)
spec_file(471-475)apps/backend/project/config_parser.py (1)
read_text(59-65)apps/backend/review/state.py (1)
load(92-106)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: CodeQL (javascript-typescript)
- GitHub Check: CodeQL (python)
🔇 Additional comments (9)
apps/backend/spec/requirements.py (4)
22-24: LGTM: Correct UTF-8 encoding for temporary file.The addition of
encoding="utf-8"toNamedTemporaryFilewith text mode is correct and prevents Windows encoding issues when writing instructions to the temporary file.
42-42: LGTM: Consistent UTF-8 encoding for reading temporary file.Correctly uses
encoding="utf-8"to read the temporary file, matching the encoding used when creating it on lines 22-24.
172-172: LGTM: Proper UTF-8 encoding for JSON output.The addition of
encoding="utf-8"when writingrequirements.jsonis correct and ensures cross-platform compatibility for JSON data.
183-183: LGTM: Consistent UTF-8 encoding for reading JSON.Correctly uses
encoding="utf-8"when readingrequirements.json, matching the encoding used when writing it on line 172.apps/backend/context/builder.py (2)
40-40: LGTM! UTF-8 encoding correctly added.The explicit UTF-8 encoding for reading the project index JSON file is correct and aligns with the PR's objective to fix Windows encoding issues.
233-235: LGTM! UTF-8 encoding correctly added.The explicit UTF-8 encoding for reading SERVICE_CONTEXT.md is correct. The multi-line formatting is consistent with ruff's line-length requirements as mentioned in the PR objectives.
apps/backend/planner_lib/context.py (3)
44-46: LGTM! UTF-8 encoding correctly added.The explicit UTF-8 encoding for reading spec.md is correct. The multi-line formatting aligns with ruff's line-length requirements.
52-53: LGTM! UTF-8 encoding correctly added.The explicit UTF-8 encoding for reading project_index.json is correct and consistent with the PR's objective.
59-60: LGTM! UTF-8 encoding correctly added.The explicit UTF-8 encoding for reading context.json is correct.
| with open(requirements_file, encoding="utf-8") as f: | ||
| requirements = json.load(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
LGTM! Consider catching UnicodeDecodeError for robustness.
The explicit UTF-8 encoding is correctly added for both requirements.json and complexity_assessment.json reads.
Optionally, consider adding UnicodeDecodeError to the exception handlers (lines 101 and 115) to gracefully handle corrupted or non-UTF-8 files:
except (json.JSONDecodeError, KeyError, UnicodeDecodeError):
passThis would make the workflow type detection more resilient, though the current implementation is acceptable since invalid files will fall back to spec-based detection.
Also applies to: 108-109
🤖 Prompt for AI Agents
In @apps/backend/planner_lib/context.py around lines 94 - 95, The file opens
requirements.json with encoding="utf-8" but the exception handlers that
currently catch (json.JSONDecodeError, KeyError) don’t handle
UnicodeDecodeError; update the except tuples in the blocks that parse
requirements_file and complexity_assessment.json to include UnicodeDecodeError
(i.e., catch (json.JSONDecodeError, KeyError, UnicodeDecodeError)) so corrupted
or non-UTF-8 files are handled gracefully during workflow type detection.
1. Remove unconditional cache clearing on Windows startup - Identified in PR AndyMik90#782 CodeRabbit review - Improves startup performance by removing unnecessary I/O - Cache clearing should be error-triggered, not preventive - File: apps/frontend/src/main/index.ts 2. Add validation for terminal preference enum - Identified in PR AndyMik90#782 CodeRabbit review - Prevent unsafe type cast of settings.preferredTerminal - Add isSupportedTerminal() type guard - Log warning when invalid preference detected - Fall back to system default gracefully - File: apps/frontend/src/main/terminal/pty-manager.ts Related: PR AndyMik90#782 (out-of-scope frontend improvements)
|
The frontend issues identified by CodeRabbit in the review (unconditional cache clearing and unsafe terminal type cast) have been addressed in PR #787. |
|
Update: PR #787 has been closed after discovering the cache clearing was part of a critical hotfix (PR #569) that prevents the app from becoming non-functional on Windows due to corrupted GPU cache artifacts. The terminal validation improvement is still valid, but the cache clearing removal needs more investigation to ensure we don't reintroduce the critical bug it was designed to fix. |
Security Follow-up: Regex Injection Audit Already Completed ✅During PR planning, a regex injection security audit was identified as potential follow-up work. However, after deep investigation, this work has already been completed in earlier commits: Commits That Addressed Regex Security:
Current State:✅ bump-version.js: No longer uses regex - replaced with string matching (eliminates vulnerability entirely) Why No Additional PR Needed:
The planned security audit session doc has been moved to "Completed Work" in the session docs README. Related Session Docs:
|
1. Encoding Check Script (scripts/check_encoding.py): - Validates all file operations have encoding="utf-8" - Checks open(), Path.read_text(), Path.write_text() - Checks json.load/dump with open() - Allows binary mode without encoding - Windows-compatible emoji output with UTF-8 reconfiguration 2. Pre-commit Config (.pre-commit-config.yaml): - Added check-file-encoding hook for apps/backend/ - Runs automatically before commits - Scoped to backend Python files only 3. Tests (tests/test_check_encoding.py): - Comprehensive test coverage (10 tests, all passing) - Tests detection of missing encoding - Tests allowlist for binary files - Tests multiple issues in single file - Tests file type filtering Purpose: - Prevent regression of 251 UTF-8 encoding fixes from PR AndyMik90#782 - Catch missing encoding in new code during development - Fast feedback loop for developers Implementation Notes: - Hook scoped to apps/backend/ to avoid false positives in test code - Uses simple regex matching for speed - Compatible with existing pre-commit infrastructure - Already caught 6 real issues in apps/backend/core/progress.py Related: PR AndyMik90#782 - Fix Windows UTF-8 encoding errors
Follow-up: Pre-commit Hook for Encoding Enforcement ✅Created PR #795 to add pre-commit hooks that automatically enforce UTF-8 encoding in file operations. What It Does:
Why It's Needed:Without this enforcement, the 251 fixes from this PR will regress as new code is added. The hook prevents that by catching missing encoding at commit time. Link: #795 This completes the planned follow-up work for encoding enforcement. |
1. CONTRIBUTING.md: - Added concise file encoding section after Code Style - DO/DON'T examples for common file operations - Covers open(), Path methods, json operations - References PR AndyMik90#782 and windows-development.md 2. guides/windows-development.md (NEW): - Comprehensive Windows development guide - File encoding (cp1252 vs UTF-8 issue) - Line endings, path separators, shell commands - Development environment recommendations - Common pitfalls and solutions - Testing guidelines 3. .github/PULL_REQUEST_TEMPLATE.md: - Added encoding checklist item for Python PRs - Helps catch missing encoding during review 4. guides/README.md: - Added windows-development.md to guide index - Organized with CLI-USAGE and linux guides Purpose: Educate developers about UTF-8 encoding requirements to prevent regressions of the 251 encoding issues fixed in PR AndyMik90#782. Automated checking via pre-commit hooks (PR AndyMik90#795) + developer education ensures long-term Windows compatibility. Related: - PR AndyMik90#782: Fix Windows UTF-8 encoding errors (251 instances) - PR AndyMik90#795: Add pre-commit hooks for encoding enforcement
Found by pre-commit hook testing in PR AndyMik90#795: - Line 96: Path.read_text() without encoding - Line 122: Path.write_text() without encoding These handle .gitignore file operations and could fail on Windows with special characters in gitignore comments or entries. Total fixes in PR AndyMik90#782: 253 instances (was 251, +2 from init.py)
Additional Encoding Issues FixedWhile testing PR #795 (pre-commit hooks), discovered 2 additional encoding issues in Fixed in latest commit (172e029):
Context: Updated Total:
The pre-commit hook from PR #795 will prevent these from recurring. ✅ |
|
Hope to continue pushing this merge, encountered a similar issue when using on Windows |
Problem
Windows Python defaults to cp1252 code page instead of UTF-8, causing encoding errors when reading/writing files with non-ASCII characters. This affects 251 file operations across 87 files in the backend.
Symptoms:
'charmap' codec can't decode byte 0x8dSolution
Add
encoding="utf-8"to all text file operations:os.fdopen()callsChanges
Files Modified: 87
Total Fixes: 251 instances
Line Changes: 186 insertions(+), 186 deletions(-)
Categories Fixed:
Verification ✅
Comprehensive checks performed:
"utf-8"(ruff format compliant)Issues found & fixed during verification:
os.fdopen()calls (file_lock.py, trust.py)Testing
Commits
3779abc- Start comprehensive UTF-8 encoding fix497f9f9- Fix Priorities 1-2 (Core & Agents - 18 instances)b650076- Fix Priorities 3-4 (Spec & Project - 26 instances)9c09d21- Fix Priorities 5-7 (Services, Analysis, Ideation - 43 instances)c800cdd- Fix Priorities 8-14 (Merge, Memory, GitHub, etc - 85 instances)b387ae1- Fix missed instances (23 instances)1788764- Fix os.fdopen() calls and duplicate encoding bug (3 instances)Impact
Fixes: Windows roadmap generation and all file I/O operations requiring UTF-8 encoding across the entire backend codebase.
Summary by CodeRabbit
Bug Fixes
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.