An agent broke production: find the session, fix it, prove the fix held
The workflow is the code loop at version 0.4.0, merged in promptcompute.ai #836 (0.3.0 in #816); the production run is still to do. When the start names a case and no handoff was sent, the run sends it to the causing session once a person approves; a person can still send it from the RepoOps case page instead. RepoOps's own reliability record in AI Source of Truth seals the fix-held rate each week, not this run. The fix pull request opens with auto-merge off and never merges from the run.
Use case
An agent broke production: find the session, fix it, prove the fix held: a workflow across RepoOps, ContextFile, PromptCompute that starts from a person, an API call, or a RepoOps incident.opened event.
Who would use it
Engineering leads and on-call engineers when a change an AI agent wrote breaks production.
What value it provides
One run traces the error to the change and the agent session, builds the fix after a person approves it, and measures recovery at 24 hours and again at 14 days.
Why it matters to the user
When an agent's change breaks production, the team needs the session that wrote it and a record that the fix still holds two weeks on.
The problem
A production error lands and nobody can say which agent session wrote the change behind it. The fix ships, and two weeks later nobody checks whether it held.
Expected outcomes
- Errors traced to a change and an agent session
- Hours from the error to an approved fix
- Fixes still recovered 14 days later
Each run records its outcome as met, not met or not measured.
How it runs
Products and connections
| Product | Role in this workflow | Docs |
|---|---|---|
| RepoOps | Read the production error and its source (get_prod_incidents); Trace the error to the change and the agent session (get_incident_attribution); Read the handoff a person sent to the causing session, when the start names a case (get_agent_handoff); Send the handoff to the causing session once a person approves, when the start names a case and none was sent (send_agent_handoff); Build the fix a person approves, as a pull request with auto-merge off (build_fix); Measure recovery 24 hours after the fix (get_incident_recovery); Check that recovery held 14 days after the fix (get_incident_recovery); Propose a lesson to the RepoOps brain (propose_brain_entry); Promote the lesson a person approves (promote_lesson) | Reference · RepoOps docs |
| ContextFile | Read the context version the session read (context_versions) | Reference · ContextFile docs |
| PromptCompute | Reference · PromptCompute docs |
Outside the family: GitHub.
What a person approves
| Action | Default risk |
|---|---|
repoops.build_fix | medium |
repoops.agent_handoff.send | medium |
repoops.lesson.promote | medium |
Action keys are from the PromptCompute catalog.
How to access it from an agent
An agent runs a workflow through the PromptReports MCP server or API, and the runner calls each product for it. Both answer today, and the runner runs the code loop. This workflow will run there once its manifest ships. Switching on
// MCP: https://mcp.promptreports.ai/mcp
start_run({
workflow: "agent-broke-production",
inputs: { "production_error": "evt_9f2", "incident": "inc-0a1b2c3d", "repository": "repo-dashboard", "base_branch": "main", "case": "case_7f3a (optional)" },
dry_run: false
})
// returns { run_id, status: "running", approvals_url }
get_run({ run_id }) // poll, or subscribe to run eventscurl -X POST https://api.promptreports.ai/v1/runs \
-H "Authorization: Bearer $PROMPTREPORTS_AGENT_TOKEN" \
-d '{"workflow":"agent-broke-production"}'Or call the products yourself, step by step:
| Product | Endpoint | Tools |
|---|---|---|
| RepoOps | https://mcp.repoops.ai/mcp | search_brain get_pre_edit_context propose_brain_entry get_incident_attribution |
| ContextFile | Built | to confirm |
| PromptCompute | https://mcp.promptcompute.ai/mcp | request_approval get_approval cancel_approval answer_approver |
Set it up
The app at app.promptreports.ai is live. These steps will work once this workflow is on the runner. Switching on
- Sign in at app.promptreports.ai with PromptReports ID, and pick your org.
- Connect RepoOps, ContextFile, PromptCompute on the Connections page. Link GitHub through the product that uses it.
- Register the agent that will run it on the Agents page, and give it a version manifest.
- Set the approval policy for repoops.build_fix, repoops.agent_handoff.send, repoops.lesson.promote. Start with Require approval; critical actions are never auto.
- Fill in the inputs (Production error, Incident, Repository, Base branch, Case) and choose the trigger: a person, an API call, or a RepoOps incident.opened event.
- Start a dry run. It will count no workflow request, and it shows which steps would record missing evidence.
- Start the run. Approve each gate in the approvals inbox, then read the signed record when it ends.