Repository navigation
Description
#99 added scripts/modal-run to stop a wedged container rather than let it ride
the function timeout. It passes the run's own exit code through, which is
correct and was one of its four positive controls.
But modal run appears to exit 0 when its app is stopped out from under it.
Observed while #102 was in flight: an agent killed a duplicate ::regcount
container with modal app stop -y, and the wrapper reported exit 0. It noticed,
made no claim from it, and said so — which is the only reason this is written
down rather than sitting in a PR body as a green check that never ran.
That is the wrong way for this to fail. A stopped run and a passing run must not
be the same exit code, because the whole point of the wrapper is that a human or
an agent acts on what it reports.
Why it matters more than it looks
The wrapper's own wedge path calls modal app stop (#99). So on the branch
where it correctly detects a hang, it stops the app — and if the client then
exits 0, the only thing distinguishing "I killed a wedged run" from "the run
passed" is the wrapper's own bookkeeping. It happens to have that bookkeeping
(it returns 3 explicitly), so its own path is sound. The unsound path is
everything else: a concurrent agent stopping an app, a Modal-side eviction, a
spend limit tripping mid-run, someone hitting the dashboard's stop button.
An agent that reads exit 0 as "the gate passed" then reports verified work that
was never verified. That failure mode has already cost this repo once, in a
different guise — see the memory of a red build that was the spend limit and
not the diff.
Scope
- Establish what
modal runactually returns when its app is stopped
externally. One observation from a session that was doing something else is
not enough to build on. A CPU-only function and amodal app stopfrom a
second shell settles it for the price of a container-minute. - Make a stopped run non-zero, whatever the CLI does. If the exit code
cannot be trusted, the wrapper needs positive evidence of completion rather
than absence of failure — the entry point's own final line, or a sentinel
_runprints after the last command, checked before the wrapper returns 0.
Prefer the sentinel: it is one line inmodal_app.pyand it does not depend
on parsing anyone's CLI output. - A positive control, per layernorm_rows sits at 255 registers with spills and gets 2 blocks/SM where softmax gets 6 #67/softmax is now the slow kernel by 5.8x, and its CHUNK rung is only a quarter of it #76/gemm_cg2 is three registers from losing a third of its occupancy, and nothing is watching #95/A wedged container held a B200 for 26 minutes, and nothing was watching for it #99: stop an app mid-run and watch
the wrapper go non-zero. A wedged container held a B200 for 26 minutes, and nothing was watching for it #99's four controls are the shape to copy — the
fourth of them (a clean finish passing its own exit code through) is exactly
the one this issue says is incomplete, so extend that control rather than
adding a fifth beside it.
Acceptance
scripts/modal-run cannot return 0 for a run that did not finish, demonstrated
by stopping one. The reasoning for whichever mechanism is chosen lives next to
it, since the next reader's question will be "why not just trust the exit code".
Related: #99 (the wrapper and its controls), #93 (the fractional-CPU fix that
preceded it), #100 (regcount as a tier-2 job, which is why running gates by
hand is now redundant and this class of mistake is rarer).
Activity
A stopped run is not a passing run, and the exit code will not say wh…
CI.md: the graces, justified from the runner's own timestamps
The guards covered the runs a human started, and not one of the checks (