Install the GitHub App
1
Open the GitHub tab
Go to Integrations, open the GitHub tab, and find the GitHub App: remediation PRs card. You need to be an organization admin.
2
Install the App
Click Install on GitHub, choose the repositories to grant, and finish on GitHub. You land back on the card, now connected. If the App is already installed on your GitHub account, click Already installed? Find it instead. It lists the installations your linked GitHub account administers, so sign in with GitHub once from the sign-in page first.The card names the GitHub account SRE Agent is connected to (Account: acme), and the message you get when you connect says which one it is. An organization can connect more than one GitHub account (see Connect more than one GitHub account). A connection GitHub has suspended shows as Suspended on GitHub with its own Disconnect, and you can unsuspend it on GitHub instead. A child organization that uses its parent’s connection can also connect accounts of its own: see What a child may use of the parent’s GitHub.
3
Choose how it behaves
Under the connected card, set the toggles that fit your team:
Open as draft PRs is the default for every repository. A repository can choose for itself, and a few cases open a draft whatever the setting says: see Draft or ready for review.
4
Map repositories to services (optional)
Every repository the App can reach can already receive a fix request. In Repository settings (optional), click Add settings to give a repository a Service alias, pin a Branch, set the Directories a fix may change, or narrow the Writable extensions. Fixes only write inside that fence. Open pull requests as drafts in the same form lets this entry differ from the installation’s Open as draft PRs toggle. To change only a repository’s fix runner, sending, drafts or auto-merge, use the table’s own controls instead: see Change one repository in the table.Directories a fix may change takes up to 20 entries, for example one per service in a monorepo, or Under Sending fix requests in the same card, choose Wait for a person for a repository and its requests wait until someone clicks Send on the card (or in the request’s Control Tower drawer). Anyone who may request fixes can click it (Who may request fixes), so when your organization lets members request fixes, the hold waits for any of them and is not an org admin’s review. The default is Send automatically.
. for the whole repository. In a monorepo, every fix for the repository, whichever service asked (self-healing included), may write in every listed directory. Leave the list empty and the first fix detects it: every top-level directory that holds a file with a writable extension, or the whole repository when such a file sits at its root or in more than 20 directories. Saving the list yourself replaces a detected one. To detect and review the directories of many repositories before any fix runs, see Propose write fences.CI configuration is not changed unless you allow it: .github/, .circleci/, .gitlab-ci.yml, Jenkinsfile and the other files CI systems read are refused at any depth, whatever the directories say. MCP and the configuration API take the directories as path_prefixes.To let fixes change CI configuration in a repository, tick Allow CI config changes in its settings (an organization admin does this; over MCP and the configuration API it is allow_ci_config). Fixes may then change CI files inside the directories you listed, with an extension in the writable list. The switch cannot be turned off while a CI directory is listed.Changes under .github/workflows/ also need the GitHub App’s Workflows permission (Read and write). SRE Agent’s GitHub App requests it, and an owner of your GitHub organization accepts the request on your installation: open the organization’s Settings, GitHub Apps, SRE Agent, Configure, review the requested permissions and click Accept. Until the installation has accepted it, a request that changes a workflow file fails with a blocker that says so and nothing is pushed. Saving the switch on shows a line when the installation has not accepted the permission yet. Other CI files work without it.Self-hosted, with your own GitHub App? Whoever operates the App first sets Workflows to Read and write under Permissions & events, Repository permissions in the App’s settings on GitHub; each installation then accepts the request as above.
5
Add a context repository (optional)
Under Context repo (grounds fix requests), pick a repository, from any account you connected, that holds your runbooks, known failure modes and conventions. The agent reads it before proposing a change. Its content goes to your configured AI provider, like the target repository’s files. Choose (none) to clear it. A context repository that is itself set to your own fix runner with the fallback checkbox off is not read by any run on SRE Agent’s runner.
Repository names are compared the way GitHub compares them, without regard to case:
acme/web and
Acme/Web are the same repository. Where SRE Agent stores a name you type, such as a repository’s
settings entry, a fix request’s repository or a repository pinned in a self-healing area, write it
as the GitHub App lists it. A name spelled differently is refused with the right spelling, for
example: “Acme/Web is not spelled as the GitHub App lists it. Use acme/web.”Connect more than one GitHub account
An organization can use the App on several GitHub accounts, organizations or personal, one connection for each account (GitHub allows the App once on an account). On the GitHub tab, Connect another GitHub account opens GitHub’s install page. If the App is already installed on the other account, use Already installed on another account? Find it to adopt that installation, or theadopt_github_installation tool. The proof is the same as for the first account: an organization admin of the GitHub account, or the person who saved the installation’s repository access on GitHub within ten minutes. The message that confirms the connection names the account, such as “GitHub account jane connected. Code review is off for it until you turn it on below.” When your organization has child organizations, it also names the ones that read nothing of the new account yet (see What a child may use of the parent’s GitHub). Connecting an installation your organization already holds says it was reconnected and changes none of its settings. While SRE Agent is being updated, connecting a further account can be paused for a few minutes.
The GitHub tab draws one card for each connected account, with its login, its type and how many repositories it lists. Every switch, the review severity floor and Disconnect on a card act on that account only. Over MCP, name the account in update_github_settings and disconnect_github_installation with account, a login in any case or an installation number; with more than one account, a call that names none is refused with the accounts listed. get_github_integration and list_github_accounts answer every connected account.
A fix, a review or a scan for a repository uses the account that lists it. A repository can be listed by one account only, because a repository name starts with its owner. The context repository is chosen once, above the cards, from the repositories of every connected account. In What each repository runs with, an Account column names the account that lists each repository.
Disconnect removes one account and nothing else. Auto-merge is turned off on the pull requests it was set on through that account, SRE Agent stops following the pull requests already opened through it, and a context repository kept on it is cleared. The other accounts keep working. A connection GitHub has suspended shows as suspended, with its own Disconnect. Connecting and disconnecting an account are written to the audit log as github.account_connected and github.account_disconnected, with the account, its installation number, where it was done and who did it.
A fix pull request is closed in SRE Agent when GitHub reports it merged or closed, even if the repository was renamed since or moved to another connected account: SRE Agent finds the fix by GitHub’s id of the repository, which it records when the fix opens. A repository’s settings entry is keyed by its name, so after a rename or a transfer the old name’s entry reads as not connected and the new name follows your organization’s defaults.
With Terraform, sreagent_github_settings manages the account connected longest, so a configuration written for one account keeps planning the same way when another is connected. Every other account is a sreagent_github_account block (see Manage GitHub accounts and child access with Terraform). Connecting and disconnecting an account are not Terraform’s.
Ask for a fix
Any of these starts the same request:- In Slack, run
/sre-fix [service|repo] <what to fix> [files: a.tf, b.tf]. The service or repository is optional; without one the agent picks during analysis or declines if nothing fits. The outcome replies in the channel where you ran the command. - On an ops board card, click Auto-remediate under Act on this.
- In the Control Tower, click Create fix PR on a finding.
- From any script or workflow tool, post to the intake webhook below.
- From an MCP client, call
request_fix. When the card it names, or the pull request it names, has an open pull request SRE Agent opened, the request changes that pull request instead of opening another: see Change a pull request from Slack, a card or MCP.
Each repository accepts at most 5 open fix pull requests. Review or close some before asking for
more.
Who may request fixes
By default only organization admins can ask SRE Agent for a fix pull request or change one it opened. An org admin can let members ask too: under Integrations, GitHub, Who may request fixes, choose Members and org admins. The choice is audited, and it is alsofix_request_floor on update_organization_settings over MCP with an org admin’s token (an API key cannot change it).
With members allowed, they can use Auto-remediate, /sre-fix, the card’s fix, change and update: commands, follow-ups in Slack, the Control Tower’s Create fix PR and Retry, the fix checkbox when they file a ticket, and the request_fix MCP tool with a personal token. They can also press Send on a request that a repository set to Wait for a person is holding, their own request included, so the hold waits for anyone who may request fixes. A token minted below its owner’s role is judged at the lower role.
Viewers, guests and people without an account in the organization can never ask. The role is read fresh in the organization being acted in. Every request keeps the same plan, token, repository, write fence and review rules, and a person still merges each pull request. A refusal names this setting when it is the reason. The setting does not reach the GitHub comment door, which trusts a commenter’s write access on GitHub.
Set repository defaults for your organization
Seven settings decide how a fix for a repository runs. Instead of setting them one repository at a time, an organization admin can set them once under Integrations, GitHub, Organization defaults for repositories. A repository with no settings of its own follows them. To change one repository without opening its settings form, use the switches in the table: see Change one repository in the table.
Built-in values apply until you set any: SRE Agent’s runner, fallback on, send automatically, the installation’s draft setting, no network for checks, no CI changes, no merging by itself.
Merging by itself is off until an organization admin turns it on, and turning it on needs a confirmation: see Let fix pull requests merge by themselves.
Change the defaults
- Change the values in the form and select Preview change. Nothing is saved yet.
- The preview lists each setting that changes, the repositories that follow it and would move (with a count of those that keep a value set on their own row), the settings that differ by branch, and anything that refuses the change, with the reason.
- Turning on Allow CI config changes or Let checks reach the network asks you to tick a confirmation that names how many repositories it reaches. A fix may then change CI files, and your CI runs them with the repository’s secrets before anyone reviews the pull request.
- Select Apply. If the repositories or the defaults changed after the preview, nothing is applied and you see the new preview to review.
repository_defaults.changed, with who made it, the values before and after, and how.
Each setting follows the default until it is set on the repository, one setting at a time. Saving
a repository’s directories or its alias sets none of the six. The What each repository runs
with table under the defaults shows every repository’s value for each setting, marked
default or set here, with filters for the name, the settings that follow the default, and
the write fence.
Follow the default, or set a value on a repository
A repository reads each setting from the first place that holds a value: the settings entry for the branch, the repository’s all-branches entry, the organization default (the parent’s, for a child organization that follows its parent), then the built-in value.- Fix runner, Sending fix requests and the runner fallback belong to the whole repository. Each select starts with Organization default and the value it stands for; choosing it puts the repository back on the default for that one setting.
- The quickest way to set or put back one of these on a single repository is the table’s own controls: see Change one repository in the table.
- Allow CI config changes, Let checks reach the network and Open pull requests as drafts belong to one settings entry. The two switches have a Follow the default box under them (a branch entry whose all-branches entry sets the value reads Follow the all-branches entry); a new entry starts with the boxes ticked. Untick a box to set the value for that entry.
- Setting a value, even the value the setting would follow anyway, makes it the repository’s own, and a later change of the default no longer moves it.
- On an all-branches entry, each switch says how many branch entries follow it, because a change there reaches them.
- Removing, moving or creating an all-branches entry never changes what the branch entries around it run with: the values they were reading are written onto them in the same step, the page says how many, and each is audited as
repo_settings.branch_pinned.
repo_settings.follow_backfilled entries in Audit Logs listing every value that was cleared.
If the default is your own runner and no runner is registered, the page says what happens to requests: with the fallback on they run on SRE Agent’s runner, and with it off they fail with a sentence that says why.
Change one repository in the table
An organization admin can change four settings of a repository in place, in Integrations, GitHub, What each repository runs with. Four columns are controls, one click each:
Everyone else sees the same values as text. Each control shows the value in force. Organization default is selected while the repository follows it, and the
default or set here badge stays beside it. Your own runner is listed only while a runner is registered, and a repository that already stores it keeps showing it selected.
Nothing has to be created first. A repository with no settings entry gets an all-branches entry holding the value you chose. The change is written on every entry of the repository, branch entries included, and it is the same edit Change several repositories at once makes for one repository, so the same plan, role and runner checks apply. A refusal appears as a sentence and the control goes back to the value that is stored. While a change is being saved the controls are disabled, and a second change started meanwhile is refused with “Another change is being saved. Try again in a moment.” Every change is audited as repo_settings.bulk_changed.
When one entry of a repository sets a pull request choice while the others follow a default that says nothing, the Pull requests control shows The installation’s setting as the value in force, greyed. Pick Ready for review or Always a draft, or put the repository back on the default, to change it.
Turning auto-merge on asks first. The click writes nothing. A prompt opens under the row with the warning that a fix pull request then merges with nobody reviewing it. Pressing Use default on auto-merge asks the same question when the organization default says on. Keyboard focus moves into the prompt, and returns to the control you used after Cancel and after the change is saved.
When the repository’s fix pull requests open as drafts, the prompt also says “Fix pull requests of this repository open as drafts, and a draft never merges by itself.” and offers Also open them ready for review, ticked. Turn on then writes both settings in one edit. If you untick it, only auto-merge is written, and the table shows “Opens as drafts, so nothing merges by itself.” beside the switch for as long as that holds. The same sentence appears beside the auto-merge box of a repository’s settings form when it applies. See Let fix pull requests merge by themselves and Draft or ready for review.
A support administrator who is viewing as an organization admin can turn auto-merge off but never on.
A child organization
A child organization follows its parent’s defaults. The card says Using and the parent’s name, for example Using Acme’s repository defaults. A child admin can choose Stop using the parent’s repository defaults (the child then uses the built-in values), or set values of its own, which also stops following. Use the parent’s repository defaults again goes back and removes the child’s own values. The child’s repositories are never named to the parent: a parent’s preview shows how many repositories of each following child would move. When a parent turns CI configuration off, a following child’s repository that lists CI files in its fence keeps CI configuration allowed as it is, and the child’s audit trail records it.MCP and the configuration API
create_repo_settingsandupdate_repo_settingstakefollows_default, a list of the seven setting names to put back on the default (the runner, sending and the fallback for the whole repository, the other three for the entry you address). A setting cannot be both sent and named there. Answers carryfollowing(per repository and setting: nothing of the repository sets it) andset_here(per entry: the settings it holds a value for). Send back only what you mean to set, because sending a value makes it the entry’s own. The olderset_platform_fallback_for_allstays for existing clients and answersmode:defaultwhen it set the organization default,rowswhen it wrote each repository.get_repository_defaultsreads the defaults and where they come from.list_effective_repo_settingslists what each repository runs with, filtered and paged with a cursor.update_repository_defaultspreviews a change and, withapplytrue and the preview’sexpected_fingerprint, applies it. Turning on CI configuration or network needsconfirmnamingci_configorcheck_network. An API key withmcp:adminmay also follow or stop following the parent’s defaults.- On the configuration API,
repository_defaultsis read withGETand changed withPUT, andeffective_repo_settingsis a read-only list. APUTwithoutexpected_fingerprintanswers428with the preview in the body and writes nothing. Send the same body with the preview’s fingerprint to apply it. If what would move changed in between, the answer is409with the fresh preview, never200. A following child reads404until it writes its own defaults. - The Terraform provider (
segfaultpw/sreagent), version 0.2.0 and later, manages the defaults assreagent_repository_defaultsand reads what each repository runs with asdata.sreagent_effective_repo_settings.terraform planasks for the preview and warns with the settings that change, the repositories that would read a different value and the child organizations that follow the defaults. The apply sends that preview’s fingerprint and writes nothing if what would move changed since, so run the plan again. Turning on CI configuration or network needs the matchingconfirmentry, and from provider 0.4.0 the same holds forauto_merge, whichsreagent_repository_defaultsandsreagent_repo_settingtake as the seventh setting (see Merge fix pull requests by themselves). In a child organization that follows its parent, creating the resource gives it defaults of its own, and destroying it hands it back to the parent. sreagent_repo_settingtakesfollows_default, a write-only list of the settings to put back on the default, and answersset_hereandfollowing. A setting a block leaves out is left as it is, and a value it states that the entry already reads is not written.draft_prsis the exception: leaving it out returns it to the default. The runner, sending and the fallback belong to the whole repository, so state them on its all-branches block only. The configuration API export writesfollows_defaulton every repository setting block and states those three once per repository, on its all-branches block or, for a repository with branch entries only, its first branch entry.
Propose write fences
A repository with no write fence gets one on its first fix. Propose write fences does that ahead of time for every repository the GitHub App reaches, so you can review the directories and file types before any fix runs. Organization admins start it; everyone who can open the GitHub tab can read the result. Nothing is saved until you approve it.1
Start a run
Go to Integrations, open the GitHub tab and find the Propose write fences card.
Start a run. You can start three a day, and starting again replaces the proposals of the
previous run. Cancel stops a run and keeps what it has read.
2
Wait for the repositories to be read
SRE Agent reads the list of file paths of each repository that has no write fence, never the
contents of a file. It reads about 20 repositories a minute, so 700 repositories take about 35
minutes. When it has to pause to stay within GitHub’s limits, the card says when it resumes.
3
Review the proposals
Filter by status or name, edit the directories and file types of a proposal, and tick the ones
you approve. Select all shown ticks the 50 on the page. Press Preview the selected to
see, per repository, what would be written. The preview saves nothing.
4
Apply
Apply writes the approved fences, up to 100 repositories at a time. If a repository changed
after the preview, nothing is applied and you see the new preview. Dismiss the selected
deletes the proposals you reject.
A repository kept on your own machines is not read at all, not even its file list, because its code must stay there (When your runner fails explains the setting). For any repository that is not read, set the directories by hand under Repository settings. Forks and archived repositories are excluded from code detection when SRE Agent first sees them, unless you include them under Code improvement.
What a proposal is. The directories that hold the file types below, never a CI directory (
.github/, .circleci/ and the like) or a dot-directory. The file types are the ones the repository’s settings already list when you chose them yourself, otherwise the types found among .tf, .tfvars, .yaml, .yml and a short list of source and configuration types. Each repository ends as one of: Proposed, No matching files (set the directories by hand), Only CI configuration found (set them by hand; a fix does not write CI files unless the repository allows CI configuration), or Could not be read (GitHub refused the file list, and the reason says what it answered). A file list GitHub cut short is marked partly listed, and a repository pushed to since it was read is marked pushed since; both are warnings, not refusals.
A proposal for the whole repository. When the files that matter sit at the root of the repository, or in more than 20 top-level directories, the proposal is the root itself (.): the whole repository except CI configuration. It is flagged on its row and in the preview, and Select all shown never ticks it. Tick each one yourself, after reading what it would allow.
What an apply writes. Only the fence: the directories, the file types, and the mark that a person set them. A repository with no settings entry gets one for all branches, and every entry of the repository that lists no directory, branch entries included, gets the same fence, so a first fix does not detect that branch again. A new entry follows the organization defaults for every other setting, and no setting of any entry changes. A branch entry whose file types differ keeps them and takes the directories only. A repository that got a fence after the preview is left as it is, and a fence that names a CI directory is refused unless the entry allows CI configuration, the same rule as saving the entry by hand. A proposal older than 7 days is refused and has to be proposed again.
A proposal is deleted when you apply or dismiss it, when a new run replaces it, and 30 days after its run ended. The audit log records the start (repo_settings.fence_proposals_started) and the apply (repo_settings.fence_proposals_applied, with the repositories written).
Over MCP, get_fence_proposals reads the proposals with the same access as list_repo_settings, and an organization admin (or an API key with mcp:admin) uses propose_fences, apply_fence_proposals (a preview first, then apply with its fingerprint as expected_fingerprint) and dismiss_fence_proposals. A proposal for the whole repository is written over MCP only when repos names it.
Change several repositories at once
The seven settings in Set repository defaults for your organization can be set on many repositories in one step, or put back on the organization default (Follow the default, or set a value on a repository). Under Integrations, GitHub, What each repository runs with, organization admins can change them. Everyone else sees a note that only organization admins can use the form.1
Choose the repositories
Filter the table by name, fix runner, write fence or by whether a setting follows the default or
is set on the repository. Then choose Every repository the filters match, or tick rows and
choose Only the ticked ones. The tick at the head of the column selects the rows on the
page; ticks stay while you page, until you press Clear the ticks or apply. Archived
repositories and repositories the GitHub App cannot reach are left out and counted.
2
Choose what to do with each setting
For each of the seven settings pick a value, Follow the default (put the setting back on the
organization default, which is shown beside the choice) or Leave as is. Choosing a value and
following the default for the same setting, or naming no setting at all, is refused.
3
Preview
Choose Preview group change. The preview saves nothing. For each setting it counts the
repositories and branch entries whose value changes and those that keep it, says which
repositories get an entry for all branches, names the repositories that are left out and why,
and lists the confirmations you must tick. Turning on Allow CI config changes or Let
checks reach the network needs a ticked confirmation, whether you set the value or make the
setting follow a default that is on.
4
Apply
Apply writes exactly what the preview described, in one step, or nothing. If a repository,
an entry or a default changed after the preview, nothing is written and you see the new preview
instead. Other open Integrations pages refresh their table.
- the network is turned on where your plan or setting does not offer it;
- CI configuration is turned off while the repository’s directories list a CI path;
- an entry for all branches would leave a branch entry that lists a CI path without its CI setting;
- its entries are stored under more than one spelling of its name. The preview names the spellings; change that repository entry by entry.
repo_settings.bulk_changed entry for the change, with the filters, what each setting was set or put back to, the counts, and the repositories written and refused. Each entry written also has its usual entry (repo_settings.fence_changed, repo_settings.check_network_changed, repo_settings.draft_prs_changed).
Over MCP, an organization admin (or an API key with mcp:admin) uses update_repo_settings_bulk. It takes filters, repos, set, follows_default, apply, expected_fingerprint and confirm. Without apply and a fingerprint it only previews and answers a fingerprint. With both it writes, or answers the fresh preview with stale set to true. The answer lists at most 200 repositories, the refused ones first, and says how many more there are; the counts cover all of them.
Send a request with the webhook
Use this when no ticket system is in the loop. Find your webhook token on the Integrations page, Webhooks tab, in the This organization’s webhook token card, and treat it as a secret: anyone holding it can queue fix requests against your repositories.
A
202 response with {"status":"analyzing","id":"<uuid>","attempts":[],"expected_dispatch":{...}} means the request is queued, not that a pull request will follow. expected_dispatch says whether it will run, wait or run on SRE Agent’s runner (see See when a fix request will wait). A 422 means it was refused before analysis, with the reason in the body: for example no description, no GitHub App installed, a target that matches no repository, or a plan without fix requests. A 404 means the token is not valid.
What happens next
The request moves through analyzing to open (a pull request exists), declined or failed, with the reasoning attached. Follow every request in the Control Tower.- Whether the pull request opens as a draft or ready for review follows your draft setting, and the description says why when it opens as a draft you did not ask for. It names who asked and links back to the card. When SRE Agent’s own agent runs the fix, the branch is named
sre-agent/.... - Before SRE Agent’s own agent changes any file, it writes a plan: the files it will edit or create and why, the risks, and how it will test the change. The plan shows in the request’s drawer in the Control Tower while the fix works, the card shows “plan: 3 files” beside the request, and the pull request description has a Plan section after What changed. The plan’s words sit in a code block there, so nothing in them renders as a link or image or notifies anyone. A fix only changes files its plan names. The agent may amend its plan, and an amended plan must keep every file it has already changed.
- Before the pull request opens, SRE Agent’s own agent reviews its own change. A second model call reads your request, the accepted plan, the difference between the proposed files and the commit the fix read, your repository’s conventions (the Conventions of its Code profile, then
AGENTS.md,CLAUDE.mdandCONTRIBUTING.md) and the checks that ran while the fix was written, and answers pass or revise with up to ten findings, each a blocker, a major or a minor. The review is advice: if it cannot run, the fix goes on and the pull request says the review did not run, with the reason. A revise with a blocker or major finding sends the change back to the agent once, when there is time left for another round and a second review, and the revised change is reviewed again; if the revision cannot finish, the first version opens with its review, as a draft while a blocker is still open. The pull request description has a Self-review section before the reviewer checklist with the final verdict, one line per open finding (severity, file and line) and the reviewer’s words in a code block, so nothing in them renders as a link or image or notifies anyone. A pull request with an open blocker opens as a draft whatever your draft setting says. A change pushed onto an existing pull request leaves it as it is and lists the open findings in the reply. The request’s drawer in the Control Tower shows the review under Self-review, and the card shows “self-review: passed” or “self-review: 2 open findings”. Fixes run on your own fix runner are asked to write their own Self-review section; SRE Agent runs no review on their pull requests. - A request can wait for your own fix runner’s AI provider: when the runner’s provider has refused three requests in a row and the repository keeps its code on your machines, the request is held and its card says waiting: your fix runner’s AI provider is refusing. Its status stays analyzing until it is sent or discarded. See When your runner’s AI provider keeps refusing.
- Sending the same
ticketordedup_keyagain closes the earlier open pull request on GitHub and replaces it with a fresh analysis. - When your organization has knowledge for the repository, the pull request body lists the practices the change followed under Practices followed, each linked to its page. On the Pro plan and above, a merged or closed pull request also teaches SRE Agent: see Learned from pull requests.
- Slack gets the outcome. Requests with no channel of their own post to the Remediation Channel under Settings, Notifications (in the Slack section), or to your Info channel when that is blank.
- To change a request after the outcome, mention the bot in the thread under the outcome message with what you want different. You confirm with a button, and a follow-up run supersedes the open pull request.
See when a fix request will wait
Every place that takes a fix request says in its answer whether the request will simply run, wait, or run on SRE Agent’s runner, and why. A request that will run says nothing extra. The sentence is a forecast read when the request is accepted, from the repository’s settings, your fix runner’s state and the pending approvals of the card. The job that runs the request still decides, and the card says what then happened.
A request that waits for a person or an approval, and would meet a refusing runner once it is sent, adds Once it is sent it will wait again: … or Once it is sent it will run on SRE Agent’s runner, … to the same sentence. See When your runner’s AI provider keeps refusing for the runner’s side.
When SRE Agent cannot be sure, it says nothing:
- A request that names no repository gets no runner sentence, because the agent picks the repository later and the pick decides.
- A request whose runner is switched off or no longer in your plan, while the repository’s runner fallback is off, gets none either: the job ends that request at once and does not hold it. With the fallback on and the runner’s AI provider refusing, the forecast says it will run on SRE Agent’s runner, as the job does.
- A request that will be tried on your runner as the check of a runner that may work again gets none.
expected and reasons keep their English values in both languages. In Spanish the sentences read: Va a esperar a que una persona lo envíe, porque este repositorio está configurado para retener los pedidos de corrección., Va a esperar la aprobación pendiente de la tarjeta. (after the sentence above, También va a esperar la aprobación pendiente de la tarjeta.), Va a esperar: el proveedor de IA del runner propio rechazó sus últimas 3 ejecuciones, y este repositorio mantiene su código en las máquinas de su organización. Empieza cuando el runner vuelva a funcionar, o cuando una persona lo envíe o lo descarte desde la tarjeta. (for a change on a pull request, the sentence ends en el Control Tower de SRE Agent), Va a ejecutarse en el runner de SRE Agent, porque el proveedor de IA del runner propio rechazó sus últimas 3 ejecuciones., and, for a request that waits and would then meet the refusing runner, Una vez enviado, va a esperar de nuevo: … or Una vez enviado, va a ejecutarse en el runner de SRE Agent, …. You read them in:
- the MCP
request_fixanswer, always an object withmessageandexpected_dispatch(expectedisruns,waitsoron_sre_agent, withreasonsand asentencethat is null when the request runs). It is the same shape for a new request and for a change in place, andapprove_code_findinganswers the same. An integration that read the plain-text answer ofrequest_fixreadsmessagenow. - the
expected_dispatchfield of the fix request webhook’s202and of the200answer of the Jira and Zoho Sprints webhooks. It is always present, andreasonsnames why:repository(the repository holds fix requests),approval(a pending approval of the card named inboard_ticket_id) orrunner_down(your runner’s AI provider keeps refusing).runner_downis listed whenever the sentence names your runner. /sre-fix, Auto-remediate in Slack and on the card, the card’s@sre-agent fixandchangereplies, the Control Tower’s Create fix PR and Retry, the ticket modal’s fix checkbox, a code finding’s Approve, the Request revert button, Explorer and SLI Alarm on this, and a change asked for in Slack or over MCP.
Draft or ready for review
You choose whether fix pull requests open as drafts, for the whole GitHub installation and, where you want, for one repository.- The Open as draft PRs toggle on the GitHub card is the default for every repository. On, pull requests open as drafts. Off, they open ready for review.
- Open pull requests as drafts in a repository’s settings overrides the toggle for that entry. Choose Use the installation setting for Open as draft PRs, Always a draft or Ready for review. A branch entry left on the installation setting follows the repository’s all-branches entry when that one has a choice. Over MCP and the configuration API it is
draft_prson the repository settings tools:true,false, ornullto use the installation setting. The Terraform provider declares it asdraft_prs(0.1.2 and later): stating it makes it the entry’s own, and leaving it out of a block returns the entry to the default. - An organization that uses its parent organization’s GitHub App reads the parent’s toggle, shown on its own page and changed in the parent. It can still choose for each of its own repositories.
- A fix run on your own machine is given the same answer in the job it collects and in its brief. A runner older than
sre-agent-opencodev2.3.0 (the default image offix-runnerv4.10.0) keeps opening drafts.
- The checks failed with this change: “This repository’s checks failed with this change.”
- The self-review found a blocker that is still open.
- The change edits CI configuration: “This change edits CI configuration (the files), so it opens as a draft for a person to review.”
What a fix is built on, and how much work it gets
When SRE Agent’s own agent knows which repository it is changing, it reads the branch once, the branch in the repository’s settings or else the repository’s default branch, and works from that commit. Every file it reads, the size of the target it measures and the parent of the commit it builds all share it, so a branch that moves while the fix runs never has the other change reverted by the fix. When the branch did move, the pull request description says so after the line naming the write fence:The base branch moved since this fix read it (fromIf GitHub cannot say whether it moved, the description says “Whether the base branch moved sinceabc1234todef5678). Files this change also touches that changed there:lib/a.ex. GitHub shows any conflict.
abc1234 could not be checked.” If GitHub cannot say what the branch holds when the fix starts, the request fails before anything is read, with “GitHub could not be asked for the base branch of acme/api; nothing was changed.” The verification section names the commit the sandbox ran on.
The work a fix gets scales with the files it may change. The agent counts the files its write fence admits, the directories and extensions in the repository’s settings, in the tree of the commit it pinned:
The drawer of the request in the Control Tower shows the budget it ran with. A larger budget is used only while your organization’s monthly AI token allowance covers it; otherwise the fix keeps a smaller one and the drawer says so. Plans with no monthly allowance get the budget their repository measures. A fix always ends: no model call outlives the 22 minutes its loop may run, and the whole job ends within 26 minutes with the reason on the request.
Tested in a sandbox
On the Pro plan and above, when SRE Agent’s own agent proposes a fix for a repository that has a verification profile, the change is run in a sandbox before the pull request opens:- The sandbox clones the repository at the commit the fix was built on, with a read-only token for that one repository, and runs your tests on the unmodified code.
- If the fix adds a test, that test runs on the unmodified code and must fail.
- The whole change is applied, and your formatter, linter, static analysis and tests run, with the new test now expected to pass.
To run the checks in your own AWS account instead, an organization admin chooses My own verifier under Integrations, GitHub, Where verifications run, and provisions the poller with the
verifier module of terraform-sre-agent. The poller asks SRE Agent for work with an API key that holds only the verifier:poll scope, SRE Agent never connects to your account, and those runs do not count against the allowances above. If the poller has not called in five minutes, the pull request opens unverified with a line that says so.
Checks while a fix is written
On the Pro plan and above, SRE Agent’s own agent can run your repository’s own commands while it writes a fix, instead of learning that something fails only from the final verification. It runs the check, analysis, test and new test commands of the repository’s Code profile on the files it has staged, picks them by name and cannot write, edit or add a command. At most six calls a fix, and ten minutes of waiting for all of them. The commands run in one sandbox per fix, started when the agent’s first plan is accepted, so the repository’s clone and setup overlap with the agent’s work. Before each call the sandbox puts the tree back to the commit the fix was built on and removes what the previous call left, keeping only the dependency and build caches that setup made. A result therefore describes the staged files over that commit, with those caches. The sandbox holds no SRE Agent secret and no write credential: only a read-only token for the one repository. It ends when the agent returns, after five minutes without a call, at thirty minutes at the latest, and when the organization or the platform is paused or the request is replaced. What a command prints is your repository’s text: it is redacted and cut before the agent reads it, and the agent treats it as data. A result in the loop is advice. It never marks anything verified and never shortens the final verification, which is still a fresh clone with the full judgement. The pull request lists the last result of each command under Checks run while the fix was written, and says for each whether it ran on the proposed files over the commit the fix read, or on an earlier version of the change. The request’s drawer in the Control Tower lists every call under Checks while working, with the output of the commands that failed. A sandbox’s seconds count toward your plan’s sandbox minutes, never toward the number of verifications. One organization has at most one live sandbox of this kind at a time. A sandbox on your own verifier counts toward neither. On a pull request. A change asked for with@sre-agent change runs these checks only when the person who asked has linked their GitHub account to SRE Agent: their GitHub account is signed in to an organization admin or member account of your organization. A change asked for from Slack or a card runs them when the person who asked may still request fixes when the change runs (an organization admin, or a member when your organization lets members request fixes). Anyone else, and a pull request that has already had four of these sandboxes in 30 days, gets the change without them, and the reply on the pull request says why and that the pull request’s own CI runs on the commit.
Let checks reach the network
Setup commands always reach GitHub and your runtime’s package registries, to install dependencies. By default every command after setup (checks, tests, analysis), in the sandbox while a fix is written and in the final verification alike, reaches no network. An organization admin can turn on Let checks reach the network for a repository under Integrations, GitHub, Repository settings. The checkbox appears when your plan includes code improvement and check sandboxes are running. The setting belongs to one settings row, which is one branch of a repository. Turning it off cuts a sandbox that is already running within seconds, and turning it on applies from the next sandbox or verification. With the setting on, a pull request says “Commands after setup could reach the network (this repository’s setting).” for the checks that ran while the fix was written. On your own verifier, your network rules decide; with the setting off SRE Agent gives those commands no proxy settings, which cannot stop a command that reaches the network some other way. Every change is audited asrepo_settings.check_network_changed, with the repository, the branch, who changed it, how, and the value before and after. You can also set it as check_network (a boolean, off by default) on create_repo_settings and update_repo_settings from an MCP client with an organization admin’s token, and on repo_settings through the configuration API with an api:admin key. Over MCP and the configuration API, turning it on is refused where the checkbox would not be shown, and turning it off always works. The Terraform provider declares the attribute (0.1.2 and later). The export writes it only for an entry that sets it, and names it in follows_default for one that follows the default. Nothing else sets it: not the detection of a repository’s directories, the Control Tower, Slack, a pull request comment or a card.
Review pull requests
Turn on Review pull requests for reliability and security and every pull request in your selected repositories gets inline comments plus one summary comment. Anyone with write access can also ask for a review by commenting@sre-agent review on a pull request. Comment inline at this severity and above sets the floor; lower findings go in the summary.
Reviews work with models that think before they answer: the review is read from every text block of the answer.
When a review cannot be completed, the summary comment says so in one of three ways:
- The model’s answer could not be read as a review. An answer cut off at its output budget, or a finished answer with no text, ends the review on the first attempt, because a retry of the same change on the same model ends the same way. Any other unreadable answer is tried once more.
- No AI model answered (unavailable, rate limited or timed out) after three attempts.
- The change is too large to review in one pass.
@sre-agent review to try again. The comment carries no detail of the failure, since anyone can read it on a public repository, and a pull request gets one such comment while its reviews keep failing, not one for every push. Nothing is posted when your organization’s own setup stopped the review (its AI quota or plan, an unconfirmed account email, its provider key, or a policy that keeps reviews on your own providers), because a contributor cannot fix those and should not learn them from a public comment.
Mention SRE Agent on GitHub
Every command on this page is written after@sre-agent. The GitHub App’s own handle is the same mention: @sreagent-app and @sreagent-app[bot], in any letter case, so @sreagent-app review and @sreagent-app change ... do what @sre-agent review and @sre-agent change ... do. GitHub cannot suggest @sre-agent as you type, because that name belongs to an unrelated GitHub user, and its mention suggestions do not list Apps either, even after the App has commented on the pull request. Type the name you use in full.
You can also skip the mention. Start a line with /sre review, /sre change ..., /sre fix ... or /sre update ... and SRE Agent does what the same command does after @sre-agent, with the same access checks; /sre-agent works too, and /sre alone on a line gets the list of commands. Nobody is pinged, because there is no mention. It is read only at the start of a line and only in front of one of those words, so a sentence that begins with /sre, a path such as /sre/runbooks and /sre in the middle of a line are ordinary text.
The App’s handle and /sre follow the same rules as @sre-agent: a longer name such as @sreagent-application is another handle, and a mention inside a quote, code or an HTML comment is not a mention. A card and a Slack thread keep their own mention and read neither the App’s handle nor /sre. If you run your own GitHub App (self-hosted), its handle is the App’s slug, set as GITHUB_APP_SLUG; without it @sre-agent and /sre are what is read.
Change a pull request from a comment
Comment@sre-agent change followed by what you want on any open pull request in a repository the GitHub App reaches. @sre-agent fix and @sre-agent update work exactly the same way, with the same checks and replies. It works in the conversation, in a review body and in an inline review comment, and the pull request does not have to be one SRE Agent opened.
<pre> and <code>) or an HTML comment is not a mention, so quoting the command does not run it. SRE Agent reads the comment the way GitHub shows it, so a fence of four backticks is closed only by four or more. The word after the mention (change, fix or update) goes on the same line as the mention: a thank-you to @sre-agent followed by a new paragraph that starts with “Fix” gets the list of commands, not a change. Only a new comment or a submitted review runs one; editing a comment does not.
If you run your own GitHub App (self-hosted), subscribe it to the Issue comment event so a
command typed in the pull request’s Conversation tab reaches SRE Agent. GitHub delivers those
comments as issue comments. Review bodies and inline review comments arrive through the Pull
request review and Pull request review comment events. The hosted GitHub App is already
subscribed to all three.
- A person without write access, a closed or merged pull request, and a pull request from a fork.
- A pull request whose branch is the repository’s default branch, for example
mainintorelease. SRE Agent never pushes to a default branch, and checks again right before it pushes. - An empty request, or one over 2000 characters (8,000 for the objection of an automatic revision).
- A plan without fix requests, or an organization out of AI tokens. Only people with write access are told this.
- A repository whose fixes run on your own fix runner, when no machine of that runner can make the change and the repository does not let SRE Agent’s runner make it. The reply says whether the runner needs updating to
sre-agent-opencodev2.4.0 or is not available. See Changes on a pull request.
Any other mention
A comment, review or inline comment that mentions@sre-agent with anything else after it, or with nothing at all, gets one reply listing what SRE Agent understands: “I can @sre-agent change <what to change> (or fix, update) on this pull request, and @sre-agent review.” (the review part appears only where review is switched on for the repository). Only a person with write access on the repository gets it, the same rule as a change, and nothing the person wrote is repeated in the reply. Anyone else’s mention gets no reply. Each comment is answered once, and these replies count toward the same ten an hour per pull request as refusals.
Change a pull request from Slack, a card or MCP
People your organization lets request fixes (organization admins, and members when an org admin allowed it under Who may request fixes) can change a pull request SRE Agent opened without opening GitHub. The change is the same one a comment makes: the same write fence, the same plan and AI token checks, one change at a time per pull request and at most five an hour, and the same Wait for a person hold.- In Slack. In the thread of a card, or of an alert that has a card, mention SRE Agent with
changeorfixas the first word (a colon after the word is fine), orupdate:with its colon, and then what you want:@SRE Agent fix: use gp3 for the volume. On its own,update(as in “update me on this card”) is a question for the assistant, which can offer the change for you to Confirm. You can also ask in your own words and press Confirm on the proposal, which names the card and the pull request. Under a fix request’s outcome message, any mention offers a Change the pull request button. - On a card. Comment
@sre-agent change: ...(alsofix, andupdate:with its colon). A bareupdatethere is a question for the card assistant. Or ask the card assistant in your own words and send the command it gives you. - On the pull request.
@sre-agent update <what>in a GitHub comment is a change, with or without the colon, as described above. - Over MCP. Call
request_fixwithboard_ticket_idnaming a card that holds an open pull request SRE Agent opened, and yourdescriptionis the change, pushed onto that pull request; no second pull request opens. Without a card, name the pull request withpull_request, asowner/repo#12or its GitHub address. Only a pull request SRE Agent opened can be named: for any other, comment@sre-agent changeon it.files,attach_evidenceandevidence_window_minuteswork as they do for a fix. A personal token asks as its owner, at the role the token is held to. An API key withmcp:adminasks as itself: the change names no person, and its answers and commit message say “the integration” and the key’s name, with any links, addresses and mentions removed from it. The tool’s answer says which happened: “Changing acme/infra#12 in place” with where the outcome will be posted, or a new request when the pull request is closed or merged, or when there is none. Most refusals come back in that answer at once: several open pull requests (it lists them so you can name one), your plan, your AI token quota, the runner, a change already running, the hour’s five changes spent, or a branch SRE Agent cannot address safely. A key that is switched off, expires or losesmcp:adminbefore the change starts is refused and nothing changes.
#12 to pick one; without a number SRE Agent lists them and asks. SRE Agent pushes the change onto the pull request as one commit whose message says who asked (“Asked for by Jane in Slack”, “Asked for by Jane on card ABC-12”, “Asked for by the integration Ops bot through MCP, about card ABC-12”), and answers where you asked: in the thread (a refusal only to you, privately) or on the card. An MCP request is answered on the card it named, else on the card that holds the pull request, else on the pull request itself, refusals included, with a line that says who asked.
When the pull request cannot take the change because it is closed or merged, its branch is gone or is a default branch, it comes from a fork, its auto-merge is on, or GitHub refuses the push for branch protection or a ruleset, SRE Agent opens a replacement pull request from the same change, closes the old one and explains why in the new pull request, on the old one and where you asked. A merged pull request gets a follow-up pull request and nothing is closed. Anything else, such as a rate limit, a missing permission, your plan or your AI token quota, stops with the reason and closes nothing. On a repository whose fixes run on your own fix runner, your runner makes the replacement too (Changes on a pull request).
With Auto-revise once when a reviewer flags a PR on, a failed check, a failed commit status or a trusted reviewer’s request for changes is pushed onto the same pull request, once per pull request. Once means once started: after an automatic revision has started a change on the pull request, later flags do nothing. A revision that was refused before anything ran (the switch went off, the repository was excluded, the plan or the token quota, a change already running on the pull request, your runner, or a GitHub read that failed) has not used the revision, so the next failure tries again, up to three refused attempts within 30 days, after which the pull request counts as revised. An attempt nobody took up within two hours counts as refused too. Each refused attempt puts one line on the card the pull request is linked to, saying the automatic revision was not started and why. The line is not sent to Slack, and a pull request that no card holds gets none.
A failed check is revised from what made it fail, not only from its name. About a minute after the failure, SRE Agent reads the check’s own output and annotations, the other checks and commit statuses that failed on the same commit, and the newest comment a CI bot left on the pull request since that commit, such as an Atlantis plan or policy check. A comment counts as CI when it comes from a GitHub App or bot account, or from a known CI account such as atlantis that has write access to the repository. What it reads is passed to the revision as data, never as instructions, with credentials removed and at most 8,000 characters. When a newer commit has been pushed in the meantime, the old failure is left alone. When none of these explain the failure, nothing is revised and the card says which check failed and that its cause could not be read.
Reading commit statuses needs the GitHub App’s Commit statuses permission (Read-only), which an owner of your GitHub organization accepts on your installation the same way as Workflows. Until it is accepted, SRE Agent reads the checks and the CI comment only.
A revision that changes nothing ends there: it is not retried on another runner or taken over by SRE Agent’s runner.
Ask the card assistant
On a card you can mention@sre-agent in plain words instead of writing the command: “can you raise the timeout on the PR?” The assistant changes nothing itself. It answers whether SRE Agent can do it for this card, from the card’s real state:
- which pull request a command would change, named by repository and number, or that the card has none and
fixwould start a fix; - which runner makes the change, SRE Agent’s own or your own fix runner, and whether the change would wait for a person to press Send because the repository is set to Wait for a person;
- who may send it, and whether you may. Anyone who can comment on the card can ask, but only people your organization lets request fixes can send.
@sre-agent change: #12 raise the timeout to 30 seconds, or @sre-agent fix: ... when the card has no pull request. When a command cannot work on the card, it says why instead and gives no command: the card’s code is outside the repository’s write fence, or the pull request would be refused for one of the reasons listed above, such as your plan, your AI token quota, a default branch or a runner that is not available. It never says that it made, sent or queued anything. When the card has several open pull requests it offers a command for each one a command can work on. When two open pull requests share a number in different repositories, a command cannot name either, and it says so and points you to a comment on the pull request itself on GitHub.
To send the command by hand, copy the text inside the code span, not its backticks. A mention inside a code span or a quote does not summon the assistant, which is why the command it gives you does not ask it again.
Under the answer, people your organization lets request fixes see a Send button that sends that command as them: Send this change, Send to acme/api#12 for each pull request when several are open, or Start this fix when the card has no pull request. Your browser asks you to confirm what is sent and to which pull request. The card then shows Sent by and the person’s name to everyone, and the outcome is commented on the card as for a typed command. The button is drawn only while the offer still holds: it has not been sent, the card is inside the write fence, the pull request is still the one a command would change, and for a fix no fix for the card is already running. Your role and the organization’s Who may request fixes setting are checked again at the click, and a repository set to Wait for a person still waits. If the send fails, the message says whether the command was queued: when it was not, press Send again or comment the command; when it was, its outcome arrives as a comment and nothing needs to be sent again.
Who can steer SRE Agent on a pull request
Four things on GitHub act only for a person SRE Agent counts as a collaborator: a Request changes review on a pull request SRE Agent opened (which flags it, and revises it once when Auto-revise once when a reviewer flags a PR is on), the@sre-agent review comment, a card key in a comment, and a card key in a pull request’s title or description.
An owner, a member or a collaborator, as GitHub reports them on the event, counts whatever their role on the repository, so a member with read access or an outside collaborator invited with read or triage access counts too; remove the person from the organization or the repository to take them out. Anyone else counts only with write, maintain or admin access, which SRE Agent asks GitHub for when the event does not already say. That covers a person whose membership of your GitHub organization is private. Strangers on a public repository, and people with only read or triage access who GitHub does not report as a member or collaborator, are ignored. If GitHub cannot be asked, the answer is no. A permission change on GitHub is picked up within 5 minutes.
When a reviewer requests changes, SRE Agent revises from the review text and from the review’s inline comments, each with its file and line. A review with an empty summary and its objection in an inline comment works. The text is passed to the revision as data to consider, never as instructions, and is limited to the first 2000 characters.
Changing a pull request with @sre-agent change (or fix, or update) is stricter than all four: it always needs write access, looked up on GitHub, whatever role the event reports.
No new GitHub App permission is needed: the App already has Pull requests and Metadata read access.
Pull request titles and commit messages
Every pull request SRE Agent opens, and every commit it makes (a fix, a change asked for from GitHub, Slack or a card, a self-healing or revision pull request), has a Conventional Commits header:type(scope): subject, with the scope and a ! for a breaking change optional. The type is one of feat, fix, chore, docs, refactor, perf, test, build, ci, style or revert. The pull request title and the commit message are the same line, so a squash merge keeps it. A header the agent wrote is kept as written, tags at the start of a request title such as [team] are never copied into your history, text with no type becomes fix:, and monitoring suggestions, alarm requests and alert tuning use chore:. The line is at most 72 characters, cut at a word rather than in the middle of one. Nothing prefixes it with SRE Agent:: who wrote the change is in the pull request description, its author and the commit trailer.
If the request names a title, that title is used. A request names one on its own line, after a title label such as Title: or PR title:, or in quotes or backticks, anywhere a person’s words reach the request (a card’s title or description, a Slack message, an API or MCP call), and the line is used when, as written, it is already a Conventional Commits header of 72 characters or fewer. Otherwise SRE Agent’s own runner titles the pull request from its agent’s proposal.
A fix runner on your own machine titles its pull requests from the same rules, with what the job carries and what its agent says. From sre-agent-opencode v2.1.0, the runner takes the first of these that exists: the request’s own title, which the platform has already validated; its agent’s Title: line, when that line is a valid header of 72 characters or fewer exactly as written; the short title SRE Agent generates for the request; and the first line of its agent’s message. A runner from v1.9.0 reads the job’s title key, which carries the request’s own title when it names one and the generated title otherwise, so either arrives with no upgrade. Pull requests that older versions of the package open, with a card key at the start of the title, are still picked up.
Where fixes run
By default SRE Agent’s own agent runs the fix. Teams can instead run fixes on a fix runner they own, chosen per repository under Integrations, GitHub, Repository settings. Only admins can change it, and the choices appear when your plan includes them. Your runner never merges anything, and never turns auto-merge on. When a repository has auto-merge on, SRE Agent decides after your runner’s report. A fix run on your own fix runner is told how to work in the brief it reads, in a How to work section: write a short plan first and put it in the pull request description under## Plan, run the repository’s commands before opening the pull request, and review its own diff and list anything left open under ## Self-review. The commands come from the repository’s profile, with secrets redacted. SRE Agent does not enforce any of it for those runners, and it runs no plan check on their pull requests.
Run fixes on your own machine
The fix runner on your own machine runs thesre-agent-opencode package’s opencode agent, under that package’s command limits, on compute and a model key you own. It polls SRE Agent over HTTPS, so there is no inbound port, and SRE Agent never connects to your account. It also takes fix requests that name no repository whenever it is live, which it answers with a diagnosis. Register it under Integrations, GitHub, Fix runner on your own machine, create an API key whose only scope is fix_runner:poll, and set a repository’s Fix runner to Self-hosted runner. The runner is a plan feature.
Deploy it on AWS with Terraform. The fix-runner module of terraform-sre-agent (v4.11.0) builds one ECS Fargate service in your account, an encrypted volume for the runner’s work, a bucket for its notes and a log group. You give it the ARNs of your secrets: the API key, your model provider’s key, and either a static GitHub token or, from v4.4.0, a GitHub App (the module’s github_app_id and the secret holding its private key). The image is the sre-agent-opencode runner, pinned by digest: v2.4.0 in module v4.11.0 and v2.7.0 from module v4.14.0, which also adds model_fallback for a second model. The service runs one task by default, and runner_count raises it: collecting a request leases it to the task that collected it, so several tasks share one queue and one volume without doing one request twice, each keeping its own clones and tools while the notes stay one shared tree.
A second model, optional. From runner v2.7.0 the runner can hold a second model and key of your own, for the day the first model’s provider refuses a request. Set SRE_MODEL_FALLBACK and SRE_MODEL_FALLBACK_KEY on the runner, or model_fallback in the Terraform module (v4.14.0). A second model for when the first is refused says how it works.
A GitHub App instead of static tokens. With the App shape the runner mints a fresh installation token for each request, so nothing long-lived sits on the machine, and pull requests open as your App rather than a machine user. The agent inside the runner gets its own token, read-only on the one repository it is working in, minted for that run alone. One App per GitHub organization keeps each runner’s key able to reach only that organization’s repositories; an App shared across organizations would give every runner the key to all of them, and sharing one App across accounts also requires making it public.
The runner’s log and opencode’s own. Everything the runner writes goes to its log group, and from the v1.8.0 image that includes the server log opencode itself keeps: when a run’s opencode ends, however it ended, the runner forwards that log’s tail into the same group, each line prefixed opencode: and redacted like every other line the runner writes. Filter the group on opencode: to see what opencode said about a run, and set SRE_OPENCODE_LOG_LEVEL through the module’s extra_environment for a chattier server log while diagnosing a model step.
What the agent knows. The runner’s brief carries what you have configured: your knowledge items (what your team has told SRE Agent, ranked for the repository), the approved runbooks whose trigger conditions name the service it is fixing, and, when your GitHub integration sets a context repository, a clone of it beside the checkout, for the agent to read as reference material and never change. A change asked on a pull request carries none of these: the person who asked may be no member of your organization.
What it keeps. The volume keeps, for each repository, its clone, the tools the agent installs in its home for that repository (one home per repository, so nothing a run leaves there reaches another repository), and a NOTES.md and a few small scripts the agent wrote. A replaced task starts with all of it. The notes never reach a pull request: the agent reads them as its own earlier notes, as context and never as instructions, and a saved script runs only when the agent chooses to run it. Size limits are enforced by the runner, not the agent.
Auditing the notes. Each report lists what the run added, changed or removed: the path, the kind of change, the size and a short summary. You see it in the Runner memory section of the request in the Control Tower and under Memory on the card’s report comment. The contents are never sent to SRE Agent: they live on your volume and in your bucket.
The bucket. The runner copies changed notes to your bucket after every request. It is a one-way mirror: the volume is the source of truth, and a file you edit directly in the bucket is overwritten the next time the volume changes it. The runner reads the bucket only to restore the notes onto an empty volume, such as a replaced file system. The bucket the module creates is versioned, so an overwrite or a delete can be recovered for 90 days.
What the agent can reach. By default the agent has no AWS access, even though the runner uses the task role for its volume and bucket. Setting agent_aws_access gives the agent everything the task role holds, which is how a diagnosis reads your live estate: attach a read-only policy of your own and keep it to reads. The agent holds a GitHub token to clone your private repositories; set agent_github_token_secret_arn to a read-only token and the token, not only a command limit, stops it pushing. It works as a CI user does: it installs tools in its own home, starts your application and runs your tests, with no root and no sudo. For system packages, set a setup script that runs once as root when the container starts, or build an image on top of the runner image.
Run a test job. On the runner card, an organization admin presses Run a test job. The runner collects it through the real queue, clones the first repository set to the self-hosted runner, asks its model for a one-line answer, asks its second model for one too, writes its notes and its bucket, writes a pull request body and reads it back as the account that runs gh, and reports each step on the card. Nothing is pushed and no pull request opens. From runner v2.7.0 the card also shows a Second model answered step; see A second model for when the first is refused. A runner older than 1.5.0 answers the test without steps, and the card tells you to update the image. A runner between 1.5.0 and 1.9.0 reports every step except the pull request one, so the test does not pass, and the card tells you the runner does not check that step and needs 1.9.0 or later. At most one test runs at a time, and six an hour.
Upgrade to v2.7.0
Every runner version before v2.7.0 should upgrade. v2.7.0 carries a security fix: it keeps git out of a repository found in a submodule path or nested below the checkout, which an agent could have left there. With the Terraform module,fix-runner v4.14.0 and later default to the v2.7.0 image; a plan that pins image to an older digest should move it.
Two behaviours of v2.7.0 reach every install, with or without a second model:
- A run holds only the provider key of the model it runs. A tool the agent starts in its shell that reads a provider key other than the one its model uses no longer finds it, so give that tool its own key some other way.
- A repository the agent leaves in a submodule path of the base, or under a directory your
.gitignorecovers, is removed from the checkout when the run ends and is named in the report. It was never part of the pull request, and the request is not refused. A step that expects such a repository to stay on disk after the run must not rely on it.
acl package (setfacl and getfacl), which the installer checks, and the runner refuses to start when another account of the machine shares an agent account’s group. The container image needs no change.
Changes on a pull request
Fromsre-agent-opencode v2.4.0, a change asked for on a pull request (a comment, Slack, a card or auto-revise) in a repository set to your runner is made by your runner. It checks out the pull request’s branch, makes the change and pushes one commit with your runner’s credentials, never forced and carrying the same SRE-Agent-Change trailer. If anyone pushed to the branch while it worked, nothing is pushed over it: a change asked for in Slack, on a card or by auto-revise is run once more on the new head, and a second move, or a pull request that cannot take the push (closed, merged, from a fork, on a default branch, auto-merge on, or refused for branch protection), makes a replacement pull request. For a replacement, SRE Agent decides, as it does on its own runner (the starting commit, the comparison against the base, the write fence, the branch name, the title and whether it is a draft), and your runner pushes the new branch, closes the old pull request and opens the new one. SRE Agent’s App comments on the old pull request. A change asked for in a GitHub comment is never replaced: the reply says what was refused. A replacement needs the repository’s directories to be saved under Repository settings, because SRE Agent’s runner may not read the repository to find them when the fallback checkbox is off.
Your runner receives the repository’s write fence (the directories and extensions in its settings) as an instruction in the brief. Its own gate refuses protected paths (.github/, *.env*, *secrets*, *.pem and its memory directory) but does not check the repository’s directories or extensions, and nothing fences a push made on your machine, so your review of the pull request is the gate. The files of a replacement are the exception: SRE Agent checks them against the write fence before it closes or opens anything.
A runner scaled to zero counts as available when its scaler asked for the queue’s demand in the last 5 minutes: the change is queued for the machine the scaler starts, and one nobody collects within 5 minutes is taken over by SRE Agent’s runner when the checkbox is on. A runner older than v2.4.0 (the default image of fix-runner v4.11.0) keeps making fix requests, and is never given a change. When no machine of your runner can make it, the repository’s If your fix runner fails, run it on SRE Agent’s runner checkbox decides: on, SRE Agent’s runner makes the change and the request’s Agent reasoning in the Control Tower says why; off, nothing runs on SRE Agent’s runner, and you are told to update your runner (or that the runner is not available), or the change waits for a runner nobody has heard from lately. A change gets the same retry on another of your machines, take-over and endings as a fix request, with sentences that say to ask for the change again. A change made on your runner has no sandbox checks while it is written, and its brief carries none of your organization’s knowledge.
Scale to zero, short-lived credentials, hooks and progress
Four additions make the runner cheaper to leave idle and safer to hold. All of them are optional: a runner that uses none behaves as before, and the platform side works with any release of the runner that asks for it. A token that expires instead of the key.POST /api/fix_runner/token with an empty body exchanges your fix_runner:poll key for a token that lives one hour, and the same call renews it. Called with the key it starts a chain that ends 24 hours after the exchange; called with a token it returns a new token in the same chain, never past that end. A token holds the key’s one scope and reaches only the fix-runner routes of your organization. SRE Agent looks it up on every request, so deleting or revoking the key, removing its fix_runner:poll scope or suspending the organization ends every token the key minted on the next request. Mints and renewals are limited to 30 a minute per API key. A runner that renews a token keeps working for at most 24 hours; after that only the key starts a new chain, so a task that stays up for days keeps the key, and a task that scales in and out is replaced long before.
How much work is waiting. GET /api/fix_runner/demand, with the key or a token, answers {"pending", "running", "oldest_age_seconds", "as_of"} for your organization. pending counts only the queued jobs one of your registered machines could be handed right now: a job whose every registered machine is excluded from it, a change on a pull request when no machine declared that it can make one, and a request whose repository another job holds are not counted. running counts the jobs a machine holds. A job whose machine went silent is counted in neither, because SRE Agent decides what happens to it within minutes. The answer carries counts only, never a repository, a request or a machine name. A scaler in your account reads it to start and stop tasks.
A change on a pull request that is queued for a runner scaled to zero is counted too, while no machine of the runner has ever declared that it can make one and no machine is polling, because the machine your scaler starts is assumed able to take it. It is offered the change only if it declares that capability when it polls. If the machine that starts is older than v2.4.0 it declares nothing and is never offered the change: with the fallback checkbox on, SRE Agent’s runner takes the change over after 5 minutes, and with it off the change waits and the 45 minute backstop ends it.
A demand call also keeps your runner routable for five minutes, as a poll does. A runner scaled to zero polls nothing, and without this every request would be taken over by SRE Agent’s runner while your scaler started a task. With it, the request is queued for your machine, and the repository’s If your fix runner fails, run it on SRE Agent’s runner setting decides how long it waits. With the setting on, a request nobody collected within 5 minutes of being queued is taken over by SRE Agent’s runner, so a cold start (your scaler’s next tick, the task start and the image pull, about a minute for the last two) has to fit inside those 5 minutes. With it off, the request waits for your machine until the 45 minute backstop ends it.
Hooks and per-request credentials. From sre-agent-opencode v2.5.0 the runner runs executables from the directory in SRE_HOOKS_DIR (an absolute path, never under its workspace): pre-run before every request, credentials to provision credentials and post-run after it. They run as the runner’s account, never the agent’s, with the request’s id, repository and kind in their environment, and are cut off after SRE_HOOK_TIMEOUT_SECONDS (60 by default). A pre-run or credentials hook that fails or times out fails the request, and the failure names the hook. post-run always runs and its failure is only logged. credentials prints NAME=value lines on stdout; the values reach the agent’s environment for that run only and are redacted from every log, report and error. Names must be upper-case environment names, and PATH, HOME, ENV, BASH_ENV, NODE_OPTIONS, NODE_PATH, GH_TOKEN, GITHUB_TOKEN and anything starting SRE_, OPENCODE_ or GIT_ are refused. Set SRE_AGENT_AWS_ROLE_ARN and the runner assumes that role for each run (a session of up to one hour), so an agent with agent_aws_access holds credentials that expire.
Progress while it runs. From the same release the runner sends its phase (collected, cloning, agent, checks or publishing), a count of the agent’s tool calls and the kind of the last one with its heartbeat. The request’s drawer in the Control Tower and the card’s run show one line, for example Phase: agent, 14 tool calls, last: edit, while the request is live. It carries no file content, command text or model output.
When your runner fails
A run on your machine can end without a pull request and without a decline: the agent runs past its time limit or exits with an error, the runner hits an error, or the agent finishes without changing anything and without saying it declined. A runner that stops answering is a failure too, and so is a request no runner collects. SRE Agent moves such a request on, in a fixed order, and tells you each move once where you asked: on the card, in the Slack thread, and in your tracker.- If another machine of your runner is free and healthy right now, the request is offered to it, never to the machine that failed. A request gets at most two tries on your machines, except that a request held for a card approval after a failure is sent again as a new try, without the machine that failed it. A try your AI provider refused is never counted toward the two, and a request can make twelve tries in all. A failure that is your AI provider refusing the request skips this step: see When your runner’s AI provider refuses the request.
- Otherwise, with the repository’s fallback setting on, SRE Agent’s own runner takes the request over, once.
- Otherwise the request ends failed, with a sentence that says what happened and what to check, for example Your fix runner could not finish this request (the agent ran past its time limit).
platform_fallback on create_repo_settings and update_repo_settings, and update_repo_settings_bulk changes many repositories in one step. A request that names no repository starts on SRE Agent’s runner when no runner of yours is live, and from the moment its agent picks a repository it is routed exactly as if the request had named that repository: the run stops before anything of the repository is read, and the repository’s settings decide. A repository set to your own runner is queued for it when it is live. When it is not, the fallback setting decides: on, the run goes on on SRE Agent’s runner; off, the request is queued for your runner if one is registered and switched on, and otherwise ends failed with a plain sentence, never on SRE Agent’s runner. The same holds for an untargeted request that SRE Agent’s runner took over from your runner or ran because your runner’s queue could not take it: if the agent picks a repository set to your own runner with the fallback setting off, the request ends failed with a sentence that names the repository, says nothing was read and asks you to name the repository next time so the request goes to your runner. It is not held for a person and not handed back to your runner. A repository set to SRE Agent’s runner is unaffected, and one set to Wait for a person holds the request as it holds any other. With the setting on, a request that arrives while your runner has not polled for five minutes runs on SRE Agent’s runner from the start, and says why.
What the checkbox covers. It covers fix runs: a fix request, a change on a pull request, a take-over after your runner failed, and a revert. With it off, none of them reads the repository on SRE Agent’s runner, including the file listing a change would otherwise use to find the repository’s write directories. For a repository with no saved directories, set them under Repository settings: a change is queued for your runner without them, but a replacement of its pull request needs them. Your organization’s context repository follows the same rule: when it is set to your own runner with the fallback setting off, no run on SRE Agent’s runner reads it, the agent is told it is not available, and the run works from the target repository. The checkbox does not govern features you switch on separately, such as weekly code detection, the repository profile read and approving a code finding. Each of those has its own switches and scope settings on the Code improvement page.
How soon a failure is known.
Heartbeats need v2.2.0. From
sre-agent-opencode v2.2.0 (the default image of fix-runner v4.9.0) the runner reports in every 60 seconds while it holds a request, stops its agent and reports nothing when SRE Agent answers that the request was taken over or passed its 60 minutes, and says why a failed run failed. An older runner keeps working unchanged, but SRE Agent only notices it went silent after 45 minutes, counted from when the request was queued, so a run of it that collected the request late can be moved on while it still works. Upgrading is the fix.
One pull request per request. If your runner’s pull request arrives after SRE Agent’s runner took the request over, it is closed with a comment that links the other one, and its branch is kept. If SRE Agent’s run ended without a pull request, yours is kept instead and the card says so.
Where to see it. The request’s drawer in the Control Tower lists its Tries: where each ran, when it was queued, started and ended, and how it ended. The Fix runner on your own machine card on Integrations has a Queue section with the requests waiting for a runner, each machine with its last poll, its version, the models it declared (or a line saying it declared none, with a prompt to update the runner when its version is older than v2.7.0) and the request it holds, and the last 20 tries. Over MCP, get_fix_queue answers the same, and also whether the runner’s AI provider is refusing and which requests are held for that.
When your runner’s AI provider refuses the request
A provider that does not accept the runner’s key, an account with no credit or over its quota, a rate limit and a model the provider does not have are one failure of their own: the provider refused the request. Every machine of one runner holds the same key and model, so the request is never offered to another machine of the same runner, because that machine would be refused in the same way. It goes straight to the next step of the order above: SRE Agent’s runner takes it over when the repository’s setting allows it. Otherwise the request is held until your runner works again, which is the default, or ends failed when you have switched holding off. After three refusals in a row the runner as a whole is paused: see When your runner’s AI provider keeps refusing. The provider’s own words are shown. The model the provider named, the reason in a few words (the key was not accepted, no credit or billing on the account, over the account’s quota, rate limited, model not found) and what the provider wrote appear as plain text on the card, in the request’s drawer under Tries, in the Queue on Integrations and inget_fix_queue over MCP. The words are limited to one line of at most 500 bytes. Your organization’s AI provider keys are removed from them, and so is anything shaped like a key, a token, a resource name or an account number. They are shown to your organization alone.
When nothing takes the request over and holding is switched off, the card says so in those words, for example:
Your fix runner’s AI provider refused anthropic/claude-sonnet-4-5 (no credit or billing on the account): “Your credit balance is too low to access the Anthropic API; Please go to Plans & Billing to upgrade or purchase credits”. Nothing was changed. Check that provider’s key and account, then send the request again from the card.The Slack thread hears the ending in your organization’s language. When SRE Agent’s runner takes it over, its first AI call shows that a model answers, and the take-over is announced only then. If that call is refused, the request ends failed and the card says whose provider refused it:
- Your own AI provider, or your parent organization’s when you use its providers: the card quotes its words.
- SRE Agent’s own AI model, because of its quota or a missing model: the card names the reason only and never quotes the model’s answer.
- No AI model answered (a server error, a timeout, or a request SRE Agent got wrong), or SRE Agent’s own AI model could not be used for a reason of SRE Agent’s own account: the card says no AI model answered it just now, and you can send the request again.
A second model for when the first is refused
Your runner can hold a second model and key of your own, of any provider the runner supports, the first model’s provider included. When the first model’s provider refuses a request before anything was changed, the runner starts the request again on the second model, on the same machine, with the time that is left. Nothing of SRE Agent’s is sent to your machine for this: the second model and its key are yours. It needs runner v2.7.0. Set it up. Set both of these on the runner, or neither:SRE_MODEL_FALLBACK: aprovider/modelof a provider the runner supports.SRE_MODEL_FALLBACK_KEY: that provider’s key, a secret held like the first model’s key. It has its own variable so the second model can be the same provider on another account.
fix-runner Terraform module (v4.14.0 or later), set model_fallback:
extra_environment refuses SRE_MODEL_FALLBACK, which the module sets itself. The module refuses a model whose provider the runner does not support and the same model with the same key secret as sre_model. The runner refuses to start with only one of the two variables, with a provider it does not support, or with the same model and the same key as the first model, because there is nothing to switch to. A different model on the same key starts with a warning in the runner’s log: a key, credit or quota refusal follows it, a missing model or a rate limit does not.
When it is tried. The second model is tried at most once for a request, and only when the runner can show that the first run changed nothing: it only read files, the checkout is exactly the base commit, the runner’s memory directory is as it was, and the first run’s processes are gone. It is not tried when the first run had already run a tool that can change the checkout, or when less than two minutes of the run’s time is left. In both cases the try says so. A change on a pull request follows the same rules.
What you see. The card, the request’s drawer under Tries, the Queue on Integrations and get_fix_queue say which model did the work:
- When the second model finishes the request, the try reads Succeeded (or Declined) and says it was done with the second model after the first was refused, with what the first provider said. A pull request made this way says so in its footer.
- When both models are refused, the try reads Provider refused and shows both providers’ words, and the card says, for example:
Both of your fix runner’s AI models were refused: anthropic/claude-sonnet-4-5 (over the account’s quota) and then openai/gpt-5 (no credit or billing on the account). Nothing was changed. Check both providers’ keys and accounts, then send the request again from the card.When the second model is also refused, the order of When your runner fails goes on from there: SRE Agent’s runner takes the request over when the repository’s setting allows it. Otherwise the request is held (the default) or, with holding switched off, ends failed with the sentence above. Run a test job checks the second model too, in a step called Second model answered that runs even when the first model’s step failed, so one test shows both models. A runner with no second model passes that step with the detail no second model is configured, and a runner older than v2.7.0 reports seven steps and still passes.
When your runner’s AI provider keeps refusing
One refusal is one request’s problem. Three in a row, with no success between them, are the runner’s: its key has no credit, its account is over its quota, or its provider is rate limiting it. From then on SRE Agent stops sending that runner work it cannot do, and tells you. The count is for the whole runner, not for one request or one machine. A run the agent answered (a pull request, a decline, a timeout, a change that touched nothing) is a success and starts the count again. A failure that is not a refusal counts for nothing. What happens to requests while it lasts. The runner card on Integrations says Refused by its AI provider since a time, with the provider’s own words, shown masked as described in When your runner’s AI provider refuses the request. The words of SRE Agent’s own AI model are never shown.- A request for a repository with the fallback checkbox on goes straight to SRE Agent’s runner, and its card says why. Requests already waiting in your runner’s queue that no machine had collected move there too.
- A request for a repository that keeps its code on your machines (the checkbox is off) waits, untouched, and its card says waiting: your fix runner’s AI provider is refusing. It is not failed and it never runs anywhere else. A request one of your machines had already collected runs on, and its result settles as it always does.
- A change asked for on a pull request is held the same way, and the person who asked is told once, where they asked.
update_fix_runner takes hold_while_provider_down. Each change is recorded in the audit log. Turning holding on holds nothing retroactively.
How it recovers. Any of these closes it, and every waiting request then starts by itself, oldest first, 50 at a time:
- A run collected after the last refusal that the agent answers.
- A passing Run a test job. The letter to your admins says to run one.
- A new machine of the runner (a restart with a new key is a new machine, told apart by its hostname), or a machine that now declares other models. SRE Agent sends one waiting request to that machine only, as its check, and a success closes it. When nothing is waiting, the next new request is the check, and so is one someone sends with Try this one now. Each new machine, and each other set of models the refused machine declares, gets exactly one check. If that check ends neither refused nor answered (it failed another way, was discarded, or nobody collected it), that machine’s later polls send nothing more. A machine that starts after the check went out gets its own.
- For a rate limit or a quota, a timed check: ten minutes after the last refusal, then twenty, then up to an hour. A billing problem or a key the provider does not accept is never checked by time, because it does not fix itself.
- Resume on the runner card, or
resume_fix_runnerover MCP, sends a waiting request as the check now. - Try this one now on a waiting request, on its card or in the request’s drawer in the Control Tower, sends that request as the check.
discard_held_fix_requests takes a request id, or all with confirm. A discarded request ends declined and never runs. Its card and the person who asked are told that a person chose not to send it. Each discard is recorded in the audit log.
Who is told. Your organization’s admins get one email, and a Slack message where an admin has linked Slack, when the runner is first refused three times in a row. It carries the provider’s words and what to do. They get one reminder a day while it lasts and one when the runner works again. A runner whose first model is refused and whose second model does the work gets at most one letter a day. The letters are in English and go to your organization’s admins only.
Reading it. get_fix_runner_health, an organization admin’s tool, answers the runner’s state (working, degraded, refusing, checking or none), the provider’s last refusal, how many requests wait and the holding switch. get_fix_queue also lists the waiting requests. The configuration API serves the same read-only at GET /api/v1/config/fix_runner_health. With Terraform, provider 0.5.0 or later reads it as data.sreagent_fix_runner_health: any key the configuration API accepts can read it (an api:admin key, or a plan-only api:config_read key), and the GitHub integration and the self-hosted runner must be in your plan. The runner’s last refusal (last_refusal) holds the model name, the HTTP status and the AI provider’s own words, masked by SRE Agent, and Terraform stores it in the state like every value a data source reads, so keep the state where you keep the rest of your configuration. The card’s buttons and the MCP tools do the same things.
Related
- Quickstart: start here if no alerts are flowing yet.
- Improve your alert rules: fix the alert rule behind a noisy alert.
- Run and read an investigation: the diagnosis a fix request starts from.
- Plan matrix: which plans include fix pull requests.
- Find and manage your services: link a service to its repositories so fixes find them.
- Let SRE Agent act on incidents with self-healing: open fix pull requests from an alert without a request.
- Let fix pull requests merge by themselves: the opt-in setting that merges a fix once its required checks pass.
- Give a card to SRE Agent: let SRE Agent plan a card and request fixes as part of it.