Skip to content

Handle the AI removing every mozilla patch when resolving conflicts. … - #431

Open
tomrittervg wants to merge 1 commit into
masterfrom
2026-10-15-tjr-ai-removed-all-patches
Open

tomrittervg wants to merge 1 commit into
masterfrom
2026-10-15-tjr-ai-removed-all-patches

Conversation

@tomrittervg

Copy link
Copy Markdown
Collaborator

…Fixes #430

If the AI resolves a patch conflict by dropping every patch (e.g. they were all upstreamed), the library no longer has patches, but we decided what to do next from the moz.yaml as it was at the start of the run. The re-apply then failed with "there are no vendored patches defined", and had it got past that, committing the (empty) patches and the phabricator revision count would have failed too. This happened to libsrtp on the dev instance.

Re-read the moz.yaml after the AI succeeds; if no patches remain, skip the re-apply and the patches commit and submit one fewer revision.

…ixes #430

If the AI resolves a patch conflict by dropping every patch (e.g. they were
all upstreamed), the library no longer has patches, but we decided what to do
next from the moz.yaml as it was at the start of the run. The re-apply then
failed with "there are no vendored patches defined", and had it got past that,
committing the (empty) patches and the phabricator revision count would have
failed too. This happened to libsrtp on the dev instance.

Re-read the moz.yaml after the AI succeeds; if no patches remain, skip the
re-apply and the patches commit and submit one fewer revision.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Manifest reread errors bypass failure handling and leave jobs in CREATED status.

1 open finding
What changed in this PR

Handles vendoring when AI conflict resolution removes all local patches, addressing #430.

Changes:

  • Re-read patch metadata after AI resolution.
  • Skip patch application and committing when none remain, adjusting revision counts.
  • Add regression coverage for this workflow.
File Description
tests/​mock_libraryprovider.py Simulates patch removal after AI resolution.
tests/​functionality_all_platforms.py Tests successful vendoring with all patches removed.
tasktypes/​vendoring.py Adjusts patch processing and revision submission.
components/​libraryprovider.py Reads current patch state from moz.yaml.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tasktypes/vendoring.py
Comment on lines +225 to +236
has_patches_commit = self.libraryProvider.library_has_patches(
self.config['General'].get('gecko-path'), library)
if has_patches_commit:
# Re-apply the now-updated patches so the vendored tree is patched.
try:
self.vendorProvider.patch(library, new_version)
except Exception as e2:
self.dbProvider.update_job_status(created_job, JOBSTATUS.DONE, JOBOUTCOME.COULD_NOT_PATCH)
self.bugzillaProvider.comment_on_bug(created_job.bugzilla_id, CommentTemplates.COULD_NOT_GENERAL_ERROR("apply the mozilla patches even after AI conflict resolution.", errormessage=_patch_exception_message(e2)), needinfo=library.maintainer_bz)
return
else:
self.logger.log("The AI removed every mozilla patch, so there are none to re-apply or commit.", level=LogLevel.Info)
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.

Handle the case where AI removes all local patches

2 participants