Skip to content

refactor: AutoModeService decomposition (Phases 1-6) #733 + fixes#771

Open
gsxdsm wants to merge 61 commits intoAutoMaker-Org:v0.15.0rcfrom
gsxdsm:refactor/auto-mode-service-gsxdsm
Open

refactor: AutoModeService decomposition (Phases 1-6) #733 + fixes#771
gsxdsm wants to merge 61 commits intoAutoMaker-Org:v0.15.0rcfrom
gsxdsm:refactor/auto-mode-service-gsxdsm

Conversation

@gsxdsm
Copy link
Collaborator

@gsxdsm gsxdsm commented Feb 15, 2026

See: #733

Bug fixes and improvements from @Shironex awesome refactor of AutoModeService

Summary by CodeRabbit

Release Notes

  • New Features

    • Claude Opus 4.6 with adaptive thinking mode support
    • New GPT-5.3 Codex model available
    • Playwright browser testing pre-installed in Docker
    • Enhanced multi-worktree auto-mode support
    • Improved plan approval and feature workflow orchestration
  • Improvements

    • Better Docker container environment setup
    • Enhanced CLI authentication detection
    • Improved error handling and user feedback for feature operations

Shironex and others added 30 commits February 14, 2026 18:51
- STACK.md - Technologies and dependencies
- ARCHITECTURE.md - System design and patterns
- STRUCTURE.md - Directory layout
- CONVENTIONS.md - Code style and patterns
- TESTING.md - Test structure
- INTEGRATIONS.md - External services
- CONCERNS.md - Technical debt and issues
Refactoring auto-mode-service.ts (5k+ lines) into smaller, focused services with clear boundaries.
User preference: keep .planning/ local-only
- Test lease counting basics (acquire/release semantics)
- Test running count queries (project and worktree level)
- Test feature state queries (isRunning, getRunningFeature, getAllRunning)
- Test edge cases (multiple features, multiple worktrees)
- 36 test cases documenting expected behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Lease-based reference counting for nested execution support
- acquire() creates entry with leaseCount: 1 or increments existing
- release() decrements leaseCount, deletes at 0 or with force:true
- Project and worktree-level running counts
- RunningFeature interface exported for type sharing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- AutoModeService now delegates to ConcurrencyManager for all running feature tracking
- Constructor accepts optional ConcurrencyManager for dependency injection
- Remove local RunningFeature interface (imported from ConcurrencyManager)
- Migrate all this.runningFeatures usages to concurrencyManager methods
- Update tests to use concurrencyManager.acquire() instead of direct Map access
- ConcurrencyManager accepts getCurrentBranch function for testability

BREAKING: AutoModeService no longer exposes runningFeatures Map directly.
Tests must use concurrencyManager.acquire() to add running features.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add TypedEventBus as wrapper around EventEmitter
- Implement emitAutoModeEvent method for auto-mode event format
- Add emit, subscribe, getUnderlyingEmitter methods
- Create comprehensive test suite (20 tests)
- Verify exact event format for frontend compatibility
- Create WorktreeResolver class for git worktree discovery
- Extract getCurrentBranch, findWorktreeForBranch, listWorktrees methods
- Add WorktreeInfo interface for worktree metadata
- Always resolve paths to absolute for cross-platform compatibility
- Add 20 unit tests covering all worktree operations
- Import TypedEventBus into AutoModeService
- Add eventBus property initialized via constructor injection
- Remove private emitAutoModeEvent method (now in TypedEventBus)
- Update all 66 emitAutoModeEvent calls to use this.eventBus
- Constructor accepts optional TypedEventBus for testing
- Create FeatureStateManager class for feature status updates
- Extract updateFeatureStatus, markFeatureInterrupted, resetStuckFeatures
- Extract updateFeaturePlanSpec, saveFeatureSummary, updateTaskStatus
- Persist BEFORE emit pattern for data integrity (Pitfall 2)
- Handle corrupted JSON with readJsonWithRecovery backup support
- Preserve pipeline_* statuses in markFeatureInterrupted
- Fix bug: version increment now checks old content before applying updates
- Add 33 unit tests covering all state management operations
…utoModeService

- Add WorktreeResolver and FeatureStateManager as constructor parameters
- Remove top-level getCurrentBranch function (now in WorktreeResolver)
- Delegate loadFeature, updateFeatureStatus to FeatureStateManager
- Delegate markFeatureInterrupted, resetStuckFeatures to FeatureStateManager
- Delegate updateFeaturePlanSpec, saveFeatureSummary, updateTaskStatus
- Replace findExistingWorktreeForBranch calls with worktreeResolver
- Update tests to mock featureStateManager instead of internal methods
- All 89 tests passing across 3 service files
- Extract plan approval workflow from AutoModeService
- Timeout-wrapped Promise creation via waitForApproval()
- Resolution handling (approve/reject) with needsRecovery flag
- Cancellation support for stopped features
- Per-project configurable timeout (default 30 minutes)
- Event emission through TypedEventBus for plan_rejected
- 24 tests covering approval, rejection, timeout, cancellation, recovery
- Tests use Vitest fake timers for timeout testing
- Covers needsRecovery flag for server restart recovery
- Covers plan_rejected event emission
- Covers configurable timeout from project settings
- Add PlanApprovalService import and constructor parameter
- Delegate waitForPlanApproval, cancelPlanApproval, hasPendingApproval
- resolvePlanApproval checks needsRecovery flag and calls executeFeature
- Remove pendingApprovals Map (now in PlanApprovalService)
- Remove PendingApproval interface (moved to plan-approval-service.ts)
- Extract parseTasksFromSpec for parsing tasks from spec content
- Extract marker detection functions (task start/complete, phase complete)
- Extract detectSpecFallback for non-Claude model support
- Extract extractSummary with multi-format support and last-match behavior
- Add 65 unit tests covering all functions and edge cases
- Add import for all spec parsing functions from spec-parser.ts
- Remove 209 lines of function definitions (now imported)
- Functions extracted: parseTasksFromSpec, parseTaskLine, detectTaskStartMarker,
  detectTaskCompleteMarker, detectPhaseCompleteMarker, detectSpecFallback, extractSummary
- All server tests pass (1608 tests)
- Create AgentExecutor class with constructor injection for TypedEventBus,
  FeatureStateManager, PlanApprovalService, and SettingsService
- Extract streaming pipeline from AutoModeService.runAgent()
- Implement execute() with stream processing, marker detection, file output
- Support recovery path with executePersistedTasks()
- Handle spec generation and approval workflow
- Multi-agent task execution with progress events
- Single-agent continuation fallback
- Debounced file writes (500ms)
- Heartbeat logging for silent model calls
- Abort signal handling throughout execution

Key interfaces:
- AgentExecutionOptions: All execution parameters
- AgentExecutionResult: responseText, specDetected, tasksCompleted, aborted
- Callbacks: waitForApproval, saveFeatureSummary, updateFeatureSummary, buildTaskPrompt
- Test constructor injection with all dependencies
- Test interface exports (AgentExecutionOptions, AgentExecutionResult)
- Test callback type signatures (WaitForApprovalFn, SaveFeatureSummaryFn, etc.)
- Test dependency injection patterns with custom implementations
- Verify execute method signature

Note: Full integration tests for streaming/marker detection require
complex mocking of @automaker/utils module which has hoisting issues.
Integration testing covered in E2E and auto-mode-service tests.
- Add AgentExecutor import to auto-mode-service.ts
- Add agentExecutor as constructor parameter (optional, with default)
- Initialize AgentExecutor with TypedEventBus, FeatureStateManager,
  PlanApprovalService, and SettingsService dependencies

This enables constructor injection for testing and prepares for
incremental delegation of runAgent() logic to AgentExecutor.
The AgentExecutor contains the full execution pipeline;
runAgent() delegation will be done incrementally to ensure
stability.
- Replace stream processing loop with AgentExecutor.execute() delegation
- Build AgentExecutionOptions object from runAgent() parameters
- Create callbacks for waitForApproval, saveFeatureSummary, etc.
- Remove ~930 lines of duplicated stream processing code
- Progress events now flow through AgentExecutor

File: auto-mode-service.ts reduced from 5086 to 4157 lines
- Add 11 new test cases for execute() behavior
- Test callback invocation (progress events, tool events)
- Test error handling (API errors, auth failures)
- Test result structure and response accumulation
- Test abort signal propagation
- Test branchName propagation in event payloads

Test file: 388 -> 935 lines (+547 lines)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-merge

- Extract pipeline orchestration logic from AutoModeService
- executePipeline: Sequential step execution with context continuity
- buildPipelineStepPrompt: Builds prompts with feature context and previous output
- detectPipelineStatus: Identifies pipeline status for resumption
- resumePipeline/resumeFromStep: Handle excluded steps and missing context
- executeTestStep: 5-attempt agent fix loop (REQ-F07)
- attemptMerge: Auto-merge with conflict detection (REQ-F05)
- buildTestFailureSummary: Concise test failure summary for agent

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Tests for executePipeline: step sequence, events, status updates
- Tests for buildPipelineStepPrompt: context inclusion, previous work
- Tests for detectPipelineStatus: pipeline status detection and parsing
- Tests for resumePipeline/resumeFromStep: excluded steps, slot management
- Tests for executeTestStep: 5-attempt fix loop, failure events
- Tests for attemptMerge: merge endpoint, conflict detection
- Tests for buildTestFailureSummary: output parsing

37 tests covering all core functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add PipelineOrchestrator constructor parameter and property
- Initialize PipelineOrchestrator with all required dependencies and callbacks
- Delegate executePipelineSteps to pipelineOrchestrator.executePipeline()
- Delegate detectPipelineStatus to pipelineOrchestrator.detectPipelineStatus()
- Delegate resumePipelineFeature to pipelineOrchestrator.resumePipeline()
- Add AutoModeService integration tests for delegation verification
- Test executePipeline delegation with context fields
- Test detectPipelineStatus delegation for pipeline/non-pipeline status
- Test resumePipeline delegation with autoLoadClaudeMd and useWorktrees
- Add edge case tests for abort signals, missing context, deleted steps
- Delete executePipelineSteps method (~115 lines)
- Delete buildPipelineStepPrompt method (~38 lines)
- Delete resumePipelineFeature method (~88 lines)
- Delete resumeFromPipelineStep method (~195 lines)
- Delete detectPipelineStatus method (~104 lines)
- Remove unused PipelineStatusInfo interface (~18 lines)
- Update comments to reference PipelineOrchestrator

Total reduction: ~546 lines (4150 -> 3604 lines)
- Extract loop lifecycle from AutoModeService
- Export AutoModeConfig, ProjectAutoLoopState, getWorktreeAutoLoopKey
- Export callback types for AutoModeService integration
- Methods: start/stop/isRunning/getConfig for project/worktree
- Failure tracking with threshold and quota error detection
- Sleep helper interruptible by abort signal
- 41 tests covering loop lifecycle and failure tracking
- Tests for getWorktreeAutoLoopKey key generation
- Tests for start/stop/isRunning/getConfig methods
- Tests for runAutoLoopForProject loop behavior
- Tests for failure tracking threshold and quota errors
- Tests for multiple concurrent projects/worktrees
- Tests for edge cases (null settings, reset errors)
- Extract executeFeature, stopFeature, buildFeaturePrompt from AutoModeService
- Export callback types for test mocking and integration
- Implement persist-before-emit pattern for status updates
- Support approved plan continuation and context resumption
- Track failures and signal pause when threshold reached

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Shironex and others added 22 commits February 14, 2026 18:53
- status.ts: Add facadeFactory parameter for per-project status
- context-exists.ts: Add facadeFactory parameter for context checks
- running-agents/index.ts: Add facade parameter for getRunningAgents

All routes maintain backward compatibility by accepting both
autoModeService (legacy) and facade/facadeFactory (new).
- stop-feature.ts: Add facade parameter for feature stopping
- stop.ts: Add facadeFactory parameter for auto loop control
- verify-feature.ts: Add facadeFactory parameter for verification
- commit-feature.ts: Add facadeFactory parameter for committing

All routes maintain backward compatibility by accepting both
autoModeService (legacy) and facade/facadeFactory (new).
…attern

- start.ts: Add facadeFactory parameter, use facade.isAutoLoopRunning/startAutoLoop
- resume-feature.ts: Add facadeFactory parameter, use facade.resumeFeature
- resume-interrupted.ts: Add facadeFactory parameter, use facade.resumeInterruptedFeatures
- All routes maintain backward compatibility with autoModeService fallback
- run-feature.ts: Add facadeFactory parameter, use facade.checkWorktreeCapacity/executeFeature
- follow-up-feature.ts: Add facadeFactory parameter, use facade.followUpFeature
- approve-plan.ts: Add facadeFactory parameter, use facade.resolvePlanApproval
- analyze-project.ts: Add facadeFactory parameter, use facade.analyzeProject
- All routes maintain backward compatibility with autoModeService fallback
- features/routes/list.ts: Add facadeFactory parameter, use facade.detectOrphanedFeatures
- projects/routes/overview.ts: Add facadeFactory parameter, use facade.getRunningAgents/getStatusForProject
- features/index.ts: Pass facadeFactory to list handler
- projects/index.ts: Pass facadeFactory to overview handler
- auto-mode/index.ts: Accept facadeFactory parameter and wire to all route handlers
- All routes maintain backward compatibility with autoModeService fallback
- Delete the 2705-line auto-mode-service.ts monolith
- Create AutoModeServiceCompat as compatibility layer for routes
- Create GlobalAutoModeService for cross-project operations
- Update all routes to use AutoModeServiceCompat type
- Add SharedServices interface for state sharing across facades
- Add getActiveProjects/getActiveWorktrees to AutoLoopCoordinator
- Delete obsolete monolith test files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- agent-executor.ts: 1317 -> 283 lines (merged duplicate task loops)
- execution-service.ts: 675 -> 314 lines (extracted callback types)
- pipeline-orchestrator.ts: 662 -> 471 lines (condensed methods)
- auto-loop-coordinator.ts: 590 -> 277 lines (condensed type definitions)
- recovery-service.ts: 558 -> 163 lines (simplified state methods)

Created execution-types.ts for callback type definitions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…rchestrator

- Create agent-executor-types.ts with execution option/result/callback types
- Create pipeline-types.ts with context/status/result types
- Condense agent-executor.ts stream processing and add buildExecOpts helper
- Condense pipeline-orchestrator.ts methods and simplify event emissions

Further line reduction limited by Prettier reformatting condensed code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…y URL

- Updated lint-staged dependency to use caret versioning (^16.2.7) in package.json and package-lock.json.
- Changed the resolved URL for node-gyp in package-lock.json from HTTPS to SSH.
The facade had stubs for runAgentFn that threw errors, causing feature
execution to fail with "runAgentFn not implemented in facade".

This fix wires both ExecutionService and PipelineOrchestrator runAgentFn
callbacks to properly call AgentExecutor.execute() with:
- Provider from ProviderFactory.getProviderForModel()
- Bare model from stripProviderPrefix()
- Proper AgentExecutorCallbacks for waitForApproval, saveFeatureSummary, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The wrench emoji (🔧) was accidentally removed in commit 6ec9a25
during the service condensing refactor. This broke:

1. Log parser - uses startsWith('🔧') to detect tool calls, causing
   them to be categorized as "info" instead of "tool_call"
2. Agent context parser - uses '🔧 Tool: TodoWrite' marker to find
   tasks, causing task list to not appear on kanban cards

This fix restores the emoji to fix both issues.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The PipelineOrchestrator passes previousContent to preserve the agent
output history when running pipeline steps. This was being lost because
the facade's runAgentFn callback wasn't forwarding it to AgentExecutor.

Without this fix, pipeline steps would overwrite the agent-output.md
file instead of appending to it with a "Follow-up Session" separator.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- agent-executor: move executeQuery into try block for proper heartbeat cleanup,
  re-parse tasks when edited plan is approved
- auto-loop-coordinator: handle feature execution failures with proper logging
  and failure tracking, support backward-compatible method signatures
- facade: delegate getActiveAutoLoopProjects/Worktrees to coordinator,
  always create own AutoLoopCoordinator (not shared), pass projectPath
  to approval methods and branchName to failure tracking
- global-service: document shared autoLoopCoordinator is for monitoring only
- execution-types: fix ExecuteFeatureFn type to match implementation
- feature-state-manager: use readJsonWithRecovery for loadFeature
- pipeline-orchestrator: add defensive null check and try/catch for
  merge response parsing
- plan-approval-service: use project-scoped keys to prevent cross-project
  collisions, maintain backward compatibility for featureId-only lookups

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ss-platform tests

- Extract merge logic from pipeline-orchestrator to merge-service.ts to avoid HTTP self-call
- Make agent-executor error handling provider-agnostic using shared isAuthenticationError utility
- Fix cross-platform path handling in tests using path.normalize/path.resolve helpers
- Add catch handlers in plan-approval-service tests to prevent unhandled promise rejection warnings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added caching for facades in AutoModeServiceCompat to persist auto loop state across API calls.
- Improved error handling in BoardView for starting and stopping auto mode, with user-friendly toast notifications.
- Updated WorktreePanel to manage auto mode state and concurrency limits more effectively.
- Enhanced useAutoMode hook to prevent state overwrites during transitions and synchronize UI with backend status.

This update optimizes performance and user experience in the auto mode feature.
… feature retrieval

- Updated getStatusForProject method in AutoModeServiceCompat and its facade to be asynchronous, allowing for better handling of feature status retrieval.
- Modified related status handlers in the server routes to await the updated method.
- Introduced a new method, getRunningFeaturesForWorktree, in ConcurrencyManager to improve feature ID retrieval based on branch normalization.
- Adjusted BoardView component to ensure consistent handling of running auto tasks across worktrees.

These changes improve the responsiveness and accuracy of the auto mode feature in the application.
…obal service

- Replaced synchronous feature retrieval with asynchronous logic in both AutoModeServiceFacade and GlobalAutoModeService.
- Updated filtering logic to resolve the primary branch name for main worktrees, improving accuracy in feature status checks.
- This change enhances the responsiveness and correctness of feature handling in auto mode operations.
- Added error handling for feature creation in BoardView component to log errors and display user-friendly messages.
- Updated persistFeatureCreate function to throw errors on failure, allowing for better state management.
- Introduced removal of features from state if server creation fails, improving user experience during conflicts.

Also added @playwright/test to devDependencies in package-lock.json for improved testing capabilities.
- Enhanced the Kanban card component to support additional feature statuses ('interrupted' and 'ready') in the backlog display logic.
- Updated relevant components to reflect these changes, ensuring consistent behavior across the UI.
@gsxdsm gsxdsm changed the base branch from main to v0.15.0rc February 15, 2026 18:40
@coderabbitai
Copy link

coderabbitai bot commented Feb 15, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

Comprehensive refactor restructuring the auto-mode service architecture from a monolithic design to a modular, facade-based system with centralized global management and per-project facades. Introduces supporting services for concurrency, execution, pipeline orchestration, plan approval, and recovery. Upgrades Claude to Opus 4.6 with adaptive thinking support. Adds extensive planning documentation, Playwright E2E testing infrastructure, and comprehensive unit tests.

Changes

Cohort / File(s) Summary
Planning Documentation
.gitignore, .planning/PROJECT.md, .planning/codebase/*
Added comprehensive planning and architecture documentation detailing refactor goals, codebase structure, conventions, integrations, stack, testing, and concerns audit.
Auto-Mode Architecture Refactor
apps/server/src/services/auto-mode/{global-service,facade,compat,index,types}.ts, apps/server/src/services/{auto-loop-coordinator,concurrency-manager,plan-approval-service,recovery-service,typed-event-bus,worktree-resolver,feature-state-manager,merge-service,pipeline-orchestrator,pipeline-types,execution-service,execution-types,agent-executor,agent-executor-types}.ts
New modular auto-mode architecture introducing GlobalAutoModeService, AutoModeServiceFacade, and AutoModeServiceCompat with supporting services for lifecycle, concurrency, approval, recovery, and pipeline orchestration. Dense logic with multiple interdependent components.
Route Handler Updates
apps/server/src/routes/{auto-mode,features,projects,running-agents}/{index,routes/*}.ts
Systematically replaced AutoModeService imports and type signatures with AutoModeServiceCompat across all route handlers. Consistent pattern across 17+ files with minor behavioral additions in specific routes (capacity checks, input validation, awaiting status calls).
Server-Side Service Updates
apps/server/src/index.ts, apps/server/src/services/{agent-service,ideation-service}.ts, apps/server/src/lib/sdk-options.ts, apps/server/src/providers/*.ts
Updated service initialization to use new auto-mode architecture. Enhanced model/provider handling for Claude-compatible providers. Updated Claude model from 4.5 to 4.6 with adaptive thinking support. Thinking level budgeting logic refinements.
Claude Model Upgrade
CLAUDE.md, apps/server/src/providers/{claude-provider,codex-models}.ts, apps/server/tests/unit/lib/model-resolver.test.ts, apps/server/tests/unit/providers/{claude-provider,provider-factory}.test.ts, docs/*, libs/model-resolver/*
Updated opus alias from claude-opus-4-5-20251101 to claude-opus-4-6 with adaptive thinking support. Added GPT-5.3-Codex model. Updated all references and tests to reflect new model identifiers.
Docker & E2E Testing
Dockerfile, docker-compose.override.yml.example, README.md, apps/server/package.json
Added Playwright Chromium pre-installation, PATH configuration, entrypoint permissions fix. Updated documentation with E2E testing instructions. Added @playwright/test 1.57.0 dependency.
Comprehensive Test Suites
apps/server/tests/{unit,integration}/services/*.test.ts
Added extensive unit tests for new services (~8000+ lines): AutoLoopCoordinator, ExecutionService, PipelineOrchestrator, PlanApprovalService, RecoveryService, ConcurrencyManager, SpecParser, FeatureStateManager, etc. Removed obsolete integration/unit tests for old AutoModeService.
UI Model & Thinking Level Support
apps/ui/src/components/views/board-view/{shared,dialogs}/*.tsx, apps/ui/src/components/views/settings-view/*/*.tsx
Added adaptive thinking model support with dynamic thinking-level filtering via getThinkingLevelsForModel. Updated model selectors and phase configurations to conditionally show adaptive option. Added model change normalization for thinking levels.
UI Auto-Mode & Worktree Integration
apps/ui/src/components/views/board-view/{worktree-panel,hooks}/*.ts, apps/ui/src/hooks/use-auto-mode.ts
Enhanced auto-mode lifecycle control with explicit max-concurrency handling. Added worktree-aware running tasks aggregation. Introduced transition guards to prevent optimistic state overwriting. Updated drag-drop to stop running features when moved to backlog.
Kanban Card UI Updates
apps/ui/src/components/views/board-view/components/kanban-card/*.tsx
Expanded draggable and action availability to include interrupted and ready statuses. Restructured backlog action UI (Edit/Make/Plan buttons). Added branch context to feature titles.
Setup & Auth Flow
apps/server/src/routes/setup/routes/verify-claude-auth.ts, apps/ui/src/components/views/setup-view/steps/claude-setup-step.tsx, apps/ui/src/lib/{electron,http-api-client}.ts
Enhanced Claude auth verification to detect and report authentication method (oauth/cli/api_key). Updated UI to display method-specific success messages. Extended SetupAPI return types with authType field.
Board View & Feature Creation
apps/ui/src/components/views/board-view.tsx, apps/ui/src/components/views/board-view/hooks/use-board-{actions,persistence}.ts
Added comprehensive error handling for feature creation with try-catch and recovery. Replaced running auto-tasks with all-worktrees aggregation. Added branch context to generated feature titles. Enhanced UI error feedback via toasts.
Configuration & Constants
apps/ui/src/components/views/board-view/shared/model-constants.ts, apps/ui/src/lib/agent-context-parser.ts, apps/ui/src/hooks/use-query-invalidation.ts
Added adaptive thinking level to constants and labels. Updated default model to claude-opus-4-6. Updated query invalidation events for auto-mode lifecycle. Added model display formatting for new Codex version.
Misc Documentation & Config
apps/ui/docs/AGENT_ARCHITECTURE.md, apps/ui/src/components/dialogs/sandbox-risk-dialog.tsx, libs/platform/src/index.ts
Updated architecture docs with new model version. Added Docker troubleshooting guidance. Exported FileCheckResult/DirectoryCheckResult types from platform.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • PR #757: Introduces Claude Opus 4.6 and adaptive thinking support across model maps, providers, and UI — directly overlapping with model upgrade changes.
  • PR #679: Introduces ParsedTask/PlanSpec types, spec/summary parsing, and recovery/task events — directly related to new plan-approval and recovery service implementations.
  • PR #745: Pre-installs Playwright Chromium in Docker setup — related to Playwright/E2E testing infrastructure changes.

Suggested labels

Refactor, Architecture, Tests, Feature


🐰 Through modular paths, a grand refactor flows,
Global and per-project, the architecture grows,
Facades coordinate, services align,
Opus now wears version 4.6 so fine!
Tests abound like gardens where bugs fear to go,
A maze transformed to order—behold the show! 🌿

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: a multi-phase refactor decomposing AutoModeService into smaller services. It is concise, specific, and directly related to the primary objective of the changeset.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into v0.15.0rc

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

❤️ Share

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

@Shironex Shironex added Testers-Requested Request for others to test an enhancement or bug fix/etc. Refactor A complete logic rewrite is requested or being performed for an issue. Do Not Merge Use this label if something should not be merged. labels Feb 15, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

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

This pull request delivers a significant architectural overhaul by decomposing the core AutoModeService into a suite of smaller, focused services. This refactoring addresses accumulated technical debt, improves modularity, and enhances testability across the backend. Concurrently, it integrates newer AI models, streamlines Docker-based automated testing, and introduces several user interface improvements to provide a more stable and responsive experience.

Highlights

  • AutoModeService Decomposition: The monolithic AutoModeService has been refactored into several specialized services, including AgentExecutor, AutoLoopCoordinator, ConcurrencyManager, ExecutionService, FeatureStateManager, PlanApprovalService, RecoveryService, PipelineOrchestrator, WorktreeResolver, TypedEventBus, SpecParser, and MergeService. A compatibility layer (AutoModeServiceCompat) and facade (AutoModeServiceFacade) have been introduced to ensure existing API routes continue to function during this phased transition.
  • Comprehensive Documentation: A new .planning/codebase directory has been added, containing detailed Markdown files that document the project's architecture, technical concerns, coding conventions, external integrations, technology stack, and testing patterns. This significantly enhances project understanding and onboarding.
  • AI Model Updates: The project now supports Claude Opus 4.6, which includes adaptive thinking capabilities, and integrates OpenAI's GPT-5.3 Codex model. Corresponding UI and backend logic have been updated to leverage these new models.
  • Dockerized Automated Testing: Playwright Chromium is now pre-installed within the Docker image, enabling AI agents to perform automated verification tests directly within the containerized environment without additional setup.
  • Improved Auto-Mode UI/UX: User experience enhancements include more robust error handling for feature creation, refined drag-and-drop behavior for in-progress features (allowing them to be moved to the backlog to stop the agent), and improved synchronization of auto-mode status with the backend for better optimistic UI updates.

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

Changelog
  • .gitignore
    • Added local planning and metadata files to ignore.
  • .planning/PROJECT.md
    • Added a new project planning document.
  • .planning/codebase/ARCHITECTURE.md
    • Added new architecture documentation.
  • .planning/codebase/CONCERNS.md
    • Added new codebase concerns documentation.
  • .planning/codebase/CONVENTIONS.md
    • Added new coding conventions documentation.
  • .planning/codebase/INTEGRATIONS.md
    • Added new external integrations documentation.
  • .planning/codebase/STACK.md
    • Added new technology stack documentation.
  • .planning/codebase/STRUCTURE.md
    • Added new codebase structure documentation.
  • .planning/codebase/TESTING.md
    • Added new testing patterns documentation.
  • CLAUDE.md
    • Updated Claude Opus model alias.
  • Dockerfile
    • Installed Playwright Chromium for automated testing.
  • README.md
    • Updated documentation for Playwright Chromium in Docker.
  • apps/server/package.json
    • Updated Claude and OpenAI SDKs, added Playwright dev dependency.
  • apps/server/src/index.ts
    • Updated Claude auth check, switched to AutoModeServiceCompat.
  • apps/server/src/lib/sdk-options.ts
    • Modified thinking options for adaptive models.
  • apps/server/src/providers/claude-provider.ts
    • Updated Claude Opus model and thinking logic.
  • apps/server/src/providers/codex-models.ts
    • Added GPT-5.3 Codex and updated descriptions.
  • apps/server/src/providers/provider-factory.ts
    • Updated JSDoc example for Claude Opus.
  • apps/server/src/routes/auto-mode/index.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/auto-mode/routes/analyze-project.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/auto-mode/routes/approve-plan.ts
    • Updated AutoModeService type and resolvePlanApproval parameters.
  • apps/server/src/routes/auto-mode/routes/commit-feature.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/auto-mode/routes/context-exists.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/auto-mode/routes/follow-up-feature.ts
    • Updated AutoModeService type and removed .finally() block.
  • apps/server/src/routes/auto-mode/routes/resume-feature.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/auto-mode/routes/resume-interrupted.ts
    • Updated AutoModeService type and added await to resumeInterruptedFeatures.
  • apps/server/src/routes/auto-mode/routes/run-feature.ts
    • Updated AutoModeService type and removed .finally() block.
  • apps/server/src/routes/auto-mode/routes/start.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/auto-mode/routes/status.ts
    • Updated AutoModeService type and made getStatusForProject asynchronous.
  • apps/server/src/routes/auto-mode/routes/stop-feature.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/auto-mode/routes/stop.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/auto-mode/routes/verify-feature.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/enhance-prompt/routes/enhance.ts
    • Modified model resolution logic for custom providers.
  • apps/server/src/routes/features/index.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/features/routes/list.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/github/routes/validate-issue.ts
    • Modified model resolution logic for custom providers.
  • apps/server/src/routes/projects/index.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/projects/routes/overview.ts
    • Updated AutoModeService type and method calls to be asynchronous.
  • apps/server/src/routes/running-agents/index.ts
    • Updated AutoModeService type to AutoModeServiceCompat.
  • apps/server/src/routes/running-agents/routes/index.ts
    • Updated AutoModeService type and method calls to be asynchronous.
  • apps/server/src/routes/setup/routes/verify-claude-auth.ts
    • Added authType to Claude auth verification response.
  • apps/server/src/services/agent-executor-types.ts
    • Added new types for agent execution.
  • apps/server/src/services/agent-executor.ts
    • Added new service for core agent execution.
  • apps/server/src/services/agent-service.ts
    • Modified model resolution logic for custom providers.
  • apps/server/src/services/auto-loop-coordinator.ts
    • Added new service for auto-mode loop management.
  • apps/server/src/services/auto-mode/compat.ts
    • Added new compatibility shim for AutoModeService.
  • apps/server/src/services/auto-mode/facade.ts
    • Added new per-project facade for auto-mode.
  • apps/server/src/services/auto-mode/global-service.ts
    • Added new service for global auto-mode operations.
  • apps/server/src/services/auto-mode/index.ts
    • Added new module entry point for auto-mode services.
  • apps/server/src/services/auto-mode/types.ts
    • Added new types for auto-mode services.
  • apps/server/src/services/concurrency-manager.ts
    • Added new service for managing running feature concurrency.
  • apps/server/src/services/execution-service.ts
    • Added new service for feature execution lifecycle.
  • apps/server/src/services/execution-types.ts
    • Added new types for execution service callbacks.
  • apps/server/src/services/feature-state-manager.ts
    • Added new service for managing feature status and persistence.
  • apps/server/src/services/ideation-service.ts
    • Modified model resolution logic for custom providers.
  • apps/server/src/services/merge-service.ts
    • Added new service for direct git merge operations.
  • apps/server/src/services/pipeline-orchestrator.ts
    • Added new service for pipeline step execution.
  • apps/server/src/services/pipeline-types.ts
    • Added new types for pipeline orchestrator.
  • apps/server/src/services/plan-approval-service.ts
    • Added new service for plan approval workflow.
  • apps/server/src/services/recovery-service.ts
    • Added new service for crash recovery and feature resumption.
  • apps/server/src/services/spec-parser.ts
    • Added new service for parsing spec content.
  • apps/server/src/services/typed-event-bus.ts
    • Added new type-safe event bus.
  • apps/server/src/services/worktree-resolver.ts
    • Added new service for git worktree resolution.
  • apps/server/tests/integration/services/auto-mode-service.integration.test.ts
    • Removed old integration tests.
  • apps/server/tests/unit/lib/model-resolver.test.ts
    • Updated Claude Opus model ID in tests.
  • apps/server/tests/unit/lib/sdk-options.test.ts
    • Added tests for adaptive thinking.
  • apps/server/tests/unit/providers/claude-provider.test.ts
    • Updated Claude Opus model ID in tests.
  • apps/server/tests/unit/providers/provider-factory.test.ts
    • Updated Claude Opus model ID in tests.
  • apps/server/tests/unit/services/agent-executor.test.ts
    • Added new unit tests for AgentExecutor.
  • apps/server/tests/unit/services/auto-loop-coordinator.test.ts
    • Added new unit tests for AutoLoopCoordinator.
  • apps/server/tests/unit/services/auto-mode-service-planning.test.ts
    • Removed old unit tests.
  • apps/server/tests/unit/services/auto-mode-service.test.ts
    • Removed old unit tests.
  • apps/server/tests/unit/services/execution-service.test.ts
    • Added new unit tests for ExecutionService.
  • apps/server/tests/unit/services/feature-state-manager.test.ts
    • Added new unit tests for FeatureStateManager.
  • apps/server/tests/unit/services/pipeline-orchestrator.test.ts
    • Added new unit tests for PipelineOrchestrator.
  • apps/server/tests/unit/services/plan-approval-service.test.ts
    • Added new unit tests for PlanApprovalService.
  • apps/server/tests/unit/services/recovery-service.test.ts
    • Added new unit tests for RecoveryService.
  • apps/server/tests/unit/services/spec-parser.test.ts
    • Added new unit tests for SpecParser.
  • apps/server/tests/unit/services/typed-event-bus.test.ts
    • Added new unit tests for TypedEventBus.
  • apps/server/tests/unit/services/worktree-resolver.test.ts
    • Added new unit tests for WorktreeResolver.
  • apps/ui/docs/AGENT_ARCHITECTURE.md
    • Updated Claude Opus model ID.
  • apps/ui/src/components/dialogs/sandbox-risk-dialog.tsx
    • Added Docker troubleshooting steps.
  • apps/ui/src/components/views/board-view.tsx
    • Updated runningAutoTasks prop, added error handling for feature creation, and improved merge conflict feature title.
  • apps/ui/src/components/views/board-view/components/kanban-card/card-actions.tsx
    • Enabled edit/make actions for interrupted and ready statuses.
  • apps/ui/src/components/views/board-view/components/kanban-card/card-header.tsx
    • Enabled backlog column actions for interrupted and ready statuses.
  • apps/ui/src/components/views/board-view/components/kanban-card/kanban-card.tsx
    • Enabled dragging for interrupted and ready statuses.
  • apps/ui/src/components/views/board-view/dialogs/add-feature-dialog.tsx
    • Added logic to normalize thinking levels based on model capabilities.
  • apps/ui/src/components/views/board-view/hooks/use-board-actions.ts
    • Added error handling for feature creation.
  • apps/ui/src/components/views/board-view/hooks/use-board-drag-drop.ts
    • Modified drag logic for running features to allow stopping via drag to backlog.
  • apps/ui/src/components/views/board-view/hooks/use-board-persistence.ts
    • Modified persistFeatureCreate to throw errors.
  • apps/ui/src/components/views/board-view/shared/model-constants.ts
    • Added 'adaptive' thinking level.
  • apps/ui/src/components/views/board-view/shared/thinking-level-selector.tsx
    • Updated to filter thinking levels by model and display adaptive thinking description.
  • apps/ui/src/components/views/board-view/worktree-panel/worktree-panel.tsx
    • Updated auto-mode toggle to use app store actions for state management.
  • apps/ui/src/components/views/settings-view/model-defaults/phase-model-selector.tsx
    • Updated thinking level selection logic for adaptive models.
  • apps/ui/src/components/views/settings-view/providers/codex-model-configuration.tsx
    • Added GPT-5.3 Codex model and updated descriptions.
  • apps/ui/src/components/views/setup-view/steps/claude-setup-step.tsx
    • Enhanced Claude auth verification UI to show OAuth vs CLI.
  • apps/ui/src/hooks/use-auto-mode.ts
    • Implemented optimistic UI updates and backend synchronization for auto-mode status.
  • apps/ui/src/hooks/use-query-invalidation.ts
    • Expanded event types that trigger feature list invalidation.
  • apps/ui/src/lib/agent-context-parser.ts
    • Updated default model and model name formatting for new Claude/Codex models.
  • apps/ui/src/lib/electron.ts
    • Updated verifyClaudeAuth return type.
  • apps/ui/src/lib/http-api-client.ts
    • Updated verifyClaudeAuth return type.
  • docker-compose.override.yml.example
    • Updated comments for Playwright cache.
  • docs/llm-shared-packages.md
    • Updated Claude Opus model ID.
  • docs/server/providers.md
    • Updated Claude Opus model ID.
  • docs/server/utilities.md
    • Updated Claude Opus model ID.
  • libs/model-resolver/README.md
    • Updated Claude Opus model ID.
  • libs/model-resolver/tests/resolver.test.ts
    • Updated Claude Opus model ID in tests.
  • libs/platform/src/index.ts
    • Exported new types FileCheckResult and DirectoryCheckResult.
Activity
  • The pull request title and body indicate this is a follow-up to a previous refactoring PR (refactor: AutoModeService decomposition (Phases 1-6) #733), continuing the decomposition work initiated by @Shironex.
  • The extensive addition of new documentation files under .planning/codebase suggests a thorough analysis and planning phase for this refactoring.
  • The removal of old monolithic service tests and the addition of numerous new unit tests for the decomposed services indicate a strong focus on testability and code quality.
  • The use of a compatibility layer (AutoModeServiceCompat) suggests a phased rollout strategy for the refactoring, minimizing immediate breaking changes for existing API consumers.
Using Gemini Code Assist

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

Invoking Gemini

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

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

Customization

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

Limitations & Feedback

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

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

Footnotes

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

@Shironex Shironex added the Tests Adding / Updating / Removing tests across the project. label Feb 15, 2026
Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

This is an excellent and extensive refactoring of the monolithic AutoModeService. Breaking it down into smaller, focused services like ConcurrencyManager, ExecutionService, and RecoveryService is a huge step forward for maintainability and testability. The use of a compatibility layer to ensure a smooth transition is a great approach.

I'm also impressed with the number of bug fixes and UX improvements included, such as the correct handling of custom provider model IDs, more robust UI state syncing, and the ability to stop a running feature by dragging it to the backlog. The new planning and architecture documents are a fantastic addition.

I've found one very minor issue in the .gitignore file, but overall this is a high-quality pull request that significantly improves the codebase's architecture.

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

Labels

Do Not Merge Use this label if something should not be merged. Refactor A complete logic rewrite is requested or being performed for an issue. Testers-Requested Request for others to test an enhancement or bug fix/etc. Tests Adding / Updating / Removing tests across the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants