Software factory / Runs
Automate dependency updates
You want the update pull requests to stay current with no click, and you want a fix when CI fails on one. Turn on auto-update, and the Dependencies agent that fixes the code.
3 min read
You need:
- Admin access to the repository.
1. Update on a schedule
Auto-update checks and updates every group on a schedule. It is off by default.
- Open the repository, then Agents, then Rules under Software factory.
- In the card Rules for all agents, go to Dependency updates.
- Turn on Update on a schedule.
- Pick How often: Every day or Every week.
- Click Save rules.
The first check and update starts soon after you save. Then they run on the schedule. The Settings of the Dependencies tab show "Auto-update" as on, and when the next check is due.
When auto-update is off, nothing runs on a schedule. Updates start only when a person clicks Update, Update all, Bump or Sync versions.
Tip
An organization owner can turn on auto-update for every repository. See Set one dependency policy for every repository.
2. Let an agent fix a failing update pull request
A new version can break your code, and CI fails on the update pull request. The Dependencies agent can fix the code for you. It is off by default.
- Open the repository, then Agents, then Agents under Software factory.
- Turn on the switch of Dependencies. It saves at once.
The Settings of the tab now show Fixes when CI fails as on. When the agent is off, a person fixes the pull request.
Note
A fix run calls a model. When the forge pays for the model, the run counts toward the monthly spend cap.
Done
The update pull requests stay current by themselves. When CI fails on one, the agent pushes a fix to its branch.
What a fix run does
When a Source CI run fails on the newest push of the bot to an update pull request, a fix run starts:
- The agent reads the failed jobs, and runs only the failed step again in a sandbox.
- It reads the changelog, the README and the types of the updated packages in
node_modules. - It fixes the code with the smallest change, and runs the failed step again.
- It pushes the fix to the same branch. The pull request gets the new commit, and its CI runs again.
The rules of a fix run
- At most Review rounds fix runs (3 by default) start for one update push.
- The agent never deletes, skips or weakens a test, and never changes a file in
.source/. - In a group with more than one dependency (the minor and patch group, and Sync versions), the agent can drop one update that it cannot fix. That dependency keeps its old range. A group with one dependency (a major update, or a Bump) cannot drop its update.
- A failure that is not in the code, for example a network failure or a flaky test, gets no fix. The group keeps its pull request, with the reason.
- CI self-heal does not run on these pull requests. Failed GitHub checks start no fix run.
From the CLI
To turn on auto-update and the agent from the CLI, an admin runs src factory configure --file change.json. See Models, keys and triggers.