本文へ移動
AI NEWS JOURNAL
Hacker News Show HNAI NEWS / JOURNAL

Show HN: A Background Agent to Fix Breaking Changes in Dependency Updates

Article URL: https://www.arnaudrenaud.com/articles/fix-deps-breaking-changes-with-background-agent/ Comments URL: https://news.ycombinator.com/item?id=50537653 Points: 1 # Comments: 0

翻訳サービスが停止中のため原文を表示しています。

November 11, 2026 Use the GitHub Action arnaudrenaud/fix-with-agent to automatically fix your code whenever a dependency update breaks your test suite: The fear of missing out on updates Do you rely on a test suite that gives you enough confidence to blindly merge pull requests from automatic dependency update bots such as Dependabot or Renovate? If so, you’re already saving time compared to manual updates and regression testing. Yet, you may still be sitting on a backlog of unmerged pull requests because of breaking changes following major updates (and even, sometimes, minor ones…). Now that AI helps attackers exploit vulnerabilities faster, you’d better have AI help you patch them as soon as possible and keep up with major version upgrades over the years. The tedious part Of course, pulling the faulty branch and asking your local agent to “fix tests following dependency update” should do the trick with little supervision. Still, the operation induces friction: identify a bot-submitted pull request with failing tests pull branch prompt agent push code review changes finally, merge pull request Let’s automate everything but the last two steps: reviewing and merging will remain up to you. The background agent There is no need to orchestrate our agent manually when its boundaries can be defined as follows: Whenever tests fail on a pull request submitted by a dependency-update bot: based on the failing test log, ask an agent to write a fix within a budget and time limit if tests pass with the fix, commit and push it to the PR’s branch in any case, report the obstacles encountered and the decisions made In practice Here is an example of workflow for a Node.js, NPM-managed project: it fixes failing tests in Renovate pull requests using action arnaudrenaud/fix-with-agent. Check TODO comments and replace values by your own The GitHub App token allows to re-run CI checks after the workflow has pushed a fix (you could rely on the default GITHUB_TOKEN instead, but no CI check would run after fix) The cost of the task is guardrailed by the max-budget-usd argument passed to claude; if your agent does not have such an option, argument agent-timeout-minutes is set to 10 minutes anyway, killing the agent after a while name: "Fix breaking changes in Renovate PRs" on: workflow_run: workflows: - "Build and test" # TODO: Replace by the `name` of the workflow whose failure should trigger the action types: - completed branches: - "renovate/**" # TODO: Replace by the name pattern of the branches you want to monitor concurrency: group: fix-tests-${{ github.event.workflow_run.head_branch }} cancel-in-progress: true permissions: contents: write pull-requests: write actions: read jobs: fix-tests: name: Fix tests if: github.event.workflow_run.conclusion == 'failure' runs-on: ubuntu-latest steps: - name: Generate GitHub App token to re-trigger test run after fix is pushed # A push made with the default `GITHUB_TOKEN` would not trigger any CI check id: app-token uses: actions/create-github-app-token@v3 with: client-id: ${{ secrets.AUTO_FIX_APP_CLIENT_ID }} private-key: ${{ secrets.AUTO_FIX_APP_PRIVATE_KEY }} - name: Checkout branch uses: actions/checkout@v5 with: ref: ${{ github.event.workflow_run.head_branch }} fetch-depth: 0 token: ${{ steps.app-token.outputs.token }} - name: Setup Node uses: actions/setup-node@v5 with: node-version: "22" - name: Install dependencies run: npm ci --ignore-scripts # Prevent a malicious update from, e.g., reading your secrets - name: Fix tests uses: arnaudrenaud/fix-with-agent@v1.0.1 with: success-check: npm run build && npm run test # TODO: Replace by your own success check failed-workflow-run-id: ${{ github.event.workflow_run.id }} branch: ${{ github.event.workflow_run.head_branch }} github-token: ${{ secrets.GITHUB_TOKEN }} task-description: >- Fix the failed test run, probably following a breaking change in a dependency upgrade in latest commit. If applicable, mention URLs of documentation and discussions that support the chosen fix. Do not delete or disable tests unless a test is obsolete because of this change, and explain why. commit-title: "fix(auto): ⚠️ Auto-fix tests following breaking change in dependency" add-prefix-to-pr: "⚠️ [auto-fixed] " # Optional arg: to discourage hasty merge after auto-fix, add a prefix to pull request title # TODO: Replace the following args by your own agent setup if you don't use `claude` agent-install-command: npm install -g @anthropic-ai/claude-code agent-env: | CLAUDE_CODE_OAUTH_TOKEN=${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} agent-command: | # Agent command must be non-interactive and take stdin for its query claude \ -p \ --permission-mode bypassPermissions \ --max-budget-usd 2.00 \ --output-format json agent-cost-attribute: total_cost_usd # Optional arg: in the agent's JSON output, attribute `total_cost_usd` will be read to report cost agent-timeout-minutes: 10 With this workflow, if your test suite fails following a Renovate pull request and the agent manages to fix it, you’ll see the following changes in the pull request: the title now has a warning prefix: a new commit has been pushed: a comment has been published, reporting obstacles encountered and decisions taken (the same report is mentioned in the commit body and action output): Looking ahead Here is only one example of a small, circumscribed task that can be completed with an autonomous background agent. Let’s take the time to spot the recurring, well-defined tasks that can be performed on the side either on a fixed schedule or following a specific event. This way, we’ll clear not only the core of the task, but also the mental load of getting notified and making time for it.

出典

原文を読む ↗

関連テーマ

← すべてのニュースへ