Turn Sentry Errors into Reproducible Codex Test Cases
Transforms a production Sentry stack trace and context payload into a self-contained failing unit test designed for Codex repo tasks.
Agent prompt for ChatGPT
You get: Root Cause Summary, test File Path and reproduction Code
Prompt
mkdir -p .agents/skills/turn-sentry-errors-into-reproducible-codex-test-cases && curl -sL "https://prompts-gpt.com/prompts/turn-sentry-errors-into-reproducible-codex-test-cases/raw" -o .agents/skills/turn-sentry-errors-into-reproducible-codex-test-cases/SKILL.mdAct as a site reliability engineer and test automation specialist. Convert the production Sentry error dump I paste below into a minimal, reproducible failing test case that OpenAI Codex can run locally.
Rules:
1. Extract the offending function, line numbers, local variables, and error message directly from the frames.
2. Mock all external dependencies, network calls, and database drivers using standard library or common test runners (like pytest or jest); no live connections.
3. Keep the test fixture data scoped strictly to the payload values shown in the Sentry event.
4. Do not speculate on unstated architecture; provide standard stubbing.
Output format:
- Root Cause Summary: 2 sentences identifying the crashing file, method, and payload trigger.
- Test File Path: Suggested location in the repository.
- Reproduction Code: A complete, self-contained test script that fails with the identical exception.
- Assumptions: List any implicit types or environment variables assumed.Example output
Tips and common edits
Why this works
- Forces all network and database layers to be mocked, avoiding flakey dependencies during autonomous Codex runs.
- Binds reproduction fixtures directly to Sentry frames so the test reproduces the exact bug state without hallucinated logic.
- Specifies an exact file path and failure assertion, making it easy to hand off directly to Codex for resolution.
Paste your raw Sentry JSON export or stack trace text directly underneath the prompt in Codex or ChatGPT to generate an isolated local test.
Common edits
- Swap pytest for Jest or Vitest syntax if reproducing frontend or Node.js Sentry traces.
- Instruct the model to also output an AGENTS.md instruction block so an autonomous agent knows when the task is solved.
Reuse it: Use in a workflowAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Debug Regex and Parsers with GitHub Copilot
Generate an automated audit of regular expressions or parser snippets that flags catastrophic backtracking, isolates edge cases, and produces unit test fixtures.
Create Error Handling Contracts for AI Agents
This prompt transforms raw stack traces into structured error envelopes that provide agents with specific remediation steps and valid parameter constraints for self-correction.
Draft Reproducible Bug Reports from Error Stack Traces
Turn messy error logs and stack traces into structured, actionable bug reports with minimal reproduction scripts.
Generate Boundary Condition Unit Tests for GitHub Copilot
Get a comprehensive unit test suite focusing on edge cases, null pointers, and arithmetic overflows for any function you paste.
Generate Reproducible Bug Fix Specs for Coding Agents
Get a standalone reproduction test script and a precise technical plan to fix a bug, ensuring your AI agent stays focused and avoids unnecessary file changes.
Evaluate Coding Agent Test Suites for False Positive Traps
Audits agent-generated unit tests to catch tautological assertions, over-mocking, and tests that still pass when core business logic is disabled.
- Paste a Bug Report, Get a Test-First Fix in Any AI Chat
- Codex CI Failure Triage: Reproduce, Classify, Fix or Hand Off
- Unit Test Plan and Test Code for an Existing Function
- Root Cause Analysis from Stack Trace and Logs
- Convert raw error logs into a clean bug report
- Document module behavior from its test suite