Fix PR head checkout remote in fork continuation - #1857
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #1856
Working session summaryImplemented and pushed the fix to PR 1857: #1857 The root cause was that fork-continuation mode could correctly resolve the solver fork divergence, but then checkout the same-named PR branch from the solver fork remote instead of the upstream PR-head remote. The new code prefers the upstream remote when the PR head owner is the upstream repo, adds clearer debug logging, and keeps existing fallbacks intact. This is committed as I also added the full case study and archived data under docs/case-studies/issue-1856, including the PR 381 timeline, downloaded logs, root cause analysis, and references. The reproducing test is Verification passed:
References used in the case study: Git This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (780.9K + 12.2M cached) input tokens, 57.0K output tokens, $22.536662 cost 🤖 Models used:
📎 Log file uploaded as Repository (49830KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit 78ec2e3.
Summary
Fixes #1856 by documenting what happened in ProverCoderAI/docker-git#381 and fixing the Hive Mind checkout bug exposed by that case.
docs/case-studies/issue-1856, including raw PR metadata, comments, CI logs, session logs, extracted evidence, timeline, root causes, and UX follow-ups.upstream/<pr-branch>instead of a stale same-named fork branch.Findings From PR 381
bun install --frozen-lockfilefailed on missing@fedify/*2.2.5 artifacts.--allow-fork-divergence-resolution-using-force-push-with-lease; that successfully resolved the solver forkmaindivergence.ProverCoderAI:renovate/allor mutate that PR.origin/renovate/allfrom the solver fork even when the PR head wasupstream/renovate/all.The full written analysis is in
docs/case-studies/issue-1856/README.md. Opaqueencrypted_contentpayloads from the second session log were redacted; operational commands, errors, comments, and timestamps were preserved.Reproduction And Fix
The new test
tests/test-issue-1856-pr-head-remote-preference.mjscreates an upstream repository and a fork that both containrenovate/all, with the fork branch intentionally stale. Before the fix, checkout could select the stale fork branch. With the fix,checkoutPrBranch()lands on the upstream PR head and logs the preferred PR-head remote.Implementation touched:
src/solve.mjs: records PR head owner and choosesupstreamas the preferred remote for upstream-owned PRs solved via a fork.src/solve.branch.lib.mjs: threads the preferred PR remote into checkout.src/solve.repository.lib.mjs: fetches/checks out the preferred remote first and uses it for PR-ref fallback.Verification
node tests/test-issue-1856-pr-head-remote-preference.mjsnode tests/test-issue-1772-fork-custom-base-branch.mjsnode tests/test-issue-1772-proactive-base-sync.mjsnode tests/test-pre-pr-failure-notifier-1640.mjsnode tests/test-issue-1332-fork-name-from-pr-data.mjsnpm run format:checknpm run lintgit diff --checknpm testpassed all 230 selected default test filesNo UI changes; screenshots are not applicable.