fix(worktree): push integration branch once per run, not once per task - #662
Conversation
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>
There was a problem hiding this comment.
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
-SkipRemotePushtoComplete-TaskWorktreeto allow callers to suppress the per-task auto-push. - Updated
Invoke-WorkflowProcess.ps1to pass-SkipRemotePushwhen 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.
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>
There was a problem hiding this comment.
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
$mergeTargetLabelfalls back to the literal'main', but task worktrees can be based on'master'(or a configuredgit.base_branch). This can make the status/activity messages misleading for repos that don’t usemain. 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 configuredgit.base_branch). Using the worktree map’sbase_branchkeeps the merge-target messaging consistent with whatComplete-TaskWorktreewill actually merge into.
$mergeTargetLabel = if ($integrationBranch) { $integrationBranch } else { 'main' }
|
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
left a comment
There was a problem hiding this comment.
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.
Summary
Complete-TaskWorktreeauto-pushed the base branch tooriginafter 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 wastask/*branch pushes; those branches are actually never pushed, only merged and deleted locally).-SkipRemotePushswitch toComplete-TaskWorktree;Invoke-WorkflowProcess.ps1now 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
tests/Test-Components.ps1using a local bare-repo remote: verifies-SkipRemotePushmerges without pushing, and that default (no switch) behavior still pushes.tests/Test-Components.ps1— 859 passed, 0 failed, 1 skippedtests/Test-ProcessDispatch.ps1— 44 passed, 0 failedtests/Test-WorkflowManifest.ps1— 546 passed, 0 failedtests/Test-Structure.ps1— 356 passed, 0 failed, 2 skippedFixes #655