Blog

Context Switching in Software Teams: How to Measure It

Context switching in software development is when an engineer leaves a piece of work unfinished to start another, then has to rebuild the context to continue. A little of it is normal. A lot of it means work is repeatedly left half-done, more items stay open at once, and delivery slows. This article explains what counts as a context switch, why most tools measure it wrongly, and how Valven measures it from the commits, pull requests and reviews your team already produces.
Valven Context Switching card showing switches per active day, fragmented days and switch types

Why Does Context Switching Matter for Engineering Teams?

Context switching matters because unfinished work is expensive to resume. When a developer stops halfway through a change, the mental model of that change fades. Getting it back takes time, and details get missed.

Context switching research: 23 minutes to resume, 29% of tasks never resumed, 44% self-interrupted

Research on interrupted work shows how large that cost is:

  • Getting back takes time. In Gloria Mark’s observation study at UC Irvine, interrupted work that was resumed the same day was picked up again after 23 minutes and 15 seconds on average, with about two other tasks in between (Gallup Business Journal).
  • Developers rarely restart instantly. Chris Parnin and Spencer Rugaber analysed 10,000 recorded programming sessions of 85 programmers. Only 10% of the sessions had coding start again in less than a minute (Resumption Strategies for Interrupted Programming Tasks).
  • Some work is never resumed. A study by Abad et al. reports that developers switch 59% of their daily tasks and never resume 29% of the tasks they were interrupted on or switched away from (arXiv:1805.05508).
  • Much of it is self-inflicted. In Mark’s study, people interrupted themselves about 44% of the time, so the pattern is often a habit of how work is organised, not only outside noise (Gallup Business Journal).

The cost also compounds at team level:

  • More work in progress. Each interruption leaves another item open, so more items wait at the same time.
  • Longer cycle times. Work that is picked up and dropped repeatedly takes longer to reach review and release.
  • Slower reviews. Reviews that are started and abandoned leave authors waiting for feedback.
  • Hidden overload. A team can look busy and still deliver slowly when attention is split across too many items.

Some switching is part of the job. Reviewing a colleague’s pull request or fixing an urgent bug means leaving your own work for a while. The goal is balance, not zero.

Is Context Switching Still a Problem with AI Coding Tools?

Yes. AI assistants change where engineers spend their attention, but they do not remove the cost of leaving work half-done. In some workflows they add new reasons to switch.

As AI becomes part of everyday development, context switching is becoming relevant in new ways. Google’s 2025 DORA research found AI adoption among software development professionals at 90%, and linked it to higher software delivery throughput. The same report describes AI as a “mirror and a multiplier”: in cohesive organisations it boosts efficiency, in fragmented ones it highlights weaknesses (Google, 2025 DORA report).
Context switching with AI coding tools: AI is a mirror and a multiplier for engineering teams
One source of fragmentation comes from how developers manage their work while waiting for AI agents to complete tasks. In METR’s February 2026 update on its developer productivity study, some developers said they would often work on an unrelated task while waiting for an AI agent to finish. The researchers also found time measurements unreliable for developers who run several agents at once (METR, February 2026).
These changes also raise questions about how productivity is perceived and measured. In METR’s early-2025 trial, experienced open-source developers took 19% longer on tasks when AI tools were allowed, while believing AI had sped them up by 20%. METR notes these results are now out of date, and its newer data points to likely speedups, but the gap between perception and measurement is the lesson (METR, July 2025).

The practical takeaway: as agents take on more of the typing, the human work shifts towards starting tasks, reviewing output and deciding what to merge. That is exactly the kind of work that gets fragmented. Measuring how often engineers leave work unfinished, and whether they come back to half-done reviews, matters more with AI, not less.

Why Counting Tasks Is Not Enough

Most tools approximate context switching by counting how many tasks a person touched in a day. That number mixes two very different situations:

  • A developer finishes item A, opens the pull request, then starts item B. Two items, no interruption.
  • A developer is halfway through item A, drops it for item B, then comes back to A. Two items, a real interruption.
Context switching vs. task count: finishing before moving on is not an interruption
A task count treats both days the same. A useful measure has to know whether the work that was left was finished. That means looking at what the engineer actually did on each item, in order, and at the moments that mark work as complete: opening a pull request for review, approving one, merging or declining it.

Reviews need their own rule. A reviewer who comments on several pull requests one after another, or comments and waits for the author, is not being interrupted. The interruption is when they leave a review half-done and later have to come back to it.

How Valven Measures Context Switching

Valven measures context switching from data your team already produces: commits, pull requests and code reviews, linked to issues. There is nothing to log by hand and no time tracking.

Three rules decide what counts:

  1. A work item is an issue. Commits and pull requests are grouped by the issue they belong to, so moving between two pull requests of the same issue is not a switch.
  2. Leaving unfinished development is a switch. If an engineer moves to another item before the pull request is ready for review, the work left behind counts as interrupted.
  3. Coming back to an unfinished review is a switch. Leaving a review is not counted on its own. It counts when the reviewer later returns to a review that is still open, without the author having pushed new changes in between.

A review is finished when the reviewer approves it, or when anyone merges or declines the pull request. Nothing counts after a long break of more than 24 hours, because a long pause interrupts nothing.

What the engineer doesCounted as a switch?
Commits on A, then starts B before A’s pull request is readyYes
Opens A’s pull request for review, then starts BNo
Reviews pull requests A, B and C one after anotherNo
Comments on A, works on B, then returns to review AYes
Comments on A, A is merged, then the engineer works on BNo
Comments on A, the author pushes new commits, the reviewer reviews againNo, it is a new review round
Picks up other work after a break of more than 24 hoursNo

How to Reduce Harmful Context Switching

Start with the pattern the data shows, then pick the matching fix:

  • Many coding to coding switches: too much work in progress. Limit how many items each person has open, and finish before starting.
  • Many coding to review switches: reviews arrive in the middle of focused work. Agree on review windows, for example twice a day, instead of reviewing on every notification.
  • Many returns to unfinished reviews: reviews are started without time to finish them. Keep pull requests small so a review fits in one sitting.
  • Switches concentrated in one project: that project is absorbing interruptions, often through urgent requests. Make the incoming work visible and route it deliberately.
  • Rising trend after a process change: compare before and after in Valven’s trend to see whether the change helped.

Measure again after each change. A good result is fewer fragmented days with the same or higher throughput.

See Where Your Team’s Focus Goes

Context switching is easy to feel and hard to see. Valven makes it visible from the work your team already does, shows which kinds of interruptions dominate, and points to the exact issues that were left unfinished.

Context switching by type in Valven: coding to coding, coding to review and returns to reviews
Book a demo to see Context Switching on your own repositories.

Frequently Asked Questions

What is a context switch in software development?
A context switch is when an engineer moves to another piece of work before finishing the current one. In Valven, it is leaving development unfinished, or coming back to a review that was left unfinished.
How do you measure developer context switching?
Measure it from the order of real work events, not from task counts. Valven reads commits, pull requests and reviews linked to issues, and counts a switch only when work was left unfinished.
Is reviewing a pull request a context switch?
Not by itself. Reviewing several pull requests in a row, or commenting and waiting for the author, is normal review work. It counts when the reviewer returns to a review they left half-done.
Does a merged pull request end the review?
Yes. Once anyone merges or declines a pull request, the review is finished for everyone who reviewed it.
What is a fragmented day?
A fragmented day is an active day with at least one context switch. The share of fragmented days shows how often a team’s working days are broken up.
Is context switching always bad?
No. Some switching is part of the job, such as reviewing a colleague’s work or handling an urgent fix. It becomes a problem when it is frequent and work keeps being left half-done.
Do AI coding tools reduce context switching?
Not by themselves. AI tools take over some of the typing, but engineers still start tasks, review generated code and decide what to merge. Waiting on agents can even add switches, as developers pick up other work in the meantime.
Should context switching be used to rate developers?
No. It describes how attention is divided across a team’s work, not how well a person performs. Compare people with their own usual level and use it to improve how work flows.
Recent Posts

Ready to level up your engineering productivity with Valven?

Request a Demo