Delegating Bug Fixes From Slack Incident Threads
Turn incident threads into structured briefs before handing fixes to coding agents.

Slack incident threads accumulate the raw material of a bug fix before anyone opens an editor: the error message, the reproduction steps, the repository and branch, and the team's working diagnosis all sit in one conversation. Most teams then spend the next hour manually translating that conversation into a task an engineer can execute. Delegating the fix directly from the thread to a coding agent is possible today, but only if each step in the handoff carries structured context rather than raw chat, and only if human control is enforced as code rather than as a prompt.
Why Slack incident threads already hold everything an agent needs to write a fix
The gap is not a shortage of information. It is a failure of extraction. An incident thread typically contains every input a coding agent requires, accumulated in the order the investigation unfolded: the first error message pasted by whoever was on call, the reproduction steps someone narrowed down an hour later, the repository and branch where the failure lives, screenshots captured mid-debugging, and the team's working theory of what broke. All of it is present before anyone has opened a code editor, and none of it reaches the agent in a usable form.
The cost is paid twice. First, an engineer reads the thread and reconstructs the incident into a task description, deciding which messages are signal and which are noise. The agent, if one is used at all, receives a paraphrase of a paraphrase.
What the agent actually needs before it can write a useful fix
A vague brief produces a vague fix, and a vague fix is worse than no fix at all. For the thread to function as an agent brief, four things must be present before anything is triggered: a clear problem statement, the affected repository and branch, enough reproduction detail to trace root cause, and whatever investigation the team has already done. The first three tell the agent where to look. The fourth tells it what dead ends not to re-walk.
Root cause precedes repair. The Slack2PR community workflow encodes this as an "investigate first, wait for approval" gate on bug types, and the reasoning is blunt: a fix written without understanding why the failure occurred is a new bug with cleaner formatting. Cursor's Slack bug-fix workflow makes the same demand explicit by instructing the agent to trace the issue through the code and understand the cause, not merely locate the symptom, and to post findings as a comment rather than open a pull request when its confidence is low.
The brief itself should be a rendered artifact, not the raw thread. incident.io's delegation flow assembles a self-contained markdown brief before any agent runs, containing the incident title and reference, the repository, user instructions, pull request expectations, and a snapshot of the investigation to that point. Repository targeting is not negotiable: Cursor's template refuses to activate until a repository is connected, and Replicas takes repository and message as the two required fields in its API call. All of this can be assembled automatically from the thread, which is precisely what the next step in the workflow depends on.
How to trigger the agent from the thread without switching tools
The trigger method decides if the workflow stays inside the incident conversation or breaks into a separate tool. Three options exist: an @mention, a Slack automation, or a webhook call, and each trades visibility against control differently. The @mention path is the most immediate. Once invited, Claude Code detects coding intent and creates a cloud session from a mention in any channel or thread, but not from a direct message. Cursor's integration works the same way, starting a cloud agent from a thread mention that can run for hours on complex tasks.
The automation and webhook path suits recurring incident classes, not one-off delegations. Cursor's bug-fix template fires on a message event and passes the triggering message to the agent, with one structural caveat: the payload contains only the first message's text, so the agent must actively read the rest of the thread itself. The system then attaches the pull request link automatically when the run completes, and the template's own guidance is to scope the trigger to one repository and widen it only once results earn trust.
The API path is the cleanest boundary. incident.io calls POST /agents on the connected platform with the markdown brief and structured identifiers, and the platform replies with status callbacks or accepts polling, which lets a team route the same workflow to whichever agent it has configured. Replicas accepts an API call with repository, message, and agent choice as its parameters, so any Slack automation can fire a coding agent in an isolated cloud VM without a team member leaving the incident thread, then route the resulting PR back into the conversation for review. Ownership matters here as much as mechanism: Cursor's template recommends billing runs to a team-owned automation so they are visible across the team rather than attributed to one person's account.
What the agent's environment must be able to do to actually verify a fix
An agent that can write code but cannot run tests, install dependencies, or drive a browser cannot verify its own work. It can only guess, and a guessed fix presented as a pull request is review noise dressed as progress. The environment must be functionally equivalent to a real developer machine, not a read-only shell with a prettier prompt.
Kolega demonstrates what this requirement looks like in practice. It pushes code, watches CI, reacts to review comments, resolves merge conflicts, and distinguishes a repository-wide CI flake from its own bug. Codex reflects this in its three sandbox modes. Danger-full-access is acceptable only inside an already-isolated environment such as a dedicated VM or Docker container, where OS-level damage is contained.
Replicas runs each agent in its own Linux VM with the team's repository, dependencies, and services pre-loaded. Because those VMs are isolated and pre-configured with the team's full tooling, the agent can install packages, run the test suite, and validate its own fix before returning the pull request, making the cloud environment functionally equivalent to a local developer machine. A persistent-paused sandbox that keeps filesystem state between runs suits multi-session incidents where the agent resumes rather than reboots.
How context degrades across a long incident and what to do about it
A capable sandbox cannot save an agent that has forgotten what it was solving. The failure arrives subtly: the agent recalls an architecture decision from the first hour of the incident and still edits the wrong file, because the repository changed ten minutes ago. Continuity only helps when durable knowledge stays separate from live evidence. The degradation is structural, not accidental. Details that lived only in the conversation, reasoning that was never saved to a durable project file, can vanish, and the agent resumes fluent but subtly unmoored, confident in a context it no longer actually holds. The fix is to externalize state. MCP is becoming the connective layer for live evidence, and it does so precisely because it inverts the dependency: rather than trusting the context window to hold everything, the agent pulls what it needs when it needs it. incident.io's flow lets its delegated agents pull live incident context through MCP servers instead of relying on the static brief alone, and Linear Agent gathers evidence from Sentry or Datadog through MCP to trace root cause before producing a fix.
Where human control must sit in the loop and how to enforce it structurally
Human oversight is only reliable when it is a hard structural gate. Anything a prompt can enforce, a prompt injection can remove. So the design question is not whether humans should supervise, but which gates must exist as executable code rather than system-prompt instruction.
Merging is the obvious first gate, and Kolega's history makes the point sharply. The agent once merged its own pull request the moment it detected an approval, so merging now happens only on explicit human instruction, written as policy in code, not as a reminder in a prompt. A separate gate sits upstream, before the PR exists at all: Cursor's template instructs the agent to post findings as a comment rather than open a pull request when it is not confident, which keeps humans in the loop on risky changes through confidence-gated output instead of unconditional PR creation.
Trust scope is the second structural concern. Kolega's rules about which authors the agent may listen to and which actions need a human click are executable checks, not instructions the agent could be talked out of. incident.io's delegation interface carries the same principle: it requires a bearer token, provides a per-launch signing secret so the agent can sign every status callback, and lets the agent open the PR with its own credentials in the team's infrastructure, while incident.io itself needs only read access to attach the finished PR to the incident. Replicas attributes every agent minute to a source, harness, model, and credential, so the team can see what ran, who triggered it, and what it cost without asking the agent to report on itself.
How the PR gets routed back into the incident thread and what the thread should show
The pull request is only useful if it arrives where the incident is being managed. The return path is not a courtesy. It is the step that closes the loop.
The linkage is automated across the major flows. When incident.io's agent reports finished with the PR URL, incident.io attaches the PR to the incident and moves the task into review, so the responder never leaves the channel to find the fix. The thread becomes a record of what happened without the agent live-streaming its internal monologue.
Follow-up instructions should update the same run rather than start a new one. incident.io supports POST /agents/{id}/followup, so a responder asking for changes updates the same PR and keeps the incident record continuous. At the end of the loop, cleanup is part of the process: Kolega tears down its dev environment, transitions the Jira ticket, and signs off in the thread when the PR merges. Replicas records each run with attribution to source, person, harness, model, and credential, which is what makes it possible to measure which fixes actually shipped from which incidents, not merely that agents ran.
Choosing which agent to run for incident fixes, and what the tradeoffs actually are
The choice of agent is not a preference. It is an engineering decision with measurable consequences. Claude Code and Codex sit at opposite ends of the benchmark comparison. Claude Code on Opus 5.5 runs $13.04 and 1.1 hours per task, while Codex on GPT-6 Astra runs $7.47 and 29.4 minutes, nearly half the cost at a fraction of the time, with a modest score penalty. Both integrate into Slack directly. Codex describes itself as understanding complex codebases and debugging difficult issues, while Claude Code pitches building, debugging, and shipping faster from inside the codebase. Cursor is the investigation-first choice for incidents where root cause is genuinely unclear. The confidence gate, commenting instead of opening a PR when uncertain, makes it lower-risk for ambiguous failures, and incident.io supports Cursor as a delegated agent through an API key, with the PR opened using the team's Cursor configuration including MCP servers.
Opencode is the option when vendor lock-in or secret isolation is the constraint. It routes to more than 75 LLM providers as an open-source layer, so a team that cannot send code or credentials to a closed provider, or wants to swap models without changing tooling, has a path. Replicas runs all four of these, Claude Code, Codex, Cursor, and Opencode, each in its own isolated Linux VM, so the choice is per-run rather than per-team and different incident types can be assigned to different agents without changing the surrounding workflow. The deeper structural point is that none of these agents was built as team-shared infrastructure. Running them through a cloud platform that wraps each run in its own VM, as Replicas does, is what converts individual developer tools into infrastructure a whole team can delegate to.
What a complete Slack-to-PR delegation workflow looks like when all the steps are connected
The workflow that consistently ships fixes rather than adding noise has a specific shape: each step hands structured output to the next, and human control sits at two structural gates, approving the brief before the agent runs and approving the PR before it merges. The sequence runs as follows. The agent executes in an isolated VM with full toolchain access, installing dependencies, running tests, verifying the fix, and watching CI rather than working in a read-only sandbox. The agent cleans up its environment, closes the ticket, and the thread archives with a full audit log.
Each skipped step produces a specific failure. No attribution means the team cannot tell which fixes came from which incidents, which agents, or what any of it cost. The machinery exists to close every one of those gaps, and the teams that ship fixes from their incident threads are the ones that treat each step as a structural requirement rather than a convenience.


