Skip to content

fix: provide merge context to beta conflict resolver#19055

Merged
Hona merged 6 commits intoanomalyco:devfrom
Hona:fix/beta-resolver-context
Mar 25, 2026
Merged

fix: provide merge context to beta conflict resolver#19055
Hona merged 6 commits intoanomalyco:devfrom
Hona:fix/beta-resolver-context

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented Mar 25, 2026

Summary

  • Give the beta conflict resolver the merged PRs already on HEAD
  • Keep later PRs as context only so it does not pull unmerged changes into the current merge
  • Run a final bun typecheck and ./script/build.ts --single smoke check, then commit any fixes before pushing beta

Hona added 6 commits March 25, 2026 14:28
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).
@Hona Hona marked this pull request as ready for review March 25, 2026 04:39
Copilot AI review requested due to automatic review settings March 25, 2026 04:39
@Hona Hona enabled auto-merge (squash) March 25, 2026 04:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread script/beta.ts
Comment on lines 69 to +76
`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.",
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@Hona Hona merged commit 700f571 into anomalyco:dev Mar 25, 2026
14 checks passed
Andres77872 pushed a commit to Andres77872/opencode that referenced this pull request Mar 26, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Apr 8, 2026
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