fix: provide merge context to beta conflict resolver#19055
fix: provide merge context to beta conflict resolver#19055Hona merged 6 commits intoanomalyco:devfrom
Conversation
When the opencode conflict resolver runs during beta merges, it now knows which PRs have already been applied and which are still pending. This prevents it from resolving conflicts in ways that break already-merged PRs (e.g. re-introducing deleted files or stale imports).
There was a problem hiding this comment.
Pull request overview
Updates the beta merge automation script so the conflict resolver (opencode) is given explicit context about which PRs have already been applied to HEAD, while keeping later PRs as context-only to avoid pulling in unmerged changes.
Changes:
- Extend
fix(...)to receive the PR list + applied PR numbers + current index. - Add “Merged PRs on HEAD” and “Pending PRs after this one” context to the LLM prompt (and include the current PR title).
- Update the merge loop to track the current PR index via
prs.entries().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `Resolve the current git merge conflicts while merging PR #${pr.number} into the beta branch.`, | ||
| `PR #${pr.number}: ${pr.title}`, | ||
| `Only touch these files: ${files.join(", ")}.`, | ||
| `Merged PRs on HEAD:\n${done}`, | ||
| `Pending PRs after this one (context only):\n${next}`, | ||
| "IMPORTANT: The conflict resolution must be consistent with already-merged PRs.", | ||
| "Pending PRs are context only; do not introduce their changes unless they are already present on HEAD.", | ||
| "Prefer already-merged PRs over the base branch when resolving stacked conflicts.", |
There was a problem hiding this comment.
PR titles (and potentially author/login/labels if added later) are untrusted user-controlled input. Including ${pr.title} (and the done/next title lists) directly in the LLM prompt enables prompt-injection (e.g., a PR title containing instructions to ignore constraints or modify additional files). Consider sanitizing titles (strip newlines/control chars, truncate), and/or embedding these fields as quoted/escaped data (e.g., JSON-encoded) with explicit instruction to treat them as data only.
Summary
HEADbun typecheckand./script/build.ts --singlesmoke check, then commit any fixes before pushingbeta