Skip to content

Report git pull conflicts as sync errors instead of false success#46

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/sync-reports-error-on-pull-failure
Draft

Report git pull conflicts as sync errors instead of false success#46
Copilot wants to merge 3 commits into
mainfrom
copilot/sync-reports-error-on-pull-failure

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Manual repository sync could report success even when git pull aborted due to local uncommitted changes or merge conflicts. That left sync_status green, cleared sync_error, and advanced the sync timestamp although the working tree was not updated.

  • Sync task outcome handling

    • Teach sync_repo() to treat sync_repository() results prefixed with error: as real pull failures.
    • Persist sync_status = "error" and the returned git message instead of overwriting the repo row with success.
    • Skip last_synced_at updates on failed pulls so the repo state continues to reflect the last successful sync.
  • Regression coverage

    • Add a task-level test that reproduces the dirty-working-tree case against a real bare remote:
      • remote advances
      • local clone has uncommitted edits
      • git pull aborts with “would be overwritten by merge”
      • repo row remains in error state and local edits are preserved
  • Behavioral impact

    • The UI polling path now sees the existing sync_status === "error" / sync_error fields for failed pulls, so sync failures surface correctly instead of showing a false green check.
result = sync_repository(repo.local_path, repo.default_branch)

if result.startswith("error:"):
    detail = result.removeprefix("error:").strip() or result
    repo.sync_status = "error"
    repo.sync_error = detail[:500]
    session.commit()
    return {"status": "error", "message": detail}

repo.last_synced_at = datetime.now(UTC)
repo.sync_status = "success"
repo.sync_error = None

Copilot AI changed the title [WIP] Fix sync reports showing success on git pull failure Report git pull conflicts as sync errors instead of false success Jun 15, 2026
Copilot AI requested a review from raffelino June 15, 2026 08:15
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.

2 participants