{# A run's header, as a replaceable fragment. Rendered in two places: on the run page, and as the ``run_header`` SSE frame that closes a stream. It therefore takes only the run and the three flags below -- never the request -- so it can be rendered straight from Python. A plain ``
`` and not a panel of its own: the run page is one panel, and this is the half of it that can go stale. The id stays on *this* element rather than on the panel, so the stream's frame replaces the header without taking the console with it. Everything here comes from the run *row*, which is why it has to be replaceable at all. A run that goes terminal under an open stream leaves the page offering Stop for a process that is gone; the closing frame swaps this whole section for the one the server would render now. The timestamps and the log path are deliberately not here. The status line above already says where the run stands, the history lists when each run happened, and the raw log is a download in the console bar rather than a path to copy. Two controls, and the difference between them is the point: ``Stop`` asks the worker to wind down. It records intent and signals; it never writes an outcome, because only the worker knows whether cleanup finished. ``Force-finish`` the escape hatch for a worker whose liveness can never be determined, and which reconciliation therefore cannot settle. It abandons a possibly-live process, so it is behind a disclosure *and* a typed confirmation -- never one click away from Stop. #}
{# A breadcrumb rather than a title. This page is reached from the history and has nowhere else to go, so the heading is the way back; "Run" only named the page you were already looking at. The second crumb is which run this is -- its profile, which used to sit in the status line below and is not worth saying twice. "no profile" is a real, documented way to run a pipeline, so it is spelled out rather than left as a crumb that trails off. The link carries the profile the same way the app bar's nav does, so stepping back to the history and on to Plan keeps it. Built from the run row, not the request: this partial is rendered straight from Python for the stream's closing frame, which has no request to read. #}

Runs {% if run.profile %}{{ run.profile }} {% else %}no profile{% endif %} {# The run's state, on the same line as the run it belongs to. Still the replaceable ``#run-status`` fragment the stream swaps by id -- rendering it here rather than in a row of its own changes where it sits, not what keeps it current. #} {% include "_run_status.html" %}

{# Run this again, with *this run's* profile -- not the app bar's selector, which the reader may have changed since the page loaded. The profile rides in a hidden input, sent empty for a run that had none: ``POST /runs`` rejects a body with no ``profile`` field at all, because a request carrying no fields whatsoever is what a drive-by post looks like. Deliberately not ``id="run-form"``. That id belongs to the app bar's form, and the bar's selector binds to it by name: a second element with the same id would capture the selector and make Run post whatever this form carried. ``data-run-control`` puts it in the group the active-run poll governs, so it obeys the one-run-per-project rule like the bar's own Run. When this partial is re-rendered for the stream's closing frame there is no request and so no ``active_run`` -- the button comes back enabled, which is right the instant a run ends, and the poll corrects it if another has started. #}
{# A GET form rather than a styled link, so the control is a real `` {# The run's tallies, beside the controls that act on it rather than down in the console bar. ``app.js`` recounts them off the DOM as events stream in, by the ``data-counter`` attributes -- which is why this region's closing frame has to carry ``counters`` too, or a run going terminal under an open stream would blank them. "ran", not "tasks": this counts ``task_started``, so beside "skipped" the word "tasks" reads as a total, which it is not. The *key* stays ``tasks`` -- it is a ``counters()`` key, an ``app.js`` lookup key, and part of the ``unfinished`` derivation. #} ran {{ counters.tasks }} skipped {{ counters.skipped }} warnings {{ counters.warnings }}
{# No Run button here: the app bar has one, and on this page its selector is already set to this run's profile, so it *is* "run this again". A second ``id="run-form"`` would also be a duplicate id, and the selector would bind to whichever came first. #}
{% if not is_terminal %}
{% endif %}
{# Offered only for a run that looks wedged -- asked to stop and still going, or no heartbeat for longer than the supervisor's grace window. A visibly healthy run is exactly the case where abandoning its worker does the damage the paragraphs below warn about, so the hatch stays out of sight there. The route itself stays open to any non-terminal run: a run can go from wedged to healthy between this render and the POST, and refusing there would turn that race into the dead end this exists to prevent. #} {% if force_finish_offered %}
This run is stuck and Stop is not helping

A worker this machine will not let the supervisor inspect can never be proven gone, so the run stays unfinished and keeps this project's active-run lock -- and no new run can start. Force-finishing records interrupted (the status that already means "this run's real fate is unknown") and releases the lock.

It does not stop the worker. If that process is still alive it keeps running, keeps writing to the log, and may still be touching this project's outputs. Check for it yourself before starting another run.

the exact word, so this cannot be a mis-click
{% endif %}