Skip to content

[#314] 🐛 - Error merging release branch after successful deployment#315

Merged
efraespada merged 16 commits intodevelopfrom
bugfix/314-error-merging-release-branch-after-successful-deployment
Feb 17, 2026
Merged

[#314] 🐛 - Error merging release branch after successful deployment#315
efraespada merged 16 commits intodevelopfrom
bugfix/314-error-merging-release-branch-after-successful-deployment

Conversation

@efraespada
Copy link
Member

@efraespada efraespada commented Feb 15, 2026

📌 Summary

Fixes an issue where the release branch merge to develop fails after a successful deployment. The problem occurred because after merging the release branch into the default branch (main/master), attempting to merge the release branch directly into develop could fail. The fix changes the second merge operation to use the default branch as the source instead of the release branch, following the same pattern used for hotfix branches.


🎯 Related Issues / Tickets


🧩 Scope of Changes

  • Updated: Modified the release branch merge flow in deployed_action_use_case.ts to merge default branch into develop (instead of release branch into develop) after the initial release-to-default merge
  • Updated: Adjusted test expectations in deployed_action_use_case.test.ts to match the corrected merge behavior

🛠️ Technical Details

The issue occurred in the DeployedActionUseCase when handling release branch deployments:

Before (buggy):

  1. Merge release branch into default branch
  2. Merge release branch into develop

After (fixed):

  1. Merge release branch into default branch
  2. Merge default branch into develop

The hotfix branch flow already used this correct pattern (hotfix→main, then main→develop). The release flow has been updated to match, ensuring that after the release is merged into main, the updated main branch (which now contains all release changes) is merged into develop. This prevents merge failures that could occur when trying to merge the release branch directly into develop after it had already been merged into main.


🔍 How to Test

  1. Create a release issue and add the deploy label to trigger the release workflow
  2. After successful deployment, trigger the deployed single action
  3. Verify that:
    • The release branch is merged into the default branch (main/master)
    • The default branch is then merged into develop
    • The issue is closed successfully when both merges complete
    • No "one or more merge operations failed" error occurs

🧪 Test Coverage

  • Unit tests updated to reflect the corrected merge behavior

⚠️ Breaking Changes

  • None

🚀 Deployment Notes

  • No special deployment steps

🔒 Security Considerations

  • No security impact

📈 Performance Impact

  • No performance impact

📝 Notes for Reviewers

The key change is in line 100 of deployed_action_use_case.ts where the second merge operation for release branches now uses param.branches.defaultBranch instead of param.currentConfiguration.releaseBranch as the head parameter. This aligns the release branch behavior with the hotfix branch behavior, which was already correct.


✅ Checklist

  • I have self-reviewed my code
  • Code follows project standards and conventions
  • Tests have been added or updated
  • Changes are backward compatible

📚 Additional Context

The error message "Issue #ANY_ISSUE_NUM was not closed because one or more merge operations failed" was appearing even when all PR checks passed because the second merge operation (release→develop) was attempting to merge a branch that had already been merged into main, potentially causing conflicts or fast-forward issues. By merging main→develop instead, we ensure a clean merge path.

…Enhance documentation and implementation for deploy label and merge flow. Added new sections in README and index.mdx, and improved MergeRepository to wait for PR-specific check runs before merging. Updated tests for MergeRepository and DeployedActionUseCase to cover new behavior and ensure correctness in handling merges and check waits.
…Enhance MergeRepository and DeployedActionUseCase documentation to clarify PR-specific check run handling and deployment flow. Updated comments and type definitions to reflect new behavior, ensuring better understanding of the merging process and check wait logic.
@docs-page
Copy link

docs-page bot commented Feb 15, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/vypdev/copilot~315

Documentation is deployed and generated using docs.page.

@vypbot vypbot added the 100% Progress: 100% label Feb 15, 2026
@vypbot vypbot changed the title Bugfix/314 error merging release branch after successful deployment [#314] 🐛 - Error merging release branch after successful deployment Feb 15, 2026
@vypbot vypbot self-requested a review February 15, 2026 15:43
@vypbot vypbot added this to vypdev Feb 15, 2026
@vypbot vypbot moved this to In Progress in vypdev Feb 15, 2026
@vypbot vypbot changed the base branch from develop to master February 15, 2026 15:44
@efraespada efraespada linked an issue Feb 15, 2026 that may be closed by this pull request
1 task
@vypbot vypbot changed the base branch from master to develop February 15, 2026 15:44
@vypbot vypbot added the size: XL Indicates that the issue or task is extra large in scope and complexity. label Feb 15, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2026

Codecov Report

❌ Patch coverage is 88.70293% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.87%. Comparing base (19986d9) to head (06fb607).
⚠️ Report is 21 commits behind head on develop.

Files with missing lines Patch % Lines
src/usecase/actions/check_progress_use_case.ts 44.44% 2 Missing and 3 partials ⚠️
src/actions/github_action.ts 78.57% 0 Missing and 3 partials ⚠️
...usecase/steps/issue/link_issue_project_use_case.ts 62.50% 2 Missing and 1 partial ⚠️
...pull_request/link_pull_request_project_use_case.ts 62.50% 2 Missing and 1 partial ⚠️
src/data/repository/ai_repository.ts 87.50% 0 Missing and 2 partials ⚠️
...case/steps/issue/remove_issue_branches_use_case.ts 60.00% 1 Missing and 1 partial ⚠️
src/actions/common_action.ts 95.45% 0 Missing and 1 partial ⚠️
.../steps/commit/check_changes_issue_size_use_case.ts 0.00% 0 Missing and 1 partial ⚠️
...teps/commit/notify_new_commit_on_issue_use_case.ts 0.00% 0 Missing and 1 partial ⚠️
...usecase/steps/common/check_permissions_use_case.ts 66.66% 0 Missing and 1 partial ⚠️
... and 5 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #315      +/-   ##
===========================================
+ Coverage    88.82%   90.87%   +2.05%     
===========================================
  Files          134      135       +1     
  Lines         5941     6171     +230     
  Branches      1272     1323      +51     
===========================================
+ Hits          5277     5608     +331     
+ Misses         250      170      -80     
+ Partials       414      393      -21     
Files with missing lines Coverage Δ
src/data/repository/issue_repository.ts 91.54% <100.00%> (+10.46%) ⬆️
src/data/repository/merge_repository.ts 92.30% <100.00%> (+2.45%) ⬆️
src/prompts/update_pull_request_description.ts 100.00% <ø> (ø)
src/usecase/actions/create_release_use_case.ts 100.00% <100.00%> (ø)
src/usecase/actions/create_tag_use_case.ts 100.00% <100.00%> (ø)
src/usecase/actions/deployed_action_use_case.ts 100.00% <ø> (ø)
src/usecase/actions/recommend_steps_use_case.ts 97.22% <100.00%> (+0.16%) ⬆️
src/usecase/single_action_use_case.ts 69.04% <100.00%> (+0.75%) ⬆️
...ase/steps/commit/bugbot/bugbot_autofix_use_case.ts 94.87% <100.00%> (+0.27%) ⬆️
...commit/bugbot/detect_bugbot_fix_intent_use_case.ts 93.75% <100.00%> (+0.20%) ⬆️
... and 27 more

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vypbot
Copy link
Contributor

vypbot commented Feb 15, 2026

🐛 Bugfix Actions

  1. The pull request's title was updated from Bugfix/314 error merging release branch after successful deployment to [#314] 🐛 - Error merging release branch after successful deployment.
  2. The pull request was assigned to @efraespada (creator).
  3. @vypbot was requested to review the pull request.
  4. The pull request was linked to vypdev and moved to the column In Progress.
  5. The base branch was temporarily updated to master.
  6. The description was temporarily modified to include a reference to issue 🐛🧑‍💻 - Error merging release branch after successful deployment #314.
  7. The base branch was reverted to its original value: develop.
  8. The temporary issue reference 🐛🧑‍💻 - Error merging release branch after successful deployment #314 was removed from the description.
  9. Priority set to P0 in vypdev.

image

🚀 Happy coding!

…Enhance MergeRepository to handle fallback to status checks when no PR-specific check runs are available after polling. Added test case to verify that the merge process correctly waits for pending status checks before proceeding. This improves the robustness of the merging logic and ensures proper handling of check statuses.
…Enhance logging functionality by introducing accumulated log management. Added methods to clear and retrieve accumulated logs, and updated log functions to support accumulation. Implemented tests to verify the correct behavior of log accumulation and formatting, ensuring robust logging capabilities.
…Enhance IssueRepository and publishFindings functionality to support commit SHA watermarks in comments. Updated addComment and updateComment methods to accept an options parameter for commitSha, allowing comments to include a link to the specific commit. Adjusted related tests to verify the inclusion of watermarks in comment bodies.
@vypbot vypbot added size: XXL Indicates an extremely large task or issue that requires significant time and effort to complete. and removed size: XL Indicates that the issue or task is extra large in scope and complexity. labels Feb 15, 2026
…Enhance tests for DetectPotentialProblemsUseCase by mocking GitHub actions context to handle undefined SHA. This improves test reliability and ensures proper handling of commit context in potential problem detection.
…Fix commit URL generation to properly encode owner and repository names. Added tests to verify URL encoding for special characters in commit links.
…Fix commit URL generation in CLI and GitHub action files to properly encode owner and repository names, ensuring correct handling of special characters in URLs.
// multiple PRs (e.g. release→master and release→develop), listForRef returns runs
// for all PRs; we must wait for runs tied to the current PR or we may see completed
// runs from the other PR and merge before this PR's checks have run.
const runsForThisPr = (checkRuns.check_runs as Array<{ status: string; conclusion: string | null; name: string; pull_requests?: Array<{ number: number }> }>).filter(
Copy link
Contributor

@vypbot vypbot Feb 17, 2026

Choose a reason for hiding this comment

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

Unsafe type assertion on check_runs

Severity: medium

Location: src/data/repository/merge_repository.ts:90

Line 90 uses a type assertion (checkRuns.check_runs as Array<...>) without runtime validation. If the GitHub API returns unexpected data (e.g., null, undefined, or non-array), this could cause runtime errors. The assertion assumes the structure will always match the expected type.
Suggested fix:
Replace the type assertion with runtime validation. Add a check to ensure checkRuns.check_runs is an array before filtering, and handle cases where it might be null or undefined.

Written by vypdev/copilot for commit 4ce66f2628f4a4fa96315df927b7768f21f0e6e3. This will update automatically on new commits.

metadata?: Record<string, unknown>;
}

const accumulatedLogEntries: LogEntry[] = [];
Copy link
Contributor

@vypbot vypbot Feb 17, 2026

Choose a reason for hiding this comment

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

Unbounded log entries array growth

Severity: medium

Location: src/utils/logger.ts:12

The accumulatedLogEntries array at line 12 can grow indefinitely without any size limit or automatic cleanup mechanism. In long-running processes, this could lead to memory exhaustion. While clearAccumulatedLogs() is available, it's not automatically called on a schedule or when the array reaches a certain size.
Suggested fix:
Add a maximum size limit for the array (e.g., 1000 entries) and implement automatic cleanup of old entries when the limit is exceeded, or clear the array periodically.

Written by vypdev/copilot for commit 4ce66f2628f4a4fa96315df927b7768f21f0e6e3. This will update automatically on new commits.

…Enhance publishFindings tests to validate commitSha handling in comments and overflow scenarios. Added cases for using commitSha as a watermark, passing it to addComment and updateComment, and ensuring correct behavior when findings lack associated files. Improved test coverage for comment creation logic in various conditions.
…Refactor publishFindings to improve commitSha handling in comments. Updated logic to ensure correct behavior in scenarios with missing associated files and added tests for various conditions, enhancing overall test coverage.
…Enhance ContentInterface tests to improve error handling and logging. Added test cases for scenarios where extraction and update operations throw errors, ensuring that errors are logged appropriately and that the functions return undefined as expected. This improves the robustness of the content handling logic.
@vypbot vypbot added 5% Progress: 5% and removed 100% Progress: 100% labels Feb 17, 2026
…Enhance logging and error handling across various use cases. Introduced logDebugInfo for detailed execution tracing, added logWarn for non-critical warnings, and improved error messages for better context. Updated tests to mock new logging functions, ensuring comprehensive coverage of logging behavior.
…Enhance logging in mainRun function for GitHub Action and CLI. Added detailed log messages for execution events, setup completion, and action handling, improving traceability and debugging. Removed unused truncate function and adjusted error handling for JSON parsing to log full response text for better context.
@vypbot vypbot added 100% Progress: 100% and removed 5% Progress: 5% labels Feb 17, 2026
…Update pull request description template to clarify output format requirements. Removed unnecessary preamble and commentary instructions, ensuring a more concise and structured output for PR descriptions.
…Update pull request description template in CLI and GitHub Action to streamline output format. Clarified instructions to eliminate preamble and commentary, ensuring a more direct and structured presentation of PR descriptions.
…Enhance logging functionality by introducing a sanitizeLogMessage function to remove markdown code fences from log messages. This ensures log output remains clear and unbroken when visualized in environments like GitHub Actions. Updated logInfo, logWarn, logError, and logDebugInfo functions to utilize the new sanitization method. Added tests to verify that markdown code fences are stripped from log messages.
@vypbot vypbot added 15% Progress: 15% and removed 100% Progress: 100% labels Feb 17, 2026
if (execution.isSingleAction && execution.singleAction.validSingleAction) {
logInfo(`User from token (${execution.tokenUser}) matches actor. Executing single action.`);
logInfo(`User from token (${execution.tokenUser}) matches actor. Executing single action: ${execution.singleAction.currentSingleAction}.`);
results.push(...await new SingleActionUseCase().invoke(execution));
Copy link
Contributor

Choose a reason for hiding this comment

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

Log clearing occurs after setup, missing setup logs

Severity: low

Location: src/actions/common_action.ts:40

In mainRun(), clearAccumulatedLogs() is called after execution.setup() completes (line 40). If setup() logs any entries, those logs will not be cleared and will persist. Additionally, if setup() throws an exception, clearAccumulatedLogs() is never called, potentially leaking logs from a previous run into error handling contexts.
Suggested fix:
Move clearAccumulatedLogs() to the very beginning of mainRun(), before any other operations including execution.setup().

Written by vypdev/copilot for commit 06fb6072fde0f7de43f4fa6867b17015a56e1431. This will update automatically on new commits.

@efraespada efraespada merged commit d178dc7 into develop Feb 17, 2026
11 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in vypdev Feb 17, 2026
@vypbot
Copy link
Contributor

vypbot commented Feb 17, 2026

🐛 Bugfix Actions

  1. 🐛🧑‍💻 - Error merging release branch after successful deployment #314 was automatically closed after merging this pull request.

image

Debug log
[DEBUG] Setup done. Issue number: 314, isSingleAction: false, isIssue: false, isPullRequest: true, isPush: false
[DEBUG] ✅ No previous runs active. Continuing...
[INFO] Running PullRequestUseCase for PR #315.
[INFO] 🔀 Executing PullRequestUseCase.
[DEBUG] PR action closed
[DEBUG] PR isOpened false
[DEBUG] PR isMerged true
[DEBUG] PR isClosed true
[INFO] ✅ Executing CloseIssueAfterMergingUseCase.
[DEBUG] Issue #314 state: open
[DEBUG] Issue #314 has been closed.
[INFO] Issue #314 closed after merging PR #315.
[DEBUG] Comment added to Issue 314.
[INFO] Main run finished. Results: 1, total steps: 1.
[INFO] Publishing result: 1 result(s), 1 step(s), 0 error(s).
[INFO] 📄 Executing PublishResultUseCase.

🚀 Happy coding!

Made with ❤️ by vypdev/copilot

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

Labels

15% Progress: 15% size: XXL Indicates an extremely large task or issue that requires significant time and effort to complete.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛🧑‍💻 - Error merging release branch after successful deployment

3 participants