Skip to content

fix: Git Pull never detects upstream changes on working branches (#195) - #196

Closed
AndriiPasternak31 wants to merge 3 commits into
Abilityai:mainfrom
AndriiPasternak31:feature/195-fix-git-pull-working-branches
Closed

AndriiPasternak31 wants to merge 3 commits into
Abilityai:mainfrom
AndriiPasternak31:feature/195-fix-git-pull-working-branches

Conversation

@AndriiPasternak31

Copy link
Copy Markdown
Contributor

Description

Fixes three independent bugs that combined to make git pull completely broken for template-based agents using trinity/* working branches. Status endpoint now performs a real fetch, pull/status/sync operations target origin/main instead of origin/{working_branch}, and manual git init preserves remote history instead of destroying it with force push.

Related Issue

Fixes #195

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Testing

  • I have tested this locally
  • New tests added (if applicable)
  • All existing tests pass

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation (if applicable)
  • I have not committed any sensitive data (API keys, credentials, etc.)
  • I have added appropriate logging for new functionality

AndriiPasternak31 and others added 3 commits March 26, 2026 23:47
…lityai#195)

Three bugs combined to make pull completely broken for template-based agents:

1. Status endpoint used `git fetch --dry-run` which never updates remote
   refs — replaced with `git fetch origin`
2. All pull/status/sync operations compared against origin/{working_branch}
   instead of origin/main — added _get_pull_branch() helper that detects
   trinity/* working branches and redirects pull to main
3. Manual git init destroyed remote history via force push — now preserves
   history with git fetch + reset, falling back to force push for empty repos

Push operations correctly remain on the working branch.

Closes Abilityai#195

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Document _get_pull_branch() helper, updated line numbers, and
initialize_git_in_container() history preservation.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- git_service.py: Replace stringly-typed error check with explicit
  required flag on setup commands
- git.py: Combine N+1 subprocess calls for multi-path git add into
  single call
- tests: Extract shared _init_repo_with_remote() helper, add teardown
  to clean up temp directories

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@AndriiPasternak31
AndriiPasternak31 force-pushed the feature/195-fix-git-pull-working-branches branch from f2b1d65 to 6663266 Compare March 26, 2026 23:47
vybe added a commit that referenced this pull request Mar 28, 2026
… (#196)

Three bugs combined to break git pull for template-based agents using
trinity/* working branches:

1. Status endpoint used `git fetch --dry-run` (never updated remote refs)
2. Pull/status operations compared against origin/{working_branch} instead
   of origin/main
3. Manual git init destroyed remote history via force push

Added `_get_pull_branch()` helper that detects trinity/* branches and
redirects to origin/main. Fixed initialize_git_in_container() to preserve
remote history via fetch+reset. Includes 9 unit tests.

Co-authored-by: Andrii Pasternak <[email protected]>
@vybe

vybe commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

Merged manually to main (squash) after rebasing and dropping deprecated changelog changes. See commit 5b1555a.

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.

bug: Git Pull never detects upstream changes on working branches

2 participants