Enforce runtime report contracts and recoverable session exports

This commit is contained in:
2026-10-20 16:02:38 +01:00
parent 1d9cb80cdb
commit fdf0369ede
36 changed files with 1636 additions and 177 deletions
+2 -1
View File
@@ -185,7 +185,7 @@ export class PipelinesRepository {
* Starts a fresh run of one pipeline version. `notifyMode` is auto, on or off;
* auto omits the field so the pipeline definition applies.
*/
async runPipeline({ pipelineId, version, prompt, workspace, notifyMode = "auto", title = "", requestKey = newChatOperationId() } = {}) {
async runPipeline({ pipelineId, version, prompt, workspace, notifyMode = "auto", title = "", outputFormat = "", requestKey = newChatOperationId() } = {}) {
const request = {
type: Protocol.RUN_PIPELINE,
pipeline_id: Number(pipelineId),
@@ -195,6 +195,7 @@ export class PipelinesRepository {
input: { prompt: String(prompt ?? "") },
};
if (String(title ?? "").trim() !== "") request.title = String(title).trim();
if (outputFormat) request.output_format = outputFormat;
const mode = String(notifyMode ?? "auto").trim().toLowerCase();
if (mode === "on" || mode === "off") request.notify_mode = mode;
const response = await this.#client.call(request);
+14
View File
@@ -388,6 +388,7 @@ async function openRunDialog(pipeline) {
prompt: "",
workspace: String(state.workspace ?? "").startsWith("/") ? state.workspace : "",
notifyMode: "auto",
outputFormat: "",
directories: [],
loading: true,
sending: false,
@@ -445,6 +446,7 @@ async function startRun() {
prompt,
workspace: start.workspace,
notifyMode: start.notifyMode,
outputFormat: start.outputFormat,
title: "",
});
}
@@ -545,6 +547,18 @@ function renderRunStartDialog() {
notifyField.append(notify);
panel.append(notifyField);
const outputField = h("label", { class: "run-start-field", for: "runOutputFormat" });
outputField.append(h("span", { class: "run-start-label", text: "Report format" }));
const outputFormat = h("select", { id: "runOutputFormat", onchange: (event) => { start.outputFormat = event.target.value; } });
for (const [value, label] of [["", "No report requirement"], ["html", "HTML report"], ["markdown", "Markdown report"]]) {
const option = h("option", { value, text: label });
option.selected = start.outputFormat === value;
outputFormat.append(option);
}
outputField.append(outputFormat);
outputField.append(h("span", { class: "run-start-helper muted", text: "Requires a nonempty server-written report before success. Structure only; facts are not verified." }));
panel.append(outputField);
if (start.loading) panel.append(h("div", { class: "run-start-helper muted", text: "Loading directories…" }));
if (start.error) panel.append(h("div", { class: "run-start-error", role: "alert", text: start.error }));
+14 -1
View File
@@ -1294,8 +1294,21 @@ function artifactAction(kind, label, disabled, onclick) {
function renderSessionExport(step) {
const file = sessionExportArtifact(step);
const wrap = h("div", { class: "session-export" });
for (const repair of step?.session_export_repairs || []) {
const row = h("div", { class: "session-export-repair" });
row.append(h("span", { text: `Repair: ${repair.status || "partial"} · ${repair.messages || 0} messages. ${repair.diagnostic || ""}` }));
const repaired = sessionExportArtifact({ ...step, session_export: repair });
const repairedHref = repaired && resolvedArtifactUrl(repaired, state.url);
if (repairedHref) row.append(h("a", { href: repairedHref, target: "_blank", rel: "noreferrer", text: "Open repaired export" }));
wrap.append(row);
}
const evidence = step?.session_export;
const incomplete = evidence && (evidence.status && evidence.status !== "complete" || !evidence.messages || evidence.truncated || evidence.diagnostic);
if (incomplete) {
wrap.append(h("span", { class: "muted", text: `Session recorded, but export ${evidence.status || (!evidence.messages ? "empty" : "partial")}. Full session evidence was not captured.${evidence.diagnostic ? ` ${evidence.diagnostic}` : ""}` }));
}
if (!file) {
wrap.append(h("span", { class: "muted", text: "No session was exported for this visit." }));
if (!incomplete) wrap.append(h("span", { class: "muted", text: step?.session_id ? "Session recorded, but export failed or was not captured." : "No session was exported for this visit." }));
return wrap;
}
const href = resolvedArtifactUrl(file, state.url);