Update the renovate agent so that it fixes the code by itself#2815
Open
Update the renovate agent so that it fixes the code by itself#2815
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Renovate agent’s mend.io badge confidence detection to avoid treating white/near-white pixels as “neutral”, and adjusts the sampling point to better hit the coloured value area.
Changes:
- Adjust badge PNG sampling default
frac_xfrom0.88to0.93. - Treat near-white sampled pixels as “no confidence detected” (
None) rather than “neutral”. - Add unit tests covering white/near-white behavior in
_confidence_from_color.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
scripts/renovate_agent.py |
Tweaks PNG sampling location and updates badge-colour→confidence mapping to ignore near-white samples. |
tests/test_renovate_agent.py |
Adds regression tests ensuring white/near-white pixels map to None. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
feat: auto-fix tests via Copilot agentic workflow when renovate-agent tests fail - Add --create-draft-pr mode to renovate_agent.py: creates a draft PR with 'renovate-fix-needed' label when tests fail on a renovate branch - Update renovate-agent.yml: swap --cleanup for --create-draft-pr on test failure so the branch and PR are preserved for Copilot - Add fix-renovate-tests.md: gh-aw agentic workflow that fires when 'renovate-fix-needed' label is applied; Copilot reads CI logs, edits code, pushes fix, removes label, and triggers CI again - Add promote-renovate-pr.yml: converts draft PR to ready-for-review automatically once CI turns green on a renovate-agent/** branch NOTE: fix-renovate-tests.lock.yml still needs to be generated by running 'gh aw compile .github/workflows/fix-renovate-tests.md' on a non-QEMU (native x86_64) machine. fix: remove disallowed contents:write permission from gh-aw workflow
gh-aw's pre_activation checks github.actor team membership. When the label was applied by notify-pr-bot (GitHub App), pre_activation returned activated=false and all agentic jobs skipped. Fix: remove renovate-fix-needed from the Python script, output the draft PR number via GITHUB_OUTPUT, and apply the label in a separate workflow step using COPILOT_GITHUB_TOKEN (a real user PAT with write access).
…as fallback When tests fail on a renovate-agent branch: 1. Create draft PR (existing) 2. Assign 'copilot' to the PR → Copilot coding agent picks it up 3. Post an instruction comment telling Copilot what to fix 4. (Optional fallback) If COPILOT_GITHUB_TOKEN is set, also apply 'renovate-fix-needed' label to trigger the gh-aw workflow
The assignee approach requires org admin to enable Copilot coding agent in the org settings. The @copilot comment mention works without that.
…branches Watches for CI failure on renovate-agent/** branches via workflow_run. Finds the open draft PR and posts an @copilot comment with the failed run URL. Includes a 3-attempt circuit breaker — after 3 comments, posts a notice that human review is required instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary | Résumé
Two improvements to the Renovate Agent:
Badge confidence detection fix: near-white/white pixels from the mend.io badge PNG are no longer misidentified as "neutral" confidence — the PNG sampling point is also shifted right (0.88→0.93) to better hit the coloured value area.
Copilot agentic auto-fix loop: when the renovate-agent updates a dependency and the tests fail, instead of deleting the branch, a draft PR is created and Copilot (via GitHub Agentic Workflows) automatically reads the CI failure logs, fixes the broken code, and re-triggers CI. Once CI goes green the draft PR is promoted to ready-for-review — fully automated, no human intervention required.
Changes
Badge confidence fix (
scripts/renovate_agent.py,tests/test_renovate_agent.py)_sample_badge_png_color: defaultfrac_xshifted from0.88→0.93(samples further right into the coloured value area of the badge)_confidence_from_color: near-white pixels (R, G, B all > 200) now returnNoneinstead of falling through to"neutral"— white means the sampler missed the badge colour regiontest_white_returns_none,test_near_white_returns_noneAutomated Copilot fix loop (new workflows)
scripts/renovate_agent.py--create-draft-prflag: creates a draft PR withrenovate-fix-neededlabel when tests fail.github/workflows/renovate-agent.yml--cleanup→--create-draft-pron test failure.github/workflows/fix-renovate-tests.md.github/workflows/fix-renovate-tests.lock.ymlcompile-gh-aw-lock.yml).github/workflows/promote-renovate-pr.ymlrenovate-agent/**branch, converts the draft PR to ready-for-review.github/workflows/retrigger-ci-after-copilot-fix.ymlrenovate-fix-neededlabel is removed, pushes an empty commit via PR Bot to re-trigger CI.github/workflows/compile-gh-aw-lock.ymlfix-renovate-tests.lock.ymlon GitHub's native Linux when the.mdchangesFull automated flow (after merge)
Test instructions | Instructions pour tester la modification
Badge fix
poetry run pytest tests/test_renovate_agent.py -k "confidence" -vShould see
test_white_returns_noneandtest_near_white_returns_nonepass.Agentic fix loop (end-to-end)
Prerequisites (one-time setup):
Trigger a test run:
mainrenovate-agent/<package>-<version>-<date>renovate-fix-neededlabel will be appliedManual dry-run (without waiting for a real failure):
Then watch Actions → "Fix Renovate Agent Test Failures".
Release Instructions | Instructions pour le déploiement
None — no database migrations, no config changes, no service restarts required.
The two secrets above (
COPILOT_GITHUB_TOKENand therenovate-fix-neededlabel) must exist in the repo before the fix loop can activate.