Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

feat: plain reasons for every delivery code

ogsamrata71521c18794
diff --git a/apps/app/src/app/lib/good-session-integrity.ts b/apps/app/src/app/lib/good-session-integrity.ts
index 1ffc2072..2aa52c7d 100644
--- a/apps/app/src/app/lib/good-session-integrity.ts
+++ b/apps/app/src/app/lib/good-session-integrity.ts
@@ -22,6 +22,18 @@ const UPLOAD_REASONS: Readonly<Record<string, string>> = Object.freeze({
sequence_gaps: "parts of the session are missing",
segment_start_missing: "parts of the session are missing",
no_trace: "parts of the session are missing",
+ end_missing: "the end of the session never arrived",
+ archive_missing: "no starting copy of the project was uploaded",
+});
+
+/** The delivery's own codes (the status block's `delivery.reasons`): their reason and fix (the CLI's VERDICT_REASONS, word for word). */
+const DELIVERY_REASONS: Readonly<Record<string, { reason: string; fix: string }>> = Object.freeze({
+ qc_reject: { reason: QUALITY_FALLBACK, fix: FIX_QUALITY },
+ filter_hit: { reason: "a turn did not pass the content checks", fix: FIX_QUALITY },
+ truncated: { reason: "the last turn was cut off", fix: "Let the last turn finish." },
+ one_turn: { reason: "it had only one turn", fix: "Ask a follow-up: test, refine or extend the work." },
+ os: { reason: "sessions from this system are not being delivered right now", fix: "Nothing to fix on your side." },
+ pending_qc: { reason: "the quality check has not run yet", fix: "It is checked soon." },
});
export type GoodSessionCopy =
@@ -33,6 +45,8 @@ export type GoodSessionCopy =
function reasonCopy(code: string | undefined, messages: Readonly<Record<string, string>> | undefined): { reason: string; fix: string } {
const upload = code ? UPLOAD_REASONS[code] : undefined;
if (upload) return { reason: upload, fix: FIX_UPLOADS };
+ const delivery = code ? DELIVERY_REASONS[code] : undefined;
+ if (delivery) return delivery;
// The server's sentence, without its own full stop (the line adds one).
const human = code ? messages?.[code]?.trim().replace(/[.\s]+$/, "") : undefined;
return { reason: human || QUALITY_FALLBACK, fix: FIX_QUALITY };
diff --git a/apps/app/src/app/lib/good-session.ts b/apps/app/src/app/lib/good-session.ts
index 7cf7396c..1e740aac 100644
--- a/apps/app/src/app/lib/good-session.ts
+++ b/apps/app/src/app/lib/good-session.ts
@@ -940,6 +940,12 @@ export const DELIVERY_REASON_TEXT: Readonly<Record<string, string>> = Object.fre
windows: "sessions from this system are not being delivered right now",
qc_reject: "it did not pass the quality check",
pending_qc: "the quality check has not run yet",
+ archive_no_base: "the project copy is incomplete",
+ archive_gap: "the project copy is incomplete",
+ archive_failed: "the project copy is incomplete",
+ segment_start_missing: "parts of the session are missing",
+ no_trace: "parts of the session are missing",
+ trace_failed: "the session record failed to save",
});
/** "Not delivered: <reason>; <reason>", or null when delivered, pending or unexplained. */
@@ -949,7 +955,9 @@ export function deliveryLine(status: OmniRushSessionStatus | null | undefined):
const reasons = delivery.reasons
.map((reason) => reason.message ?? DELIVERY_REASON_TEXT[reason.code] ?? (reason.code ? reason.code.replace(/_/g, " ") : null))
.filter((reason): reason is string => Boolean(reason));
- return reasons.length ? `Not delivered: ${reasons.join("; ")}` : null;
+ // The server's own sentence when it sends one, else each reason in plain words.
+ const text = delivery.message ?? (reasons.length ? reasons.join("; ") : null);
+ return text ? `Not delivered: ${text}` : null;
}
/**
diff --git a/apps/app/tests/good-session-integrity.test.tsx b/apps/app/tests/good-session-integrity.test.tsx
index a858ffda..a9a7fa67 100644
--- a/apps/app/tests/good-session-integrity.test.tsx
+++ b/apps/app/tests/good-session-integrity.test.tsx
@@ -108,3 +108,15 @@ describe("nextGoodSessionCheckMs", () => {
expect(nextGoodSessionCheckMs({ result: null, pendingChecks: 1, lastTurnEndedAt: ended, now: ended + 3 * GOOD_SESSION_RETRY_WINDOW_MS })).toBeNull();
});
});
+
+describe("the delivery's codes", () => {
+ test("each with its own reason and fix (the CLI's verdict line, word for word)", () => {
+ const line = (code: string) => goodSessionCopy(result({ good_session: false, good_session_reasons: [code] })).text;
+ expect(line("one_turn")).toBe("Not a good session: it had only one turn. Ask a follow-up: test, refine or extend the work.");
+ expect(line("end_missing")).toBe("Not a good session: the end of the session never arrived. Keep the app open until uploads finish.");
+ expect(line("archive_missing")).toBe("Not a good session: no starting copy of the project was uploaded. Keep the app open until uploads finish.");
+ expect(line("truncated")).toBe("Not a good session: the last turn was cut off. Let the last turn finish.");
+ expect(line("os")).toBe("Not a good session: sessions from this system are not being delivered right now. Nothing to fix on your side.");
+ expect(line("qc_reject")).toBe("Not a good session: it didn't pass the quality check. Give the agent a real task and see it through.");
+ });
+});
diff --git a/apps/app/tests/good-session.test.tsx b/apps/app/tests/good-session.test.tsx
index b55b0e9d..2eec47f5 100644
--- a/apps/app/tests/good-session.test.tsx
+++ b/apps/app/tests/good-session.test.tsx
@@ -709,6 +709,8 @@ describe("why not delivered", () => {
expect(deliveryLine(serverStatus({ delivery: { state: "delivered", reasons: [] } }))).toBeNull();
expect(deliveryLine(serverStatus({ delivery: { state: "pending", reasons: [{ code: "pending_qc", message: null }] } }))).toBeNull();
expect(deliveryLine(serverStatus())).toBeNull();
+ expect(deliveryLine(serverStatus({ delivery: { state: "not_delivered", message: "Kept back: the end never arrived.", reasons: [{ code: "end_missing", message: null }] } }))).toBe("Not delivered: Kept back: the end never arrived.");
+ expect(deliveryLine(serverStatus({ delivery: { state: "not_delivered", reasons: [{ code: "archive_gap", message: null }] } }))).toBe("Not delivered: the project copy is incomplete");
});
});
diff --git a/apps/desktop/electron/quality.mjs b/apps/desktop/electron/quality.mjs
index 43cc6159..784ca37b 100644
--- a/apps/desktop/electron/quality.mjs
+++ b/apps/desktop/electron/quality.mjs
@@ -354,10 +354,11 @@ export function parseDelivery(value, verdict) {
return {
state: oneOf(value.state, DELIVERY_STATES, "pending"),
reasons: Array.isArray(value.reasons) ? value.reasons.map(deliveryReason).filter((reason) => reason !== null) : [],
+ message: text(value.message),
};
}
if (verdict?.state === "not_usable" && verdict.reasons.length) {
- return { state: "not_delivered", reasons: verdict.reasons.map((code) => ({ code, message: null })) };
+ return { state: "not_delivered", reasons: verdict.reasons.map((code) => ({ code, message: null })), message: null };
}
return null;
}
diff --git a/apps/desktop/electron/quality.test.mjs b/apps/desktop/electron/quality.test.mjs
index e4b3b50a..93c8872b 100644
--- a/apps/desktop/electron/quality.test.mjs
+++ b/apps/desktop/electron/quality.test.mjs
@@ -366,9 +366,10 @@ test("session status: GET /me/sessions/{id}/status with the device credential; n
test("session status: the delivery block, or a not_usable verdict's reasons on older servers", () => {
const status = parseSessionStatus({ ...SESSION_STATUS, delivery: { state: "not_delivered", reasons: [{ code: "end_missing" }, { code: "one_turn", message: "Only one turn." }, "brand_new"] } });
- assert.deepEqual(status.delivery, { state: "not_delivered", reasons: [{ code: "end_missing", message: null }, { code: "one_turn", message: "Only one turn." }, { code: "brand_new", message: null }] });
- assert.deepEqual(parseSessionStatus({ ...SESSION_STATUS, delivery: { state: "odd" } }).delivery, { state: "pending", reasons: [] });
+ assert.deepEqual(status.delivery, { state: "not_delivered", reasons: [{ code: "end_missing", message: null }, { code: "one_turn", message: "Only one turn." }, { code: "brand_new", message: null }], message: null });
+ assert.deepEqual(parseSessionStatus({ ...SESSION_STATUS, delivery: { state: "odd" } }).delivery, { state: "pending", reasons: [], message: null });
+ assert.equal(parseSessionStatus({ ...SESSION_STATUS, delivery: { state: "not_delivered", reasons: [], message: "Kept back.", reward_basis: "x" } }).delivery.message, "Kept back.");
const older = parseSessionStatus({ ...SESSION_STATUS, verdict: { state: "not_usable", reasons: ["archive_missing"], reward_weight: 0 } });
- assert.deepEqual(older.delivery, { state: "not_delivered", reasons: [{ code: "archive_missing", message: null }] });
+ assert.deepEqual(older.delivery, { state: "not_delivered", reasons: [{ code: "archive_missing", message: null }], message: null });
assert.equal(parseSessionStatus({ ...SESSION_STATUS, verdict: { state: "usable", reasons: [] } }).delivery, null);
});
diff --git a/packages/types/src/desktop-ipc.ts b/packages/types/src/desktop-ipc.ts
index 3de8c46f..f87f56a0 100644
--- a/packages/types/src/desktop-ipc.ts
+++ b/packages/types/src/desktop-ipc.ts
@@ -308,7 +308,7 @@ export type OmniRushSessionStatus = {
* servers without it, read from a not_usable verdict's reasons). A reason
* without the server's message has `message: null` (the app words it).
*/
- delivery?: { state: "delivered" | "not_delivered" | "pending"; reasons: { code: string; message: string | null }[] } | null;
+ delivery?: { state: "delivered" | "not_delivered" | "pending"; reasons: { code: string; message: string | null }[]; message?: string | null } | null;
/** In order; ids may grow. */
checklist: { id: string; state: "pass" | "fail" | "warn" | "pending"; label: string; hint: string }[];
evaluatedAt: string | null;