Skip to content

User manual

This manual explains what gh-maintainer does on each run, how it decides, and how you work with it in the widget. For setup, see Installation.

The agent runs as a Kubernetes CronJob every two hours (0 */2 * * *). Each run:

  1. Emits run.started with the current dryRun flag.
  2. Lists the repositories of the configured owner, drops archived repositories and forks, and applies repos.include and repos.exclude.
  3. Rotates the list so a different repository goes first each run. The repositories at the end of the list are not always the ones cut off by time budgets or rate limits.
  4. For each repository, runs the Dependabot, Branches and Security modules in that order, between repo.started and repo.done (or repo.error).
  5. Emits run.finished with totals: merged, approvals, fixes, branchesDeleted, errors and rateLimited.

An error in one repository emits repo.error and the run continues with the next one. A run can take at most 90 minutes (activeDeadlineSeconds: 5400); a run that never finishes is marked aborted when the next one starts.

Dependabot module: auto-merge Dependabot pull requests

Section titled “Dependabot module: auto-merge Dependabot pull requests”

The module handles every open pull request opened by dependabot[bot]. Pull requests by anyone else are ignored. For each one, the agent decides in this order; the first rule that applies wins:

# Condition Action Event
1 The PR has a commit that is not Dependabot’s Ask for approval approval.requested, reason ai-fix
2 The PR has merge conflicts Comment @dependabot rebase pr.rebase_requested
3 Checks are still running, or GitHub has not computed mergeability yet Wait pr.pending, reason checks
4 Checks failed Run the fixer see The fixer
5 Major bump, unparseable bump, or a type not in autoMergeTypes Ask for approval approval.requested, reason major
6 Green patch or minor bump, mergeable, mergeable_state clean or has_hooks Squash-merge, pinned to the checked head SHA pr.merged
7 Green patch or minor bump that GitHub does not allow to merge yet Wait pr.pending, reason blocked

The agent reads the version bump from the PR title (Bump lodash from 4.17.20 to 4.17.21) and compares the versions with plain semver:

  • Different major version: major.
  • Same major, different minor: minor.
  • Same major and minor: patch.
  • Anything it cannot parse, such as a grouped update (Bump the npm group with 5 updates), a pre-release or a commit SHA: treated as major.

The PR body is deliberately not parsed, so a grouped update can never be auto-merged.

A merge passes the head SHA whose checks the agent just read. If a commit lands in between, GitHub refuses the merge with 409, and the PR gets pr.pending with reason head moved. The next run looks at it again.

A PR counts as untouched only when every commit’s author is dependabot[bot] and its committer is dependabot[bot] or GitHub itself (as on signed Dependabot commits). Anything else is a foreign commit: the fixer’s own commit, a human edit, or an “Update branch” merge. Such a PR is never auto-merged, even after its CI turns green, and conflicts on it are not sent back to Dependabot. It goes to the approval queue with reason ai-fix. If Dependabot rebases the PR and drops the extra commits, it is treated as a plain Dependabot PR again.

A pr.pending event always carries a reason:

Reason Meaning
checks CI is still running, or GitHub has not computed mergeability yet
blocked A green patch/minor bump, but GitHub’s mergeable_state is not clean/has_hooks: branch protection, required reviews, behind base, or draft
head moved A push landed between the check and the pinned merge
fixer disabled Checks failed, but the fixer is off or the repository is not in fixer.repos
cooldown Checks failed, but the fixer already tried this PR within fixer.cooldownHours
time budget Checks failed, but the run is older than 45 minutes, so no new fix starts
error Handling this one PR failed; data.message has the scrubbed reason. The rest of the repository still runs.

When a Dependabot PR has failing checks, the fixer tries to repair it with headless Claude Code. It runs only when all of these are true:

  • fixer.enabled is true.
  • fixer.repos is not set, or contains the repository name.
  • The run is younger than 45 minutes.
  • No fix attempt for this PR is recorded within the last fixer.cooldownHours (default 24). Every attempt counts, including dry-run attempts and failures.

The fixer then:

  1. Collects the last 300 lines of each failed CI job (at most 60 KB in the prompt).
  2. Clones the PR branch and moves .git out of the working tree, so Claude never sees repository metadata.
  3. Runs claude -p with --max-turns set to fixer.maxTurns and a timeout of fixer.timeoutMinutes. The prompt marks the PR title and CI logs as untrusted data and asks for the minimal change that makes CI pass, without disabling tests or weakening checks.
  4. Refuses the result if it touches anything under .github/, if a .git directory appeared, if git metadata was tampered with, or if the diff contains any of the agent’s tokens.
  5. Commits as gh-maintainer[bot] and pushes to the Dependabot branch.

Outcomes:

Outcome Event Next step
A fix was pushed pr.fix_pushed with the new sha, then approval.requested with reason ai-fix You review and approve or reject it
Dry run action.would_push_fix with Claude’s summary Nothing is pushed
No fix, timeout, refusal or error pr.fix_failed with status and summary The PR waits for the cooldown, then the fixer tries again

A fix that would need a workflow change always ends as pr.fix_failed, with a summary saying a human must do it.

The module deletes branches that are no longer needed. For each branch it decides in this order:

  1. Keep the default branch and every protected branch.
  2. Keep main, master, develop and release/*, always, plus every name in branches.keep. A pattern that ends in * matches by prefix (release/* matches release/1.2); anything else must match exactly.
  3. Keep a branch with an open pull request.
  4. Delete a branch whose pull request was merged (reason merged).
  5. Delete a branch whose last commit is older than branches.staleDays days, default 90 (reason stale). A branch with only a closed, unmerged PR counts as having no PR.
  6. Otherwise, keep it.

The module skips empty repositories and repositories without a known default branch, and it skips any branch whose commit date it cannot read.

Each deletion emits branch.deleted with the branch name, its last sha and the reason. Use the SHA to restore a deleted branch. If GitHub already deleted the branch (for example with “Automatically delete head branches”), the agent treats the deletion as done.

The security module collects findings from several sources and emits one repo.findings event per repository. The status server compares it with the open findings it knows and derives finding.new and finding.resolved events.

Source What it checks Severity
dependabot-alert Open Dependabot alerts From the advisory: critical, high, medium (moderate), else low
code-scanning Open code scanning alerts From the rule’s security severity, else error = high, warning = medium, else low
secret-scanning Open secret scanning alerts (the secret value is never copied) high
hygiene Repository settings and files see below
workflow Static audit of .github/workflows/*.yml see below
trivy trivy fs vulnerability and misconfiguration scan From the scanner
gitleaks Secrets in the working tree high
osv osv-scanner against the OSV database From the database, else medium

Hygiene rules:

Rule Severity
no-branch-protection: the default branch is not protected medium
secret-scanning-disabled medium
dependabot-alerts-disabled medium
no-dependabot-config: no .github/dependabot.yml low
no-security-md: no SECURITY.md, .github/SECURITY.md or docs/SECURITY.md low

Workflow rules:

Rule Severity
prt-head-checkout: a pull_request_target workflow checks out the PR head high
permissions-broad: write-all permissions, or a job without any permissions block medium
unpinned-action: an action or reusable workflow not pinned to a full commit SHA (Docker actions need a digest) low
workflow-parse-error: the YAML could not be parsed low

trivy, gitleaks and osv-scanner run on a fresh shallow clone of the default branch, at most once every security.localScanIntervalHours (default 24) per repository, and only within the first 60 minutes of a run. Each scanner has a 10-minute timeout.

A scanner that fails reports one low scanner-error finding for its source. Its source is then left out of that run, so its earlier findings stay open instead of being marked resolved. The same rule applies to GitHub alert types that are disabled: they never resolve findings.

Findings with severity critical or high turn the desktop tray icon red and fire a notification.

The web widget is served by the status server at the root of your host. It loads a snapshot from /state, then follows the live event stream at /stream, so it updates within a second or two while a run is in progress.

gh-maintainer web widget in dark mode with the approval queue, repository tiles, security counts by severity and the activity feed

The widget follows your system’s light or dark theme:

gh-maintainer web widget in light mode

The header shows the agent state (idle, running · N repos done, or an error after an aborted or failed run), when the last run started, a DRY-RUN badge in dry-run mode, and the connection state: live, connecting or offline · reconnecting.

gh-maintainer widget during a run, showing the running state and repositories being processed

Every open approval shows a reason chip, the PR title, a link to the PR, and Approve and Reject buttons:

  • major: a major or unparseable version bump, or a bump type not in autoMergeTypes.
  • ai-fix: a PR with a commit that is not Dependabot’s, usually a fix the fixer pushed.

Each repository is a block in a small isometric “city”, coloured and raised by the status of its last run: low green blocks are healthy, taller amber ones pending, the tallest red ones failing. Point at a block (or focus it with the keyboard) to see its name and status below the city; the city tilts slightly with the mouse.

Status Meaning
ok Nothing pending
pending Something waits: an approval, a pending PR, or the repository was interrupted by a rate limit
failing A fix attempt failed
error The repository failed with repo.error; hover for the message

The heading counts failing and pending repositories.

The total number of open findings and a key per severity (critical, high, medium, low). Press a key to list those findings, with links to the alert where one exists; a critical key glows while it has findings.

Recent activity grouped by run, newest run first. Each run is a card with its start time, duration and totals (merged, fixes, approvals, pruned branches, errors); a running run pulses and shows live. Only the newest run is open; select an older run to expand it.

Inside a run, every repository that did something sits on a branch line with its result (ok, pending, error, running) and how long ago it was last active. Its events hang below it with an icon each: merges, deleted branches, pushed fixes, rebase requests, approvals, findings and errors. Messages wrap instead of being cut off, and approval PR numbers link to GitHub. Repositories that only scanned and had nothing to do are summed up in one line.

The filter chips (All, Changes, Approvals, Findings, Errors, each with a count) narrow the list to one kind of event. The layout adapts to the panel’s own width, so it also reads well in the narrow desktop window.

The Agent config tab shows the configuration the agent runs with, read-only: owner, live or dry-run mode, which repositories are included or excluded, which Dependabot update types are merged automatically, the stale-branch rules, the fixer limits and the local scan interval. The status server reads it from the same gh-maintainer-config ConfigMap as the agent (via GET /info), so it always matches what the next run uses. To change it, edit your overlay; see the configuration reference.

gh-maintainer widget Agent config tab showing owner, dry-run mode, repository filters, Dependabot auto-merge types, stale branch rules, fixer limits and scan interval

The About tab shows the server’s version and commit, the owner, the server’s uptime and links to the documentation and the GitHub repository.

Approve asks the status server to merge the PR. The server re-checks the PR on GitHub first:

Check If it fails
The PR is still open and not merged 409 pr already merged or pr closed, and the approval is closed
All checks are green 409 checks not green, the approval stays open
GitHub reports it mergeable 409 not mergeable, the approval stays open
mergeable_state is clean or has_hooks 409 blocked by branch protection, the approval stays open

Then it squash-merges the PR, pinned to the head SHA it just checked, and emits pr.merged. If the PR changed in between, the answer is 409 pr changed, re-check. Clicking twice, or approving an approval that is no longer open, gives 409 approval in progress or approval not open.

A blocked by branch protection answer means GitHub would refuse the merge: give the required review or update the branch on GitHub, then approve again.

Reject opens a small form with an optional reason (up to 500 characters). Confirm with Reject. The server posts a comment on the PR, gh-maintainer: approval closed without merging. Reason: <reason>, and marks the approval rejected. The PR itself stays open on GitHub.

The agent re-requests open approvals on every run. A request for a rejected PR with the same title and reason is stored with data.ignored: true and hidden, and it does not notify. The approval comes back when the request changes: a new Dependabot version (a new title) or a new reason (for example major becomes ai-fix). To undo a reject, merge or close the PR on GitHub.

If you merge or close a PR directly on GitHub, its approval would stay open in the widget. The status server cleans this up:

  • after every agent run, when it receives run.finished, and
  • when the status server starts.

It checks every open approval on GitHub and emits approval.closed with reason pr already merged or pr closed for each PR that is gone. Clicking Approve on such an approval has the same effect.

With dryRun: true, the shipped default, every write to GitHub is replaced by an action.would_* event and nothing changes on GitHub:

Event Meaning
action.would_merge {pr, method, sha} A green patch/minor Dependabot PR would be squash-merged
action.would_delete_branch {branch} A merged or stale branch would be deleted
action.would_comment {pr, body} A comment would be posted, such as @dependabot rebase
action.would_push_fix {pr, summary} Claude produced a fix for a failing Dependabot PR; it is never pushed in dry run

Some things are real in dry run, too:

  • Findings and approval requests (approval.requested, pr.fix_failed) are recorded and shown.
  • Claude really runs on failing PRs, and those runs use your subscription. The cooldown applies to dry-run attempts as well.
  • Approve in the widget really merges.

The widget shows a DRY-RUN badge while the latest run was a dry run.

Run in dry run for about a week. Each day, check the feed:

  • Would any would_delete_branch hit a branch you want to keep? Add it to branches.keep.
  • Are the would_merge targets really safe patch and minor bumps?
  • Are the fix summaries sensible?

Then switch to live mode.

  • Before each repository, the agent checks the token’s remaining REST quota. Below 100 requests, or on a rate-limit error anywhere, it emits run.rate_limited (with remaining, which may be null), marks the interrupted repository pending, finishes the run and continues on the next schedule.
  • No new fix starts after 45 minutes of run time.
  • No new local scan starts after 60 minutes of run time.

An occasional run.rate_limited on a first run across many repositories is normal.