perf: eliminate redundant file read in detectPipelineStatus

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 <noreply@anthropic.com>
This commit is contained in:
Stephan Rieche
2026-01-02 13:04:01 +01:00
parent 7a2a3ef500
commit 2d309f6833

View File

@@ -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`