Skip to content

fix(worktree): push integration branch once per run, not once per task - #662

Merged
carlospedreira merged 2 commits into
andresharpe:mainfrom
elmaljevo:bugfix/655-exclude-task-branch-ci
Aug 1, 2026
Merged

fix(worktree): push integration branch once per run, not once per task#662
carlospedreira merged 2 commits into
andresharpe:mainfrom
elmaljevo:bugfix/655-exclude-task-branch-ci

Conversation

@elmaljevo

Copy link
Copy Markdown
Contributor

Summary

  • Complete-TaskWorktree auto-pushed the base branch to origin after every single task completion. During a multi-task workflow run the base branch for each task is the shared integration branch, so an N-task run pushed it N times — firing the remote's full CI pipeline N times over (the impact the issue described, though the issue's proposed mechanism was task/* branch pushes; those branches are actually never pushed, only merged and deleted locally).
  • Add a -SkipRemotePush switch to Complete-TaskWorktree; Invoke-WorkflowProcess.ps1 now passes it whenever an integration branch is active, so the integration branch is pushed once, at the end of the run (existing behavior), instead of after every task. Standalone task completion (outside a multi-task run) is unaffected — it still pushes immediately, since there's no later push to consolidate into.

Test plan

  • Added a regression test in tests/Test-Components.ps1 using a local bare-repo remote: verifies -SkipRemotePush merges without pushing, and that default (no switch) behavior still pushes.
  • tests/Test-Components.ps1 — 859 passed, 0 failed, 1 skipped
  • tests/Test-ProcessDispatch.ps1 — 44 passed, 0 failed
  • tests/Test-WorkflowManifest.ps1 — 546 passed, 0 failed
  • tests/Test-Structure.ps1 — 356 passed, 0 failed, 2 skipped

Fixes #655

andresharpe#655)

Complete-TaskWorktree auto-pushed the base branch to origin after every
single task completion. During a multi-task workflow run, the base branch
for each task is the shared integration branch, so an N-task run pushed
it N times, firing the remote's full CI pipeline N times over. Add a
-SkipRemotePush switch and set it from Invoke-WorkflowProcess.ps1 whenever
an integration branch is active; the run still pushes it once, at the end.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces unnecessary remote CI triggers during multi-task workflow runs by preventing repeated pushes of the shared integration branch after each task completion, consolidating that push to the end of the run.

Changes:

  • Added -SkipRemotePush to Complete-TaskWorktree to allow callers to suppress the per-task auto-push.
  • Updated Invoke-WorkflowProcess.ps1 to pass -SkipRemotePush when an integration branch is in use (push happens once at run end).
  • Added a regression test verifying “skip push” vs default “push” behavior using a local bare remote.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/runtime/Modules/Dotbot.Worktree/Dotbot.Worktree.psm1 Adds -SkipRemotePush and gates the auto-push logic accordingly.
src/runtime/Scripts/Invoke-WorkflowProcess.ps1 Passes -SkipRemotePush during integration-branch workflow runs so the integration branch is pushed once at the end.
tests/Test-Components.ps1 Adds a regression test covering both skip-push and default push behavior against a local bare remote.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/runtime/Scripts/Invoke-WorkflowProcess.ps1 Outdated
Comment thread src/runtime/Scripts/Invoke-WorkflowProcess.ps1 Outdated
Merge/push status and activity log messages hardcoded "main" even when a
multi-task run merges each task into the shared integration branch
instead. Address Copilot review feedback on andresharpe#662.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 21, 2026 14:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

src/runtime/Scripts/Invoke-WorkflowProcess.ps1:1709

  • $mergeTargetLabel falls back to the literal 'main', but task worktrees can be based on 'master' (or a configured git.base_branch). This can make the status/activity messages misleading for repos that don’t use main. Consider deriving the label from the worktree map entry for the current task so the message reflects the actual merge target branch.
                $mergeTargetLabel = if ($integrationBranch) { $integrationBranch } else { 'main' }

src/runtime/Scripts/Invoke-WorkflowProcess.ps1:2287

  • Same as above: falling back to 'main' can be inaccurate when the task’s base branch is 'master' (or a configured git.base_branch). Using the worktree map’s base_branch keeps the merge-target messaging consistent with what Complete-TaskWorktree will actually merge into.
                $mergeTargetLabel = if ($integrationBranch) { $integrationBranch } else { 'main' }

@carlospedreira

Copy link
Copy Markdown
Collaborator

Follow-up scope captured in #667: consolidate multi-task pushes for supported unborn repositories and report the actual non-main merge target. This preserves the current committed-repository fix while tracking the uncovered edge case and regression coverage separately.

@carlospedreira carlospedreira left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved. The committed-repository workflow fix preserves standalone immediate pushes and consolidates integration-branch pushes at run completion. Remaining unborn-repository and non-main-label scope is tracked in #667.

@carlospedreira
carlospedreira merged commit dbaf0ae into andresharpe:main Aug 1, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Dotbot Product Backlog Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Task branch pushes trigger full CI pipeline on every task completion

3 participants