Skip to content

Preserve pipeline work by using waiting_approval on post-completion errors#836

Merged
gsxdsm merged 4 commits intoAutoMaker-Org:v1.0.0rcfrom
gsxdsm:fix/pipeline-not-finishing
Mar 5, 2026
Merged

Preserve pipeline work by using waiting_approval on post-completion errors#836
gsxdsm merged 4 commits intoAutoMaker-Org:v1.0.0rcfrom
gsxdsm:fix/pipeline-not-finishing

Conversation

@gsxdsm
Copy link
Collaborator

@gsxdsm gsxdsm commented Mar 5, 2026

Summary

  • Track pipeline completion state and use waiting_approval instead of backlog when errors occur after pipeline steps finish
  • Prevents loss of completed pipeline work when post-completion operations fail
  • Applies to both normal execution and resume-from-step code paths

Changes

  • execution-service.ts: Added pipelineCompleted flag to track successful pipeline execution. When a post-pipeline error occurs, set feature status to waiting_approval instead of backlog to preserve the completed work.
  • pipeline-orchestrator.ts: Added pipelineCompleted flag in the resume path with the same logic to maintain consistency across both execution flows.
  • execution-service.test.ts: Added two test cases to verify the new behavior:
    • Confirms waiting_approval is used when errors occur after pipeline completion
    • Confirms backlog is still used when errors occur during pipeline execution itself

Summary by CodeRabbit

  • Bug Fixes

    • Improved post-pipeline error handling: if an error occurs after pipeline steps finish, feature status now moves to "waiting for approval" (preserving completed work) instead of reverting to "backlog"; terminal states like "merge_conflict" are preserved and not overwritten.
  • Tests

    • Added unit tests verifying status transitions for errors occurring both before and after pipeline completion.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 888dc2d2-4f78-415f-9160-48fde6ecd310

📥 Commits

Reviewing files that changed from the base of the PR and between c196bc6 and 4f4eae7.

📒 Files selected for processing (1)
  • apps/server/src/services/execution-service.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/server/src/services/execution-service.ts

📝 Walkthrough

Walkthrough

The PR adds a pipelineCompleted flag to pipeline execution/resume flows and changes error handling: if an error occurs after pipeline steps finished, fallback status is waiting_approval; if before completion, fallback is backlog. Terminal states (e.g., merge_conflict) are checked and preserved.

Changes

Cohort / File(s) Summary
Pipeline execution & orchestration
apps/server/src/services/execution-service.ts, apps/server/src/services/pipeline-orchestrator.ts
Introduce pipelineCompleted flag set after pipeline steps finish; on errors choose fallback status based on the flag (waiting_approval if completed, else backlog); add logs about preserving pipeline work; load current feature before status updates to avoid overwriting terminal states (e.g., merge_conflict).
Unit tests
apps/server/tests/unit/services/execution-service.test.ts
Add tests for error-after-completion (expects waiting_approval, no backlog update) and error-before-completion (expects backlog update); mocks simulate pipeline step completion and load/refresh flow.

Sequence Diagram(s)

sequenceDiagram
    actor Orchestrator
    participant ExecutionService
    participant Agent
    participant FeatureStore

    Orchestrator->>ExecutionService: resumeFromStep(context)
    ExecutionService->>Agent: executePipeline(steps)
    Agent-->>ExecutionService: steps complete
    ExecutionService-->>ExecutionService: set pipelineCompleted = true
    ExecutionService->>FeatureStore: update feature (normal completion)

    alt error after completion
        Agent--xExecutionService: error thrown
        ExecutionService->>FeatureStore: load current feature
        ExecutionService->>FeatureStore: update -> waiting_approval (if not terminal)
        ExecutionService->>Orchestrator: emit auto_mode_error
    else error before completion
        Agent--xExecutionService: error thrown
        ExecutionService->>FeatureStore: update -> backlog
        ExecutionService->>Orchestrator: emit auto_mode_error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through steps, checks neat and sweet,

pipelineCompleted marked each finished beat.
When errors came after, I kept the run alive,
waiting_approval helps the work survive.
If it failed before, backlog keeps the drive.

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately summarizes the main change: introducing waiting_approval status on post-completion errors to preserve pipeline work, which is the core objective reflected in all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 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.

@gsxdsm gsxdsm changed the base branch from v1.0.0 to v1.0.0rc March 5, 2026 02:12
@gsxdsm
Copy link
Collaborator Author

gsxdsm commented Mar 5, 2026

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 enhances the reliability and user experience of Automaker by preserving pipeline work, improving git command execution, and adding features for orphaned feature resolution. It also introduces a mock provider for testing purposes and improves provider context resolution.

Highlights

  • Pipeline Completion Tracking: The PR introduces a pipelineCompleted flag to accurately track the completion state of pipelines, ensuring that work is not lost due to post-completion errors.
  • Status Update Logic: When post-completion errors occur, the feature status is now set to waiting_approval instead of backlog, preserving completed work for review.
  • Background Resume Consistency: The pipelineCompleted flag is also implemented in the resume-from-step code path to maintain consistent behavior across both execution flows.
  • Git Path Extension: The PR extends the PATH environment variable to ensure git commands are found in various environments, such as Electron and CI.
  • Provider Context Resolution: The PR introduces a new resolveProviderContext function to resolve provider and model configurations, supporting explicit provider lookup and fallback to model-based lookup.
  • Orphaned Feature Handling: The PR adds new routes and handlers to detect and resolve orphaned features, providing options to delete, create worktrees, or move features to a different branch.

🧠 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.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/e2e-tests.yml
Activity
  • The pull request introduces a new pipelineCompleted flag to track pipeline completion state and uses waiting_approval instead of backlog when errors occur after pipeline steps finish.
  • The changes prevent loss of completed pipeline work when post-completion operations fail and applies to both normal execution and resume-from-step code paths.
Using Gemini Code Assist

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

Invoking Gemini

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

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

Customization

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

Limitations & Feedback

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

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

Footnotes

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

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a pipelineCompleted flag to preserve work by setting a feature's status to waiting_approval instead of backlog if an error occurs after the pipeline has successfully finished. This logic is correctly implemented in both execution-service.ts for new executions and pipeline-orchestrator.ts for resumed features. The new unit tests in execution-service.test.ts effectively validate this behavior. The changes are well-aligned with the goal of preventing loss of completed work. I have one minor suggestion to improve code consistency.

Comment on lines +444 to +454
// If pipeline steps completed successfully, don't send the feature back to backlog.
// The pipeline work is done — set to waiting_approval so the user can review.
const fallbackStatus = pipelineCompleted ? 'waiting_approval' : 'backlog';
if (pipelineCompleted) {
logger.info(
`[resumeFromStep] Feature ${featureId} failed after pipeline completed. ` +
`Setting status to waiting_approval instead of backlog to preserve pipeline work.`
);
}
logger.error(`Pipeline resume failed for ${featureId}:`, error);
await this.updateFeatureStatusFn(projectPath, featureId, 'backlog');
await this.updateFeatureStatusFn(projectPath, featureId, fallbackStatus);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with execution-service.ts, it's a good practice to log the error as soon as it's caught, at the beginning of the else block. This improves readability and ensures error logging is the first action in the error handling path.

Suggested change
// If pipeline steps completed successfully, don't send the feature back to backlog.
// The pipeline work is done — set to waiting_approval so the user can review.
const fallbackStatus = pipelineCompleted ? 'waiting_approval' : 'backlog';
if (pipelineCompleted) {
logger.info(
`[resumeFromStep] Feature ${featureId} failed after pipeline completed. ` +
`Setting status to waiting_approval instead of backlog to preserve pipeline work.`
);
}
logger.error(`Pipeline resume failed for ${featureId}:`, error);
await this.updateFeatureStatusFn(projectPath, featureId, 'backlog');
await this.updateFeatureStatusFn(projectPath, featureId, fallbackStatus);
logger.error(`Pipeline resume failed for ${featureId}:`, error);
// If pipeline steps completed successfully, don't send the feature back to backlog.
// The pipeline work is done — set to waiting_approval so the user can review.
const fallbackStatus = pipelineCompleted ? 'waiting_approval' : 'backlog';
if (pipelineCompleted) {
logger.info(
`[resumeFromStep] Feature ${featureId} failed after pipeline completed. ` +
`Setting status to waiting_approval instead of backlog to preserve pipeline work.`
);
}
await this.updateFeatureStatusFn(projectPath, featureId, fallbackStatus);

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/server/src/services/execution-service.ts`:
- Around line 546-555: The post-pipeline fallback unconditionally calls
updateFeatureStatusFn and can clobber a terminal "merge_conflict" state; modify
the executeFeature flow so before calling updateFeatureStatusFn(projectPath,
featureId, fallbackStatus) you read the current feature status (or use the
feature object available in scope) and only call updateFeatureStatusFn if
currentStatus !== 'merge_conflict' (or not any other terminal states you want
preserved); reference updateFeatureStatusFn, executeFeature, pipelineCompleted,
fallbackStatus, and merge_conflict when making this guard.

In `@apps/server/src/services/pipeline-orchestrator.ts`:
- Around line 444-455: The catch block currently calls
updateFeatureStatusFn(projectPath, featureId, fallbackStatus) unconditionally
and can overwrite an existing 'merge_conflict' status; before calling
updateFeatureStatusFn, read the feature's current status (e.g., via an existing
accessor like this.getFeatureById / this.getFeatureStatus / fetching the feature
by featureId) and only call updateFeatureStatusFn if currentStatus !==
'merge_conflict'; reference the symbols featureId, fallbackStatus,
updateFeatureStatusFn and the surrounding resumeFromStep error handling so the
guard skips the status update when a merge_conflict is already set.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5207c54-3189-43cb-ae1b-105a6871b8f9

📥 Commits

Reviewing files that changed from the base of the PR and between 26b73df and b1be967.

📒 Files selected for processing (3)
  • apps/server/src/services/execution-service.ts
  • apps/server/src/services/pipeline-orchestrator.ts
  • apps/server/tests/unit/services/execution-service.test.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
apps/server/src/services/execution-service.ts (1)

556-559: ⚠️ Potential issue | 🟠 Major

Error handler can throw while handling an error.

At Line 556, await this.loadFeatureFn(...) is inside catch but not locally guarded. If reload fails, the catch path throws again and aborts fallback status handling (matches the pipeline failure signal around Line 556).

Suggested hardening
-        const currentFeature = await this.loadFeatureFn(projectPath, featureId);
+        const currentFeature = await this.loadFeatureFn(projectPath, featureId).catch((loadErr) => {
+          logger.warn(
+            `[executeFeature] Failed to reload feature ${featureId} in error handler; applying fallback status.`,
+            loadErr
+          );
+          return null;
+        });
         if (currentFeature?.status !== 'merge_conflict') {
           await this.updateFeatureStatusFn(projectPath, featureId, fallbackStatus);
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/server/src/services/execution-service.ts` around lines 556 - 559, The
catch handler currently calls this.loadFeatureFn(projectPath, featureId) which
can itself throw and abort the fallback status work; wrap the load+status-check
in a local try/catch (or use a safe helper) so failures to reload the feature
are caught and logged but do not rethrow, then proceed to call
this.updateFeatureStatusFn(projectPath, featureId, fallbackStatus) when
appropriate; reference the loadFeatureFn, updateFeatureStatusFn, projectPath,
featureId, and fallbackStatus symbols so you locate and harden that catch path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@apps/server/src/services/execution-service.ts`:
- Around line 556-559: The catch handler currently calls
this.loadFeatureFn(projectPath, featureId) which can itself throw and abort the
fallback status work; wrap the load+status-check in a local try/catch (or use a
safe helper) so failures to reload the feature are caught and logged but do not
rethrow, then proceed to call this.updateFeatureStatusFn(projectPath, featureId,
fallbackStatus) when appropriate; reference the loadFeatureFn,
updateFeatureStatusFn, projectPath, featureId, and fallbackStatus symbols so you
locate and harden that catch path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 78efc308-c685-48c2-a330-b2b6ae79c534

📥 Commits

Reviewing files that changed from the base of the PR and between b1be967 and 2c25e4f.

📒 Files selected for processing (2)
  • apps/server/src/services/execution-service.ts
  • apps/server/src/services/pipeline-orchestrator.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/server/src/services/pipeline-orchestrator.ts

gsxdsm added 2 commits March 4, 2026 19:01
fix: Add logging when feature reload fails during status update
```
@gsxdsm gsxdsm merged commit 7be8163 into AutoMaker-Org:v1.0.0rc Mar 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant