From 2d309f6833d75e226487edcfa8c733f1910ceb3a Mon Sep 17 00:00:00 2001 From: Stephan Rieche Date: Fri, 2 Jan 2026 13:04:01 +0100 Subject: [PATCH] perf: eliminate redundant file read in detectPipelineStatus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unnecessary call to pipelineService.getStep() which was causing a redundant file read of pipeline.json. The config is already loaded at line 2807, so we can find the step directly from the in-memory config. Changes: - Sort config.steps first - Find stepIndex using findIndex() - Get step directly from sortedSteps[stepIndex] instead of calling getStep() - Simplify null check to only check !step instead of stepIndex === -1 || !step This optimization reduces file I/O operations and improves performance when resuming pipeline features. Co-authored-by: gemini-code-assist bot 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- apps/server/src/services/auto-mode-service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/server/src/services/auto-mode-service.ts b/apps/server/src/services/auto-mode-service.ts index 12b2620e..5460b02c 100644 --- a/apps/server/src/services/auto-mode-service.ts +++ b/apps/server/src/services/auto-mode-service.ts @@ -2816,12 +2816,12 @@ Review the previous work and continue the implementation. If the feature appears }; } - // Find the step using PipelineService - const step = await pipelineService.getStep(projectPath, stepId); + // Find the step directly from config (already loaded, avoid redundant file read) const sortedSteps = [...config.steps].sort((a, b) => a.order - b.order); const stepIndex = sortedSteps.findIndex((s) => s.id === stepId); + const step = stepIndex === -1 ? null : sortedSteps[stepIndex]; - if (stepIndex === -1 || !step) { + if (!step) { // Step not found in current config - step was deleted/changed console.warn( `[AutoMode] Feature ${featureId} stuck in step ${stepId} which no longer exists in pipeline config`