Problem
When a repository sync runs git pull and fails (e.g. uncommitted local changes from
the in-app file editor would be overwritten by an incoming merge), the sync task
silently reports success: sync_status is set to "success", sync_error is cleared,
and the UI shows a green checkmark - even though the pull was aborted and the local
working tree was not updated.
This makes editor edits + remote pushes diverge invisibly.
Reproduction
- Connect a git repo, let it clone.
- Edit any file in the in-app editor and save (writes to working tree, not committed).
- From a separate clone, push a change to the same line of the same file.
- Click Sync in the repo card.
Expected: UI reports an error along the lines of "local changes would be overwritten,
please discard or stash before sync."
Actual: UI reports success. Logs contain:
Synced : error: Cmd('git') failed due to: exit code(1)
cmdline: git pull -v -- origin
stderr: 'error: Your local changes to the following files would be overwritten by merge:'
The error string is returned by sync_repository but the caller in tasks.py ignores it.
Suggested fix
-
Surface the git error. In backend/src/repos/service.py:sync_repository — drop the
try/except that swallows GitCommandError into a return string. Let it propagate;
the existing except Exception in tasks.py:sync_repo already writes
sync_status="error" and stores the message.
-
Add a force-resync endpoint. New force_resync_repository(local_path, branch)
doing git fetch && git reset --hard origin/<branch> && git clean -fd, exposed via
POST /repos/{id}/sync?force=true (parallel task in tasks.py).
-
Recovery action in UI. When sync_status === "error", repo card shows a banner
"Sync failed: . [Discard local changes & re-pull]". Button calls the new
?force=true endpoint. One-click recovery without kubectl exec.
Environment
RoboScope v0.8.2
Self-hosted Kubernetes deployment (single replica, PVC)
Problem
When a repository sync runs
git pulland fails (e.g. uncommitted local changes fromthe in-app file editor would be overwritten by an incoming merge), the sync task
silently reports success:
sync_statusis set to"success",sync_erroris cleared,and the UI shows a green checkmark - even though the pull was aborted and the local
working tree was not updated.
This makes editor edits + remote pushes diverge invisibly.
Reproduction
Expected: UI reports an error along the lines of "local changes would be overwritten,
please discard or stash before sync."
Actual: UI reports success. Logs contain:
Synced : error: Cmd('git') failed due to: exit code(1)
cmdline: git pull -v -- origin
stderr: 'error: Your local changes to the following files would be overwritten by merge:'
The error string is returned by
sync_repositorybut the caller intasks.pyignores it.Suggested fix
Surface the git error. In
backend/src/repos/service.py:sync_repository— drop thetry/exceptthat swallowsGitCommandErrorinto a return string. Let it propagate;the existing
except Exceptionintasks.py:sync_repoalready writessync_status="error"and stores the message.Add a force-resync endpoint. New
force_resync_repository(local_path, branch)doing
git fetch && git reset --hard origin/<branch> && git clean -fd, exposed viaPOST /repos/{id}/sync?force=true(parallel task intasks.py).Recovery action in UI. When
sync_status === "error", repo card shows a banner"Sync failed: . [Discard local changes & re-pull]". Button calls the new
?force=trueendpoint. One-click recovery withoutkubectl exec.Environment
RoboScope v0.8.2
Self-hosted Kubernetes deployment (single replica, PVC)