diff --git a/app/nullius/execution.py b/app/nullius/execution.py index f3c2758b..2e0d91d5 100644 --- a/app/nullius/execution.py +++ b/app/nullius/execution.py @@ -633,13 +633,13 @@ def summary(self) -> dict: def stages(self) -> dict: """The stages said so far, folded for the page (``progress.fold``). - Once the run has failed or been stopped, a stage still running was - cut short by it, and nothing is waiting any more.""" + Once the run has ended, no stage is running or waiting any more. + Counts remain exactly what the progress events reported.""" with self._lock: events = list(self.events) got = progress.fold(events) - if self.state in ("failed", "stopped"): - got["stages"] = [dict(r, state="failed") if r["state"] == "running" else r for r in got["stages"] if r["state"] != "waiting"] + if self.state in ("done", "failed", "stopped"): + got["stages"] = [dict(r, state="done" if self.state == "done" else "failed") if r["state"] == "running" else r for r in got["stages"] if r["state"] != "waiting"] got["current"] = None return got diff --git a/app/nullius/progress.py b/app/nullius/progress.py index bdfcb477..1208bb1f 100644 --- a/app/nullius/progress.py +++ b/app/nullius/progress.py @@ -271,6 +271,10 @@ def fold(events: Iterable[dict]) -> dict: stages[key]["key"] = key stages.setdefault(key, {"key": key, "stage": st, "label": label(ev), "state": "waiting"}) row = stages[key] + if state == "start": + # A later part or retry starts this stage afresh. + for field in ("seconds", "bytes", "total", "detail"): + row.pop(field, None) row["label"] = label(ev) if ev.get("detail") is not None: row["detail"] = ev["detail"] @@ -295,7 +299,7 @@ def fold(events: Iterable[dict]) -> dict: last = seen[-1] if seen else -1 rows = [r for i, r in enumerate(rows) if r["state"] != "waiting" or i > last] if ended: # a run that ended has nothing running, nor anything still to come - rows = [dict(r, state="failed") if r["state"] == "running" and ended == "refused" else r + rows = [dict(r, state="failed" if ended == "refused" else "done") if r["state"] == "running" else r for r in rows if r["state"] != "waiting"] current = next((r for r in rows if r["state"] == "running"), None) return {"stages": rows, "units": units, "current": current["key"] if current else None, "ended": ended, "detail": detail} diff --git a/app/static/runs/board.css b/app/static/runs/board.css index 43fe2e66..df7f4bd9 100644 --- a/app/static/runs/board.css +++ b/app/static/runs/board.css @@ -372,6 +372,19 @@ box-shadow: var(--shadow); font: 12px/1.45 var(--sans); color: var(--text); pointer-events: none; } @media (prefers-reduced-motion: reduce) { .rp *, .rp *::before, .rp *::after { transition: none !important; } } + +/* Run identity belongs on the full run overview, above its views. */ +.run-identity{align-items:center;gap:10px} +.run-identity-card{display:flex;align-items:center;gap:12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);padding:9px 14px;min-width:0;max-width:100%;color:var(--text);line-height:1.5} +.run-identity-card>div{min-width:0;overflow-wrap:anywhere} +.run-identity-card .k{display:block;color:var(--text-dim);font-size:.75rem} +.run-identity-card .v{display:block;font-weight:500} +.run-identity-sep{width:1px;flex:none;align-self:stretch;background:var(--border)} +.run-identity-mark{width:32px;height:32px;border-radius:8px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font:500 15px/1 var(--mono);flex:none;padding:6px} +.run-identity-mark:has(.agent-logo){padding:4px;background:color-mix(in srgb,var(--text) 8%,transparent);color:var(--text)} +.run-identity-model{display:block;font-size:.8rem;color:var(--text-dim);overflow-wrap:anywhere} + +.run-runner-logo{width:32px;height:32px;flex:none;color:var(--text)} /* the Filtered score under the adjusted rate: a switch per kind of flag, and the rate without those tasks */ .rp .filtered { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin: 1rem 18px 0; } .rp .filtered .filter-heading { flex-basis: 100%; color: var(--text-faint); font-size: .8rem; } diff --git a/app/static/runs/live-board.css b/app/static/runs/live-board.css index 0f870e07..b8da7721 100644 --- a/app/static/runs/live-board.css +++ b/app/static/runs/live-board.css @@ -1,4 +1,4 @@ -/* The job page's two views, and the Live board. +/* The job page's views, and the Live board. Scoped to .lb; the phase and outcome hues are the app's own. */ /* ---- the two views ---- */ @@ -183,3 +183,5 @@ .lb-open-row:hover { text-decoration: underline; } /* the board counts the trials itself: the run strip's own task bar would say it twice */ body:has(#live-board) #execution-units { display: none; } + +.view-tabs [role="tab"]:disabled { color: var(--text-faint); cursor: default; } diff --git a/app/static/runs/live-board.js b/app/static/runs/live-board.js index f6a997bf..b7a9d787 100644 --- a/app/static/runs/live-board.js +++ b/app/static/runs/live-board.js @@ -307,8 +307,20 @@ let snap = null, timer = null, misses = 0; // opened while the run was going: the Results rendered with the page are older than its end const startedLive = board.dataset.state !== 'finished'; + let waiting = board.dataset.state === 'unknown'; function paint() { - if (!snap) return; + if (!snap || stateOf(snap) === 'unknown') return; + if (waiting) { + waiting = false; + doc.getElementById('preparing')?.remove(); + const liveTab = doc.getElementById('tab-live'); + if (liveTab) liveTab.disabled = false; + const resultsTab = doc.getElementById('tab-results'); + if (resultsTab) resultsTab.disabled = false; + const dot = doc.getElementById('live-dot'); + if (dot) dot.classList.toggle('on', stateOf(snap) !== 'finished'); + doc.dispatchEvent(new Event('live-ready')); + } const out = render(snap, opts); board.dataset.state = out.state; $('[data-lb-state]').textContent = out.stateLabel; @@ -338,8 +350,18 @@ async function tick() { try { const r = await nulliusFetch(endpoint, {headers: {'Accept': 'application/json'}, cache: 'no-store'}); - if (!r.ok) throw new Error('HTTP ' + r.status); - misses = 0; snap = await r.json(); + if (!r.ok) { + if (waiting && doc.getElementById('execution')?.dataset.live === 'no') { clearInterval(timer); timer = null; } + throw new Error('HTTP ' + r.status); + } + const next = await r.json(); + if (waiting && (next.state === 'unknown' || !next.counts)) { + if (next.state === 'finished' || doc.getElementById('execution')?.dataset.live === 'no') { + clearInterval(timer); timer = null; + } + return; + } + misses = 0; snap = next; } catch (e) { misses += 1; } paint(); } @@ -360,7 +382,7 @@ paint(); if (!snap || stateOf(snap) !== 'finished') { timer = setInterval(tick, 1000); tick(); } } - // The two views of the job page: switched in place, kept in the address as ?view=. + // The views of the job page: switched in place, kept in the address as ?view=. function mountTabs(doc) { const tabs = Array.from(doc.querySelectorAll('[data-view-tab]')); if (!tabs.length) return; @@ -376,11 +398,14 @@ if (view === 'results' && badge && badge.dataset.stale) { location.assign(u); return; } history.replaceState(null, '', u); } - tabs.forEach((t, i) => { + doc.addEventListener('live-ready', () => { + if (!new URL(location.href).searchParams.has('view')) show('live'); + }); + tabs.forEach(t => { t.addEventListener('click', () => show(t.dataset.viewTab)); t.addEventListener('keydown', e => { const d = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0; - if (d) { e.preventDefault(); const n = tabs[(i + d + tabs.length) % tabs.length]; n.focus(); show(n.dataset.viewTab); } + if (d) { e.preventDefault(); const enabled = tabs.filter(t => !t.disabled); const i = enabled.indexOf(t); const n = enabled[(i + d + enabled.length) % enabled.length]; n.focus(); show(n.dataset.viewTab); } }); }); } diff --git a/app/static/traces/conversation.css b/app/static/traces/conversation.css index 69ae22b7..cd4ca46e 100644 --- a/app/static/traces/conversation.css +++ b/app/static/traces/conversation.css @@ -45,18 +45,24 @@ @media(max-width:850px){.reader-selected{padding:18px}.reader-layout{grid-template-columns:minmax(175px,30%) minmax(0,1fr)}.reader-step-nav{align-items:flex-start;flex-direction:column;gap:12px}} @media(max-width:600px){.reader-layout{grid-template-columns:minmax(0,1fr);min-height:0}.reader-index{border-right:0;border-bottom:1px solid var(--border)}.reader-rows{max-height:230px;overflow:auto}.reader-row{padding:10px 12px}.reader-row-preview{-webkit-line-clamp:1}.reader-selected{padding:16px}.reader-content pre{max-height:360px;padding:12px}.reader-search{gap:6px}.reader-toolbar{gap:10px}.reader-jump{width:100%}.reader-jump input{flex:1;min-width:0}.reader-content-nav{gap:6px;font-size:10px}.trial-tabs{gap:22px}.reader-filters{width:100%;justify-content:space-between}.reader-filters button{padding:7px 8px}} -/* the trial's head: what ran, then how it went, one row that wraps */ +/* The trial's own metrics, in a row that wraps. */ .trial-head{display:flex;flex-wrap:wrap;gap:10px;margin:14px 0 6px;align-items:stretch} -.th-card{display:flex;align-items:center;gap:12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);padding:9px 14px;min-width:0} -.th-card .k,.th-strip .k{display:block;color:var(--text-dim);font-size:.75rem} -.th-card .v{display:block;font-weight:500} -.th-sep{width:1px;align-self:stretch;background:var(--border)} -.th-mark{width:32px;height:32px;border-radius:8px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font:500 15px/1 var(--mono);flex:none;padding:6px} -.th-mark:has(.agent-logo){padding:4px;background:color-mix(in srgb,var(--text) 8%,transparent);color:var(--text)} -.th-model{display:block;font-size:.8rem;color:var(--text-dim);overflow-wrap:anywhere} -/* The cells keep their own width: the strip sits beside the cards while all of them fit on one - line, moves under the cards when they do not, and wraps its cells when the page itself is narrower. - The 1px gaps over the border colour are the rules between cells, on every row. */ +.th-strip .k{display:block;color:var(--text-dim);font-size:.75rem} +/* The 1px gaps over the border colour separate the cells on every row. */ .th-strip{display:flex;flex-wrap:wrap;flex:1 0 auto;max-width:100%;gap:1px;background:var(--border);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden} .th-strip>div{flex:1 0 auto;padding:9px 14px;background:var(--surface);white-space:nowrap} .th-strip .n{display:block;font-size:1.1rem;font-weight:500;font-variant-numeric:tabular-nums} + +/* A shared model-usage card, with compact token and growth charts. */ +#task-usage .mix-bar{height:8px;width:100%} +.usage-section-title{font-size:11px;font-weight:500;letter-spacing:.08em;text-transform:uppercase;color:var(--text-dim);margin:16px 0 10px} +.usage-growth-title{margin-top:24px} + +.usage-stat{display:inline-flex;align-items:center;gap:6px;color:var(--text-dim);font-size:12px;cursor:default}.usage-stat b{color:var(--text);font-weight:500} + +.task-activity{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start;margin-bottom:24px} +.task-activity>.panel,.task-activity-left>.panel{min-width:0;margin:0;padding:16px} +.task-activity-left{min-width:0;display:grid;gap:16px;align-content:start} +.usage-tools-table{overflow-x:auto} +#task-tools .tool-names td:first-child{white-space:normal;overflow-wrap:anywhere} +@media(max-width:1000px){.task-activity{grid-template-columns:minmax(0,1fr)}} diff --git a/app/templates/runs/_execution.html b/app/templates/runs/_execution.html index 558b8058..d026880f 100644 --- a/app/templates/runs/_execution.html +++ b/app/templates/runs/_execution.html @@ -31,12 +31,12 @@ {%- if st.state == 'cached' %}cached{% elif st.get('seconds') is not none and st.state in ('done', 'failed') %}{{ st.seconds|secs }}{% endif %} {%- if st.state in ('running', 'failed') and st.detail and st.detail != sp.detail %}{{ st.detail }}{% endif %}{% endfor %} -
{% if sp.units %}{% set u = sp.units %}{{ u.done }} / {{ u.n if u.n is not none else '?' }} {{ u.noun }}{% for k in ('passed', 'failed', 'scored', 'errors') if u[k] %} · {{ u[k] }} {{ 'error' + ('' if u[k] == 1 else 's') if k == 'errors' else k }}{% endfor %}{% if u.running %} · {{ u.running }} running{% endif %}{% endif %}
+
{% if sp.units %}{% set u = sp.units %}{{ u.done }} / {{ u.n if u.n is not none else '?' }} {{ u.noun }}{% for k in ('passed', 'failed', 'scored', 'errors') if u[k] %} · {{ u[k] }} {{ 'error' + ('' if u[k] == 1 else 's') if k == 'errors' else k }}{% endfor %}{% if u.running %} · {{ u.running }} running{% endif %}{% endif %}
{% if sp.ended == 'refused' %}Refused before its first unit: {{ sp.detail }}{% endif %}
{# a part downloading: its file, how much of it, as a bar #} -
Launch log
+
Launch log
+{% endmacro %} diff --git a/app/templates/runs/job.html b/app/templates/runs/job.html index f65a7aca..a4ad6ea6 100644 --- a/app/templates/runs/job.html +++ b/app/templates/runs/job.html @@ -1,3 +1,4 @@ +{% from 'runs/_live_board.html' import live_panel %} {% from 'runs/_execution.html' import execution_strip %} {% from 'traces/_attempts.html' import attempt_count %} {% extends "base.html" %} @@ -9,18 +10,33 @@ {% block body %}{% set oc = job.counts %} {% set meta %} -
- {% if job.agent_label %}{{ job.agent_label }}{% if job.agent_version %} v{{ job.agent_version }}{% endif %}{% endif %} - {{ job.model_name }} - {{ job.dataset|dsname }} +
+ {% set dataset = nav_catalog.dataset(job.dataset) if nav_catalog else none %} + {% set sources = job.trials|map(attribute='source')|select|unique|list %} + {% set benchmark = dataset.benchmark if dataset else (sources[0] if sources|length == 1 else none) %} +
+ {% if not job.runner %}{% endif %} +
Runner{% if job.runner %}{{ job.runner }}{% if job.runner_commit %} {{ job.runner_commit }}{% endif %}{% else %}harbor{% if job.harbor_label %} {{ job.harbor_label }}{% endif %}{% endif %}
+
+ {% if job.dataset %}
+ {% if benchmark %}
Benchmark{{ benchmark }}
{% endif %} +
Dataset{{ job.dataset|dsname }}
+
{% endif %} + {% if job.agent_label or job.model_name %} +
+ {% if job.agent_label %}{% endif %} +
{% if job.agent_label %}{{ job.agent_label }}{% if job.agent_version %} v{{ job.agent_version }}{% endif %}{% endif %} + {% if job.model_name %}{{ job.model_name }}{% endif %}
+
+ {% endif %} {% if control %}control {{ control.label }}{% endif %} - {% if job.runner %}{{ job.runner }}{% if job.runner_commit %} {{ job.runner_commit }}{% endif %} - {% else %}harbor {% if job.harbor_label %}{{ job.harbor_label }}{% else %}unknown{% endif %}{% endif %} - {{ job.trials|length }}{% if job.n_planned and job.n_planned != job.trials|length %} of {{ job.n_planned }} planned{% endif %} trials - {% if job.n_retries %}{{ job.n_retries }} retried{% endif %} - {% if job.duration_min %}{{ job.duration_min|runtime }}{% endif %} +
+
Trials{{ job.trials|length }}{% if job.n_planned and job.n_planned != job.trials|length %} of {{ job.n_planned }} planned{% endif %}
+ {% if job.duration_min is not none %}
Duration{{ job.duration_min|runtime }}
{% endif %} + {% if job.n_retries %}
Retried{{ job.n_retries }}
{% endif %} +
{% endset %} {% set actions %} {% if execution and execution.plan.recipe %}Copy command{% endif %}{% endset %} {{ page_head(job.job_id, sub=meta, actions=actions) }} -{% if execution %}{{ execution_strip(execution, csrf, own=own if execution.plan.steps()|length > 1 else none, deletable=deletable) }}{% endif %} +{% set board_ready = live_board and live_board.initial and live_board.initial.state != 'unknown' %} {% if job.is_preparing and not live_board and not ended %} {# Launched, not started: Harbor has written the configuration and nothing else. There is no result record and no feed to fold yet, so this page - waits for the feed and reloads itself when it appears. #} + waits for the feed and opens Live when it appears. #}
- Preparing — this run was launched and {{ job.runner or 'Harbor' }} has written its configuration; no trial has started yet. - The live board appears here as soon as the first event lands. This page refreshes itself. + Preparing — this run was launched and {% if job.runner %}{{ job.runner }}{% if job.runner_commit %} {{ job.runner_commit }}{% endif %}{% else %}harbor{% if job.harbor_label %} {{ job.harbor_label }}{% endif %}{% endif %} has written its configuration; no trial has started yet. + The live board appears here as soon as the first event lands.
{% elif (job.is_running or job.is_preparing) and ended %} {# Harbor's record says trials are running; the runner that started it says @@ -68,39 +84,20 @@
The live feed could not be read — {{ live_board.error }}. The sections below come from the trial results and are unaffected.
{% endif %} {% if view %} -{# Two views of one page. Live: the job's events.jsonl folded every second while it runs, and kept once it ended as the - record of how it ran. Results: the page rendered from the job's files when this page loaded. ?view= picks; without - it, Live while the feed says the job is going. At job.end Live stops asking and says Results is ready; no reload. #}
- - + + + {% if execution %}{% endif %}
+{% if execution %} +
+{{ execution_strip(execution, csrf, own=own if execution.plan.steps()|length > 1 else none, deletable=deletable) }} +
+{% endif %}
-
-
- {{ live_board.initial.state|capitalize }} - - -
-
-
- -
    - -
    -
    -
    -
    All trials
    -
    -
    - -
    - -
    - +{% if board_ready or execution or job.is_preparing %} +{{ live_panel(job.job_id, live_board, '' if job.runner and not job.standard and not job.trials else url_for('job', job_id=job.job_id), job.runner_items[0] if job.runner_items else '') }} +{% endif %}
    {% if job.is_running and not ended %} @@ -110,18 +107,6 @@
    {% endif %} {% endif %} -{% if job.is_preparing and not live_board and not ended %} - -{% endif %} - {#- Board counts are whole-run and never change under a filter; the trial rows are rendered here, and job.js only filters, sorts and links them. Every lane and tally count is nullius.judge.lanes, which is reconcile's. -#} diff --git a/app/templates/runs/preparing.html b/app/templates/runs/preparing.html index fb4e35db..18aa21e1 100644 --- a/app/templates/runs/preparing.html +++ b/app/templates/runs/preparing.html @@ -1,3 +1,4 @@ +{% from 'runs/_live_board.html' import live_panel %} {% from 'runs/_execution.html' import execution_strip %} {% extends "base.html" %} {% from '_page.html' import page_head %} @@ -6,8 +7,15 @@ {% block head %}{% endblock %} {% block body %} {{ page_head(job_id) }} - {% if ex.plan.runner == 'harbor' %}

    Started from the builder. This page becomes the live board as soon as Harbor writes the job.

    - {% elif ex.plan.runner == 'standard' %}

    Started from the builder with Nullius. This page becomes the live board as soon as the install is done and the run starts.

    - {% else %}

    Started from the builder with the {{ ex.plan.runner }} runner. This page becomes the live board as soon as this arm's questions are chosen, after the install.

    {% endif %} +
    + + + +
    +
    {{ execution_strip(ex, csrf, waiting=true, own=own, deletable=deletable) }} +
    + + {% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/templates/traces/_head.html b/app/templates/traces/_head.html deleted file mode 100644 index e28ed44f..00000000 --- a/app/templates/traces/_head.html +++ /dev/null @@ -1,30 +0,0 @@ -{% from 'runs/_runtime.html' import what_ran %} -{# What ran, said the same on a trial's page and on its task's All attempts: where the task is from - and what ran it, then the agent, its mark (`mark`: base.html's agent_mark) and the model that - answered. An imported trial says its importer. - A block with nothing to say is not drawn. #} -{% macro ran_cards(job, trial, imported_from, mark) -%} - {# The trial records a bare model name ("gpt-5.6-luna"); the job keeps the - provider-qualified one ("openai/gpt-5.6-luna"). Prefer the fuller id. #} - {% set model = job.model_name if job.model_name and job.model_name.endswith(trial.model_name or '~') - else (trial.model_name or job.model_name) %} - {% set agent = trial.agent_info_name or job.agent_label %} - {% if imported_from %} -
    Imported from{{ imported_from }}
    - {% else %} -
    - {% if trial.source %}
    Benchmark{{ trial.source|dsname }}
    - {% endif %} -
    Runner{% if job.runner %}{{ what_ran(job) }}{% else %}Harbor{% endif %}
    -
    - {% endif %} - {% if agent or model %} -
    - {% if agent %}{% endif %} -
    - {% if agent %}{{ agent }}{% if trial.agent_version %} {{ trial.agent_version }}{% endif %}{% endif %} - {% if model %}{{ model }}{% endif %} -
    -
    - {% endif %} -{%- endmacro %} diff --git a/app/templates/traces/_usage.html b/app/templates/traces/_usage.html new file mode 100644 index 00000000..4dfb5419 --- /dev/null +++ b/app/templates/traces/_usage.html @@ -0,0 +1,65 @@ +{# One summary shape for every task. Trajectory accounting preserves cache conventions; + recorded trial totals remain available when no per-call trajectory was saved. #} +{% macro usage_panel(trial, trajectory) %} +{% set traj = trajectory if trajectory and not trajectory.error else none %} +{% set series = traj.token_series if traj else [] %} +{% set cache = traj.cache if traj else none %} +{% set sent = cache.total if cache else trial.n_input_tokens or 0 %} +{% set cached = cache.reads if cache else [trial.n_cache_tokens or 0, sent]|min %} +{% set fresh = cache.new if cache else [sent - cached, 0]|max %} +{% set output = (series|sum(attribute='completion')) if series else ((traj.final_metrics.get('total_completion_tokens') if traj else none) or trial.n_output_tokens or 0) %} +{% set reasoning = traj.total_reasoning_tokens if traj else none %} +
    +

    Model usage

    +

    Tokens

    + {% if sent or output or series or reasoning is not none %} + {% if sent or output %}{% endif %} +
    + {% if sent or output or series %} + input {{ fresh|tokens('control') }} + cache {{ cached|tokens('control') }} + output {{ output|tokens('control') }} + {% if sent %}cache hit {{ (cached / sent)|hitrate }}{% endif %} + {% endif %} + {% if reasoning is not none %}reasoning {{ reasoning|tokens('control') }}{% endif %} +
    + {% else %}

    Token usage not recorded.

    {% endif %} + {% if series|length > 1 %} +

    Prompt growth

    + {% set max_sent = traj.token_series|map(attribute='sent')|max %} +
    + {% for p in traj.token_series %} + {% set h = (56 * p.sent / max_sent)|round(1) if max_sent else 0 %} + {% set ch = (56 * p.cached / max_sent)|round(1) if max_sent else 0 %} + + + {% if ch >= 1 %}{% endif %} + + {% endfor %} +
    +
    + input + cache + {% if traj.cache and traj.cache.hit is not none %} + + cache hit {{ traj.cache.hit|hitrate }} + {% if traj.cache.reported_diverges %} + + reported {{ traj.cache.reported_hit|hitrate }} + {% endif %} + {% endif %} + {% if traj.total_reasoning_tokens is not none %} + reasoning {{ traj.total_reasoning_tokens|tokens('control') }} + {% endif %} +
    +

    One column per LLM step, height ∝ input tokens; the gray band is what came from cache. + {%- if traj.cache and traj.cache.convention == 'anthropic' %} Anthropic-style usage: cache writes are added back onto the step that paid for them.{%- endif %}

    + {% endif %} + +
    +{% endmacro %} diff --git a/app/templates/traces/attempts.html b/app/templates/traces/attempts.html index caadbefc..943dfdb1 100644 --- a/app/templates/traces/attempts.html +++ b/app/templates/traces/attempts.html @@ -1,16 +1,14 @@ {% extends "base.html" %} {% from '_page.html' import page_head %} {% from 'traces/_attempts.html' import attempt_tabs, attempt_count %} -{% from 'traces/_head.html' import ran_cards %} {% block title %}{{ trial.task_base }}, all attempts — Nullius{% endblock %} {% block crumb %}/
    {{ job.job_id }} / {{ trial.task_base }}{% endblock %} {% block body %} {% set workspace = request.args.get('workspace') %} -{# the head of an attempt's page (traces/trial.html): the name, what ran, then the tabs, so a tab +{# the head of an attempt's page (traces/trial.html): the name and the tabs, so a tab changes what is under it and nothing above #} {{ page_head(trial.task_base, mono=true) }} -
    {{ ran_cards(job, trial, imported_from, agent_mark) }}
    {{ attempt_count(attempts) }} {{ attempt_tabs(job, attempts, none, workspace) }} diff --git a/app/templates/traces/trial.html b/app/templates/traces/trial.html index 8dd4819b..6762b2e3 100644 --- a/app/templates/traces/trial.html +++ b/app/templates/traces/trial.html @@ -23,7 +23,6 @@ {% from 'traces/_judgement.html' import judgement_panel %} {% from 'traces/_attempts.html' import attempt_tabs, attempt_count, try_tabs %} -{% from 'traces/_head.html' import ran_cards %} {% from '_page.html' import page_head %} {% block body %} @@ -39,7 +38,7 @@ {{ page_head(trial.task_base, sub=sub, mono=true) }} {# an earlier try of an attempt: evidence only, never judged #} {% set replaced = trial.trial_name != attempt.trial_name %} -{# What ran (traces/_head.html, the same on All attempts), then how it went: the dataset's own +{# How this trial went: the dataset's own checks, the reward or the score, the agent's time and its steps. A value the trial does not have has no cell, and a block with no cell is not drawn. #} {% set vocab = trial.vocab %} @@ -53,7 +52,6 @@ {%- if traj and not traj.error %}
    Steps{{ traj.n_steps }}
    {% endif -%} {% endset %} {% if attempts or tries %} -
    {{ ran_cards(job, trial, imported_from, agent_mark) }}
    {% if attempts %}
    {{ attempt_count(attempts) }} @@ -62,11 +60,8 @@ {% endif %} {% if tries %}{{ try_tabs(job, tries, trial, request.args.get('workspace')) }}{% endif %} {% if cells|trim %}
    {{ cells }}
    {% endif %} -{% else %} -
    - {{ ran_cards(job, trial, imported_from, agent_mark) }} - {% if cells|trim %}
    {{ cells }}
    {% endif %} -
    +{% elif cells|trim %} +
    {{ cells }}
    {% endif %}
    + +{% if traj and traj.error %} +

    Trajectory unreadable

    {{ traj.error }}
    +{% elif traj %} {% if loc %}

    Against the gold patch

    diff --git a/app/tests/test_execution.py b/app/tests/test_execution.py index 88cea537..71ee84ad 100644 --- a/app/tests/test_execution.py +++ b/app/tests/test_execution.py @@ -874,7 +874,8 @@ def test_what_it_does_is_said_in_stages_its_own_and_the_cli_s(self): [("plan", None), ("connect", "start"), ("connect", "done"), ("uv", "cached"), ("app", "start"), ("app", "done")]) got = ex.summary()["stages"] self.assertEqual([(s["key"], s["state"]) for s in got["stages"]], - [("connect", "done"), ("uv", "cached"), ("app", "done"), ("image", "done"), ("install:reference", "cached"), ("units", "running")]) + [("connect", "done"), ("uv", "cached"), ("app", "done"), ("image", "done"), ("install:reference", "cached"), ("units", "done")]) + self.assertIsNone(got["current"]) self.assertEqual((got["units"]["n"], got["units"]["done"], got["units"]["passed"]), (2, 1, 1)) back = execution.Execution(self.plan, root=str(self.tmp / "runs"), run=self.answer, record=json.loads((self.tmp / "runs" / "std-shard-2of2" / "run.json").read_text())) diff --git a/app/tests/test_progress.py b/app/tests/test_progress.py index b4afaf6b..a7c33d12 100644 --- a/app/tests/test_progress.py +++ b/app/tests/test_progress.py @@ -145,12 +145,27 @@ def test_a_download_shows_its_bytes(self): got = progress.fold([ev("dataset", "start", 1.0), ev("dataset", "progress", bytes=5_000_000, total=9_000_000)]) self.assertEqual((got["stages"][0]["bytes"], got["stages"][0]["total"]), (5_000_000, 9_000_000)) + def test_restarting_a_stage_drops_the_previous_attempts_progress(self): + events = [ev("driver", "start", 1.0), + ev("driver", "progress", bytes=100, total=200, detail="old download"), + ev("driver", "failed", seconds=8), ev("driver", "start", 10.0)] + row = progress.fold(events)["stages"][0] + self.assertEqual((row["state"], row["t"]), ("running", 10.0)) + for field in ("seconds", "bytes", "total", "detail"): + self.assertNotIn(field, row) + row = progress.fold(events + [ev("driver", "done")])["stages"][0] + self.assertNotIn("seconds", row) + def test_a_refusal_ends_the_list_and_says_why(self): got = progress.fold([ev("plan", stages="image,install,units"), ev("image", "start"), ev("refused", detail="the container backend: no")]) self.assertEqual((got["ended"], got["detail"]), ("refused", "the container backend: no")) self.assertEqual([(s["stage"], s["state"]) for s in got["stages"]], [("image", "failed")]) self.assertEqual(progress.refusal([ev("refused", detail="why")]), "why") self.assertIsNone(progress.refusal([ev("done")])) + finished = progress.fold([ev("units", "start", n=2), ev("unit", "done", outcome="passed"), ev("done")]) + self.assertEqual(finished["stages"][0]["state"], "done") + self.assertIsNone(finished["current"]) + self.assertEqual((finished["units"]["done"], finished["units"]["n"]), (1, 2)) class StandardRun(unittest.TestCase): diff --git a/app/ui_tests/evidence/run-logs/model-usage-after.png b/app/ui_tests/evidence/run-logs/model-usage-after.png new file mode 100644 index 00000000..17ee3725 Binary files /dev/null and b/app/ui_tests/evidence/run-logs/model-usage-after.png differ diff --git a/app/ui_tests/evidence/run-logs/run-overview-after.png b/app/ui_tests/evidence/run-logs/run-overview-after.png new file mode 100644 index 00000000..6a5070d4 Binary files /dev/null and b/app/ui_tests/evidence/run-logs/run-overview-after.png differ diff --git a/app/ui_tests/evidence/run-logs/task-after.png b/app/ui_tests/evidence/run-logs/task-after.png new file mode 100644 index 00000000..a8498579 Binary files /dev/null and b/app/ui_tests/evidence/run-logs/task-after.png differ diff --git a/app/ui_tests/evidence/run-logs/task-before.png b/app/ui_tests/evidence/run-logs/task-before.png new file mode 100644 index 00000000..f81305b7 Binary files /dev/null and b/app/ui_tests/evidence/run-logs/task-before.png differ diff --git a/app/ui_tests/evidence/run-logs/task-header-after.png b/app/ui_tests/evidence/run-logs/task-header-after.png new file mode 100644 index 00000000..9411541b Binary files /dev/null and b/app/ui_tests/evidence/run-logs/task-header-after.png differ diff --git a/app/ui_tests/test_attempt_routes.py b/app/ui_tests/test_attempt_routes.py index af1c64d2..4039f38c 100644 --- a/app/ui_tests/test_attempt_routes.py +++ b/app/ui_tests/test_attempt_routes.py @@ -126,6 +126,7 @@ def test_a_task_attempted_once_has_no_attempt_tabs(self): def test_all_attempts_lists_each_attempt_once_with_its_link(self): html = self.get("/trial/repeat-run/auth-token__b/attempts") + self.assertNotIn('class="th-card"', html) self.assertEqual(tabs(html)[-1], ("/trial/repeat-run/auth-token__c/attempts", True)) rows = re.findall(r'Attempt (\d)', html) self.assertEqual(rows, [("/trial/repeat-run/auth-token__c", "1"), ("/trial/repeat-run/auth-token__a", "2"), @@ -209,8 +210,8 @@ def try_tabs(html): page = self.get(kept) self.assertEqual(try_tabs(page), [("rate_limited", first, False, "1"), ("resolved", kept, True, "2")]) self.assertIn('title="Attempt 2: Resolved on try 2" aria-current="page">Attempt 2', '
    ', '