fix: Review-Befunde beheben (Image-Bau, Absturzsicherung, Image-Name, Ausgabelimit)
All checks were successful
release / deb (push) Successful in 3m57s
release / arch (push) Successful in 5m19s

- App baut cb-python selbst: Containerfile eingebettet, Befehle image_status
  und build_image, Live-Ausgabe, Knopf in den Einstellungen. start_batch
  prüft vorher, ob die Images da sind.
- running-Flag wird per Wächter zurückgesetzt, auch nach einem Absturz.
- Ein Fehler in einem Lauf beendet nicht mehr den Batch: Lauf wird als
  sandbox_error gespeichert. endpoint_error und sandbox_error zählen nicht
  in die Bewertung und werden beim Fortsetzen wiederholt.
- Image-Name wird geprüft (kein führendes -, nur erlaubte Zeichen), Podman
  bekommt -- vor dem Image.
- Ausgabe von Befehlen wird auf 1 MiB je Strom begrenzt.
- Abbruch wird auch vor dem Aufwärmen geprüft.
- Fehlerklassen lesbar, Hinweis auf nicht gewertete Läufe.
65 Unit-Tests grün (6 ignorierte Integrationstests); echter Sandbox- und Image-Test grün.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 13:15:07 +01:00
parent bd5afd44c9
commit ea4fb724d4
13 changed files with 650 additions and 55 deletions

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { onMount, onDestroy } from "svelte";
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
import { api, groupLabel, type BatchEvent, type LoadReport, type ModelInfo, type TaskInfo } from "$lib/api";
import { api, errorLabel, groupLabel, type BatchEvent, type LoadReport, type ModelInfo, type TaskInfo } from "$lib/api";
let {
models,
@ -50,7 +50,7 @@
} else if (e.kind === "run_finished") {
const ok = e.class === "ok";
log.push({
text: `${ok ? "bestanden" : e.class}: ${label}, ${Math.round(e.score * 100)} %`,
text: `${errorLabel(e.class)}: ${label}, ${Math.round(e.score * 100)} %`,
cls: ok ? "ok" : "error",
});
current = "";

View File

@ -2,8 +2,10 @@
import { onMount, untrack } from "svelte";
import {
api,
errorLabel,
fmtDuration,
fmtPct,
isInfrastructure,
groupLabel,
pctColor,
type BatchInfo,
@ -146,6 +148,13 @@
</table>
</div>
{#if ranking.excluded_runs > 0}
<p class="muted">
{ranking.excluded_runs} Lauf/Läufe sind nicht gewertet, weil der Modell-Server oder die Umgebung ausfiel. Sie
fließen nicht in die Prozentwerte ein. Beim Fortsetzen eines Batches werden sie wiederholt.
</p>
{/if}
<details class="how">
<summary>So wird bewertet</summary>
<ul>
@ -222,7 +231,10 @@
<td>{r.model}</td>
<td>{r.task_id}</td>
<td class="num">{r.repeat_idx}</td>
<td class={r.error_class === "ok" ? "ok" : "error"}>{r.error_class === "ok" ? "bestanden" : r.error_class}</td>
<td class={r.error_class === "ok" ? "ok" : isInfrastructure(r.error_class) ? "muted" : "error"}>
{errorLabel(r.error_class)}
{#if isInfrastructure(r.error_class)}<span class="chip" title="Zählt nicht in die Bewertung">nicht gewertet</span>{/if}
</td>
<td class="num">{Math.round(r.score * 100)} %</td>
<td class="num">{r.steps}</td>
<td class="num">{fmtDuration(r.duration_ms)}</td>

View File

@ -1,5 +1,15 @@
<script lang="ts">
import { api, type ModelEntry, type ModelInfo, type ModelTest, type Paths, type RuntimeStatus } from "$lib/api";
import { onMount, onDestroy } from "svelte";
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
import {
api,
type ImageStatus,
type ModelEntry,
type ModelInfo,
type ModelTest,
type Paths,
type RuntimeStatus,
} from "$lib/api";
let {
models,
@ -76,6 +86,46 @@
function savedInfo(name: string): ModelInfo | undefined {
return models.find((m) => m.name === name);
}
// Container-Images: Zustand, Bauen auf Knopfdruck, Ausgabe live.
let images = $state<ImageStatus[]>([]);
let imagesError = $state("");
let building = $state<string | null>(null);
let buildLog = $state<string[]>([]);
let buildError = $state("");
let unlisten: UnlistenFn | null = null;
async function loadImages() {
try {
images = await api.imageStatus();
imagesError = "";
} catch (e) {
imagesError = String(e);
}
}
async function build(image: string) {
building = image;
buildLog = [];
buildError = "";
try {
await api.buildImage(image);
} catch (e) {
buildError = String(e);
} finally {
building = null;
await loadImages();
}
}
onMount(async () => {
loadImages();
unlisten = await listen<{ image: string; line: string }>("image-build", (ev) => {
buildLog.push(ev.payload.line);
if (buildLog.length > 300) buildLog.splice(0, buildLog.length - 300);
});
});
onDestroy(() => unlisten?.());
</script>
<section class="card">
@ -152,6 +202,39 @@
</div>
</section>
<section class="card">
<h2>Container-Images</h2>
<p class="muted">
Jede Aufgabe läuft in einem Container. Das Standard-Image <code>cb-python</code> baut die App selbst. Beim
ersten Mal lädt Podman dafür ein Basis-Image und braucht Netz und ein paar Minuten.
</p>
{#if imagesError}<p class="error">{imagesError}</p>{/if}
{#each images as img (img.image)}
<div class="image-row">
<code>{img.image}</code>
{#if img.error}
<span class="chip error" title={img.error}>Prüfung fehlgeschlagen</span>
{:else if img.available}
<span class="chip ok">vorhanden</span>
{:else}
<span class="chip error">fehlt</span>
{/if}
<span class="spacer"></span>
{#if img.buildable}
<button class="primary" disabled={building !== null || img.available} onclick={() => build(img.image)}>
{building === img.image ? "baut …" : "Image bauen"}
</button>
{:else if !img.available}
<span class="muted">Muss selbst bereitgestellt werden</span>
{/if}
</div>
{/each}
{#if buildError}<p class="error">{buildError}</p>{/if}
{#if buildLog.length > 0}
<pre class="buildlog">{buildLog.join("\n")}</pre>
{/if}
</section>
<section class="card">
<h2>System</h2>
<dl>
@ -216,6 +299,25 @@
.spacer {
flex: 1;
}
.image-row {
display: flex;
align-items: center;
gap: 0.7rem;
padding: 0.4rem 0;
border-bottom: 1px solid var(--border);
}
.buildlog {
max-height: 14rem;
overflow-y: auto;
white-space: pre-wrap;
overflow-wrap: anywhere;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.6rem;
margin: 0.8rem 0 0;
font-size: 0.8rem;
}
dl {
display: grid;
grid-template-columns: max-content 1fr;

View File

@ -18,6 +18,8 @@ export type ModelTest = { ok: boolean; duration_ms: number; message: string };
export type RuntimeStatus = { program: string; available: boolean; detail: string };
export type ImageStatus = { image: string; available: boolean; buildable: boolean; error: string | null };
export type BatchInfo = {
id: number;
created_at: string;
@ -72,6 +74,8 @@ export type Ranking = {
models: ModelRank[];
cells: MatrixCell[];
tasks: TaskColumn[];
/** Läufe, die wegen Server- oder Umgebungsfehlern nicht in die Bewertung eingehen. */
excluded_runs: number;
};
export type BatchEvent =
@ -85,6 +89,8 @@ export const api = {
paths: () => invoke<Paths>("get_paths"),
tasks: () => invoke<LoadReport>("load_tasks"),
runtime: () => invoke<RuntimeStatus>("runtime_status"),
imageStatus: () => invoke<ImageStatus[]>("image_status"),
buildImage: (image: string) => invoke<void>("build_image", { image }),
models: () => invoke<ModelInfo[]>("list_models"),
saveModels: (models: ModelEntry[]) => invoke<ModelInfo[]>("save_models", { models }),
testModel: (name: string) => invoke<ModelTest>("test_model", { name }),
@ -98,6 +104,28 @@ export const api = {
invoke<StepRow[]>("run_steps", { batchId, model: r.model, taskId: r.task_id, repeatIdx: r.repeat_idx }),
};
/** Lesbare Bezeichnung einer Fehlerklasse. */
export function errorLabel(cls: string): string {
const labels: Record<string, string> = {
ok: "bestanden",
check_failed: "Prüfung fehlgeschlagen",
max_steps: "Zu viele Schritte",
timeout: "Zeitlimit überschritten",
loop_detected: "Schleife erkannt",
invalid_tool_json: "Ungültiger Tool-Aufruf",
unknown_tool: "Unbekanntes Werkzeug",
bad_args: "Falsche Argumente",
endpoint_error: "Modell-Server nicht erreichbar",
sandbox_error: "Fehler der Umgebung",
};
return labels[cls] ?? cls;
}
/** Läufe, die nicht am Modell scheiterten und deshalb nicht zählen. */
export function isInfrastructure(cls: string): boolean {
return cls === "endpoint_error" || cls === "sandbox_error";
}
/** Namen der Bereiche (Gruppen aus SPEC 11). */
export const GROUP_LABELS: Record<string, string> = {
A: "Tool-Calling",