Fix reverse sync missing human commits when mono-filtered advances

--ancestry-path returns empty when mono-filtered/main has advanced
past the last forward sync (any monorepo commit causes josh to create
a new filtered SHA not in the subrepo's ancestry). Use git merge-base
to find the last connected point instead.

Also return skip-dirty (not skip) when trees differ but no human
commits found, preventing state from being updated on false skips
which would permanently lose unsynced commits.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-17 14:07:20 +03:00
parent d6f334b861
commit b4eaa47ef6
3 changed files with 40 additions and 9 deletions

View File

@@ -259,6 +259,10 @@ _sync_direction() {
echo "::error::Target ${target_name}, branch ${branch}: josh rejected push — check proxy logs"
continue
fi
if [ "$result" = "skip-dirty" ]; then
log "WARN" "Trees differ but no human commits — skipping state update (will retry)"
continue
fi
# Update state (only on success)
local new_state