TL;DR
You present two choices for your team, but it's a false dichotomy. The underlying issues are really:
- the lack of intra-team collaboration during development, and
- insufficient slack in your process to maintain a reliable cadence.
In the answer below, I reframe your current problem in order to analyze your chosen solutions. I then offer a "top ten list" of things your team can consider to craft a more suitable long-term solution for the project.
Framing the Problem
However, P1 issues are such that we cannot wait till the next sprint for them to get fixed.
With this statement, you describe a "P1 production issue" as something that takes precedence over the current Sprint Goal or the tasks defined for the current iteration during Sprint Planning. That means that you must adapt your planning process and capacity planning to accommodate these ongoing disruptions to the Scrum cadence.
You define two possible options, but neither is truly optimal. Let's look at why.
Analyzing Option One
- Whoever is the dev oncall fixes the issue; though they may not have the complete context of that area of code; they would get the context from the dev owner of that feature and fix the issue.
This looks like pair programming, collective code ownership, and collaboration, but it really isn't. By doing things this way, you're creating several problems and violating some core principles. In particular:
- You are doubling your on-call resources, increasing the level of disruption.
- You are incentivizing quick fixes over real knowledge transfer. No one is interested in exploratory testing or learning something new at 2 a.m. when they both still have to show up at work the next day.
- You are still encouraging the team to operate as individuals with unique areas of responsibilities, rather than true collaboration and swarming.
- You are hiding the impact of production issues rather than making the costs to the project and the team visible.
- This approach doesn't surface risk to the Sprint Goal.
Analyzing Option Two
Your second option is slightly better, but still has issues. You describe the option as follows:
- The dev oncall only does the initial analysis to confirm that it is a genuine issue, and dev owner of the feature fixes the issue.
This approach has some pros and cons, rather than simply being all downside. Some examples include:
Pros
- It reduces the level of off-hours effort to triage.
- It pushes the effort of fixing the issue onto the Sprint Backlog, making it visible.
- It creates transparency by tracking the issue as a task or chore on the Sprint Backlog.
- It forces the Sprint Team (including the Product Owner) and the organization to acknowledge the project costs associated with production support.
Cons
- Doing triage (rather than solving the problem right then) may increase your cycle time for applying fixes.
- Doing triage-only will increase the number of internal hand-offs and touch-points, which is an agile anti-pattern.
- It still compartmentalizes knowledge within the team, rather than encouraging full collaboration or T-shaped people.
- Production issues that impact your Sprint Backlog may require scope or content changes to the Sprint plan.
- Impact to the Sprint plan may jeopardize the Sprint Goal and force an early termination of the iteration.
Better Solutions
Don't get trapped by a false dichotomy. If you must choose between two inferior options, then pick the one that is least disruptive or that optimizes for transparency. However, the entire organization would be better served by taking a step back and performing a more comprehensive process analysis. Some grist for the mill includes:
- Switching to test-driven or behavior-driven design.
- Building pair programming and continuous integration into your development and QA processes.
- Ensuring your development, testing, staging, and production promotion processes are both automated and effective.
- Having a solid roll-back plan that leverages source control and feature toggles to avoid the need to troubleshoot production in the wee hours of the morning.
- Allocating team capacity to cross-functional knowledge sharing directly on the Product Backlog, making it a visible (but necessary!) cost to the project.
- Consider splitting production support into a separate team or activity from development. Scrum is optimized for development, not maintenance.
- Build in additional slack for production support during Sprint Planning, so that you aren't routinely pulling capacity from development.
- Update your Definition of Done to include regression testing.
- Treat the routine release of bugs to production as a huge red flag that your process may be broken, and needs careful analysis and redesign. Serious bugs in production should be very, very rare!
- Use transparency and visible costs to educate stakeholders and senior management on the false economies inherent in an unsustainable cadence, technical debt, or lack of budget allocated to sustainable agile practices.
In short, slowing down the pace by introducing pair programming, TDD/BDD, code reviews, continuous refactoring, continuous integration (CI), and other agile practices is essential to increasing quality and setting a sustainable cadence. This comes at a cost, though, in terms of time and manpower. It's up to senior management whether they want to pay that cost upfront, or pay it over and over down the line as an ever-increasing penalty for treating agility as a "go faster" button instead of a quality and fitness-for-purpose control framework.