mirror of
https://github.com/nestriness/nestri.git
synced 2026-11-10 09:22:28 +02:00
`ended` and `failed` say how a run finished but not why: a stop its owner asked for, a free weekend running out, an idle box and a game quitting on its own all left the same row behind. A session now carries `end_reason`, one word from a fixed list, written by whoever ends the run, and `time_claimed`, stamped when a host takes the run, so bring-up can be measured from the claim rather than from the request. The control plane writes the two endings it decides itself: `user` when the owner stops a run nobody had claimed yet, and `left_queue` when a waiting run is abandoned. The write keeps a reason only on a terminal state, the same way an error message is kept only for a failure, so no row can say it ended while it is still going. Both fields are returned wherever a session is. The column is text rather than a database enum so a reason added later is a code change and not a migration.