Workflow Example: Fix a Bug
This note is a concrete example of the six-part workflow format in Engineering Workflows. It covers the Fix a bug task type from Task Types in Engineering Work. Like any workflow built before case data exists, it starts as a draft hypothesis to test and trim on actual bug fixes (Bottom-Up Approach).
1. Scope and Starting Input
- Task type: Fix a bug (one pull request of reviewable size).
- Activities used: Investigation, design decisions, implementation, and verification and review.
- Starting input: A bug report that states expected behavior, observed behavior, and how to see the bug (an input, log lines, or reproduction steps). If expected behavior is unclear, run Frame a problem first so the agent does not guess product intent.
- Out of scope: Production emergencies under time pressure (use Ship a hotfix) and missing features where current behavior matches the spec.
2. Steps
3. Decision Points
Work pauses for a person at three points:
- After step 1 (confirm reproduction): The engineer checks the failing test before any fix is written. This prevents fixing the wrong problem or trusting a test that fails for an unrelated reason.
- After step 3 (choose the fix): The engineer or owning role picks the fix level before code changes start. The agent supplies the root cause, the options, and which callers each option touches.
- After step 5 (merge): A person with merge authority commits the change into the main branch after checking the diff and evidence.
For a small, local, reversible bug (such as an obvious typo or off-by-one inside one private helper), steps 2 and 4 can stay brief. For bugs touching authentication, permissions, money, security, or stored data, require full review of both the reproduction and the fix options (Adjusting the Level for One Task).
4. Checks
- Self-checks (step 5): The collaborator agent runs the project’s test suite, type checker, and linter as it edits and fixes what they catch before opening the pull request.
- Independent checks (steps 2 and 6): The engineer inspects the reproduction before the fix exists, CI runs all automated checks on the pull request, and the reviewer checks the diff and evidence. For high-risk areas, a fresh checker agent reviews from the bug report and the diff alone, without the implementation session transcript (Independent Verification Workflows).
5. Backtracks
- Current behavior matches the docs (step 1 or 2): Stop and send the ticket to the product owner to clarify whether the behavior is a bug or a feature request.
- Chosen fix breaks callers or relies on a false assumption (step 5): Stop coding, discard local patches around the assumption, and return to step 3 with the new evidence.
- Tests pass only because a mock hides the failure (step 6): Return to step 1 and replace the mock with a check against the actual failure path.
6. Placement in a Project’s Setup
Testing and Trimming This Workflow
Run this workflow on a few bug fixes in one project and record each case (Bottom-Up Approach). Watch for two signals:
- Steps that earn their keep: cases where step 2 caught a misread bug report or step 3 prevented a symptom patch.
- Steps that add friction without changing decisions: if step 2 or step 4 adds delay on routine local bugs without catching errors, merge them into a single pre-implementation checkpoint for low-risk fixes and keep both stops only for higher-risk bugs.