Technology

Engineering record

Partner workoutReplacement under review

Partner workout: each phone manages its own state

Even with the host’s phone deciding progress, the same facts were on both phones. We assign each fact to one phone, and each phone manages its own state.

In October we replicated shared progress on both phones. After that we let only the host's phone decide progress. Both times we focused on keeping shared progress in sync, and we were missing one thing: the actual sets and the position in the workout live on each person's own phone.

However firmly the host settled on a single progress, it still had to keep matching each person's actual workout. This wasn't a problem of how to merge. The problem was putting the same fact in both shared progress and the personal workout. On top of that, if the host's app stops in the background, both people's workouts stop with it.

What's mine, my phone knows

Now each phone owns its own state and sends that whole state. The other person's state is kept only as a mirror. The two people's turn, start and end aren't stored and synced. The same function computes them from the two states it receives. Instead of picking a single phone to decide, we made sure the same fact isn't stored twice. In the first 11 files we changed, we added 3,077 lines and deleted 1,899.

Is a quiet phone a disconnected phone?

We also looked again at the premise we used to judge connection. Until now we judged it by how long it had been since the last message. But a locked phone in a pocket is quiet when it has nothing to say. To tell the two apart, the app sent a signal every 20 seconds saying it was running, but it could only send while the screen was on. The signal we built to explain quietness couldn't be sent when the phone was quiet.

So we removed the periodic signal. What we really need to know isn't whether the other app is running, but whether our message got an answer. We treat the connection as down only when there's been no reply for 10 seconds after sending.

The whole design, in one paper

Written from that day’s point of view, using the documents and change history of the time. Published 2026.12.01.