Closes out run artifacts that a process death left open.
A run is marked terminal by the process that owns it, when it finishes. A process that is KILLED
— OOM killer, SIGKILL, host reboot — never gets to do that, so its result.json is never written
and the run reads as isInFlight forever. Nothing distinguishes it from a run still doing work:
the wizard spins indefinitely, the active-operations panel shows a live step that will never
advance, and no failure is reported anywhere, because the only process that could have reported
it is the one that died.
Observed 2026-09-14: an RSU run was OOM-killed during CompileTypeScript. Hours later the workspace
was healthy and idle, and that run still read as in-flight at step 'CompileTypeScript'.
The reconciliation is sound because run artifacts are PROCESS-LOCAL: every run this process can
see that is still in flight when this process is starting up necessarily belongs to a process that
no longer exists. That is only true at boot, before anything has started a run, which is the one
moment this may safely run.
'killed' is already the artifact vocabulary's term for this exit, so consumers that classify by
exitReason need no change to understand the result.
skip names the runs that are NOT dead: ones the starting process is itself the continuation
of and will resume (see RSUPostRestartProgressSession in MJServer). They are reported in
Skipped, untouched, so the caller can sweep whichever of them nothing resumed after all.
KNOWN LIMIT — assumes ONE process per artifact directory, which is the same single-writer
assumption the surrounding services document. If MJAPI is ever scaled past one replica sharing a
directory, a starting replica would close out a sibling's live runs. Gate the call, not this
function, if that day comes.
Closes out run artifacts that a process death left open.
A run is marked terminal by the process that owns it, when it finishes. A process that is KILLED — OOM killer, SIGKILL, host reboot — never gets to do that, so its
result.jsonis never written and the run reads asisInFlightforever. Nothing distinguishes it from a run still doing work: the wizard spins indefinitely, the active-operations panel shows a live step that will never advance, and no failure is reported anywhere, because the only process that could have reported it is the one that died.Observed 2026-09-14: an RSU run was OOM-killed during CompileTypeScript. Hours later the workspace was healthy and idle, and that run still read as in-flight at step 'CompileTypeScript'.
The reconciliation is sound because run artifacts are PROCESS-LOCAL: every run this process can see that is still in flight when this process is starting up necessarily belongs to a process that no longer exists. That is only true at boot, before anything has started a run, which is the one moment this may safely run.
'killed'is already the artifact vocabulary's term for this exit, so consumers that classify byexitReasonneed no change to understand the result.skipnames the runs that are NOT dead: ones the starting process is itself the continuation of and will resume (seeRSUPostRestartProgressSessionin MJServer). They are reported inSkipped, untouched, so the caller can sweep whichever of them nothing resumed after all.KNOWN LIMIT — assumes ONE process per artifact directory, which is the same single-writer assumption the surrounding services document. If MJAPI is ever scaled past one replica sharing a directory, a starting replica would close out a sibling's live runs. Gate the call, not this function, if that day comes.