Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(ultrawiki): put a measured duration on the backlog it reports

Ruben Lütkeb302b0489420
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/overview/OverviewTab.test.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/overview/OverviewTab.test.tsx
index ac61826e3f..bd311d3d24 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/overview/OverviewTab.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/overview/OverviewTab.test.tsx
@@ -24,6 +24,7 @@ import type {
UltraWikiPipeline,
UltraWikiProgress,
UltraWikiSource,
+ UltraWikiThroughput,
} from "@/lib/ultrawikiApi";
/** The exact live state from the 2026-07-26 screenshot. */
@@ -44,6 +45,46 @@ const SCREENSHOT: UltraWikiProgress = {
],
};
+/**
+ * The 2026-07-27 state: a corpus fifty times bigger, moving at 0.65 items a
+ * second, under a headline that said "you do not have to wait".
+ */
+const HUGE_BACKLOG: UltraWikiProgress = {
+ state: "working",
+ total: 236_131,
+ searchable: 137_625,
+ summarised: 216,
+ waiting: 235_915,
+ failed: 0,
+ next_step: "embedding",
+ waiting_by_bucket: { captured: 98_506, keyword_indexed: 133_657, embedded: 3_752 },
+ buckets: {
+ captured: 98_506,
+ keyword_indexed: 133_657,
+ embedded: 3_752,
+ distilled: 216,
+ failed: 0,
+ },
+ milestones: [
+ { id: "stored", reached: 236_131, share: 1 },
+ { id: "searchable", reached: 137_625, share: 0.583 },
+ { id: "summarised", reached: 216, share: 0.0009 },
+ ],
+};
+
+/** The measured lane behind that backlog: ~2 340 items an hour, ~4 days left. */
+const MEASURED: UltraWikiThroughput = {
+ embed: {
+ rate_per_hour: 2340,
+ backlog: 232_163,
+ eta_seconds: 232_163 / 0.65,
+ measured_s: 900,
+ measured_items: 585,
+ stalled: false,
+ paused_reason: "",
+ },
+};
+
const PROCESSING: UltraWikiPipeline = {
running: true,
state: "processing",
@@ -134,6 +175,84 @@ describe("VerdictCard — the sentence that used to be wrong", () => {
});
});
+describe("VerdictCard — how long the backlog takes", () => {
+ it("states the measured duration instead of dismissing the wait", () => {
+ // The defect verbatim: 235 915 queued items described as something you
+ // do not have to wait for, over a queue measuring four days.
+ renderWithQuery(
+ <VerdictCard
+ progress={HUGE_BACKLOG}
+ pipeline={PROCESSING}
+ usable
+ throughput={MEASURED}
+ />,
+ );
+ const detail = screen.getByTestId("ultrawiki-verdict-detail").textContent ?? "";
+ expect(detail).toContain("days");
+ expect(detail.toLowerCase()).not.toContain("you do not have to wait");
+ });
+
+ it("says it is measuring rather than inventing a number", () => {
+ renderWithQuery(
+ <VerdictCard progress={HUGE_BACKLOG} pipeline={PROCESSING} usable />,
+ );
+ const detail = screen.getByTestId("ultrawiki-verdict-detail").textContent ?? "";
+ expect(detail).toContain("still being measured");
+ expect(detail).not.toContain("days");
+ });
+
+ it("reports a standing queue as standing, with no completion time", () => {
+ // "Never at this rate" is not a duration; rendering one implies progress.
+ renderWithQuery(
+ <VerdictCard
+ progress={HUGE_BACKLOG}
+ pipeline={PROCESSING}
+ usable
+ throughput={{
+ embed: {
+ rate_per_hour: 0,
+ backlog: 232_163,
+ eta_seconds: null,
+ measured_s: 900,
+ measured_items: 0,
+ stalled: true,
+ paused_reason: "",
+ },
+ }}
+ />,
+ );
+ const detail = screen.getByTestId("ultrawiki-verdict-detail").textContent ?? "";
+ expect(detail).toContain("standing still");
+ expect(detail).not.toContain("days");
+ });
+
+ it("explains a summary lane that is parked on purpose", () => {
+ // 216 summaries frozen for hours with no reason anywhere on screen.
+ renderWithQuery(
+ <VerdictCard
+ progress={HUGE_BACKLOG}
+ pipeline={PROCESSING}
+ usable
+ throughput={{
+ ...MEASURED,
+ distill: {
+ rate_per_hour: null,
+ backlog: 235_915,
+ eta_seconds: null,
+ measured_s: 900,
+ measured_items: 0,
+ stalled: false,
+ paused_reason: "summaries are paused while the search index is rebuilt",
+ },
+ }}
+ />,
+ );
+ expect(
+ screen.getByTestId("ultrawiki-verdict-summary-pause").textContent,
+ ).toContain("rebuilt");
+ });
+});
+
describe("IntakeBar — the corpus at true scale", () => {
it("splits the corpus into disjoint bands that add back up to it", () => {
const bands = bandsOf(SCREENSHOT);
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/overview/OverviewTab.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/overview/OverviewTab.tsx
index ad2ff7731b..3cb6a65944 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/overview/OverviewTab.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/overview/OverviewTab.tsx
@@ -80,6 +80,7 @@ export function OverviewTab({
pipeline={status.pipeline}
usable={health?.usable ?? false}
started={status.started}
+ throughput={status.throughput}
/>
<SourceRoster
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/overview/VerdictCard.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/overview/VerdictCard.tsx
index 76a646693d..5830bb3b48 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/overview/VerdictCard.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/overview/VerdictCard.tsx
@@ -8,14 +8,27 @@
* the corpus is still unfinished, and whether that stops you using the rest.
*
* Every word here is composed from the shared progress numbers through i18n
- * keys — this component never adds up buckets and never invents an estimate
- * for when the backlog will clear.
+ * keys — this component never adds up buckets.
+ *
+ * It also never INVENTS an estimate, which is not the same as never showing
+ * one. It used to close with "you do not have to wait" over a backlog of
+ * 235 915 items that measured four days (2026-07-27), because the payload
+ * carried no notion of speed and the sentence was written for a queue of
+ * minutes. The backend now measures its own completed transitions
+ * (jarvis/ultrawiki/throughput.py), so the duration shown here is observed,
+ * never modelled — and when it has not been observed long enough, the card
+ * says it is still measuring rather than guessing.
*/
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import { Eyebrow, Num, formatCount } from "@/components/ultrawiki/overview/primitives";
import { IntakeBar } from "@/components/ultrawiki/overview/IntakeBar";
-import type { UltraWikiPipeline, UltraWikiProgress } from "@/lib/ultrawikiApi";
+import { paceOf } from "@/lib/ultrawikiEta";
+import type {
+ UltraWikiPipeline,
+ UltraWikiProgress,
+ UltraWikiThroughput,
+} from "@/lib/ultrawikiApi";
type Tone = "done" | "working" | "stalled" | "notready" | "empty" | "starting";
@@ -62,12 +75,16 @@ export function VerdictCard({
pipeline,
usable,
started = true,
+ throughput,
}: {
progress: UltraWikiProgress;
pipeline: UltraWikiPipeline;
usable: boolean;
/** Is the knowledge store actually open? A closed store reports zeros. */
started?: boolean;
+ /** Measured lane rates. Absent on an older backend — the card degrades to
+ * its un-timed wording rather than showing a zero it did not measure. */
+ throughput?: UltraWikiThroughput;
}): JSX.Element {
const t = useT();
const pipelineState = String(pipeline.state ?? "");
@@ -77,6 +94,12 @@ export function VerdictCard({
const step = t(
`ultrawiki.overview.step_${progress.next_step ?? "processing"}`,
);
+ // The embedding lane paces the whole corpus: nothing gets summarised before
+ // it is embedded, so its duration is the one the headline detail quotes.
+ const pace = paceOf(throughput?.embed, t);
+ // A parked summary lane is worth its own line — it is the reason the
+ // "summarised" band stops growing while every other number climbs.
+ const summaryPause = throughput?.distill?.paused_reason ?? "";
// One line per situation, spelled out rather than nested into a ternary
// chain — these sentences are the point of the screen and have to stay easy
// to read in the source too.
@@ -93,15 +116,26 @@ export function VerdictCard({
formatCount(progress.total),
);
break;
- default:
- detail = t(
+ default: {
+ // Four wordings for four genuinely different situations. Picking the
+ // measured one only when there IS a measurement is what keeps this
+ // honest: an un-timed backlog says so, rather than borrowing the
+ // confidence of a number nobody took.
+ const key =
tone === "stalled"
? "ultrawiki.overview.detail_stalled"
- : "ultrawiki.overview.detail_working",
- )
+ : pace.kind === "moving"
+ ? "ultrawiki.overview.detail_working_eta"
+ : pace.kind === "stalled"
+ ? "ultrawiki.overview.detail_working_stalled"
+ : "ultrawiki.overview.detail_working";
+ detail = t(key)
.replace("{0}", formatCount(progress.waiting))
.replace("{1}", formatCount(progress.total))
- .replace("{2}", step);
+ .replace("{2}", step)
+ .replace("{3}", pace.eta)
+ .replace("{4}", pace.perHour === null ? "" : formatCount(pace.perHour));
+ }
}
return (
@@ -155,6 +189,19 @@ export function VerdictCard({
</p>
)}
+ {/* The summarising lane, when it is deliberately parked. Without this
+ the "summarised" band simply stops growing while every other number
+ climbs, and a correctly paused stage is indistinguishable from a
+ broken one. The backend's own sentence, verbatim. */}
+ {summaryPause && (
+ <p
+ className="mt-1.5 text-xs leading-relaxed text-muted-foreground"
+ data-testid="ultrawiki-verdict-summary-pause"
+ >
+ {t("ultrawiki.overview.pace_paused").replace("{0}", summaryPause)}
+ </p>
+ )}
+
{/* No bar while the store is closed: its numbers would be zeros the
backend never measured. */}
{started && progress.total > 0 && (
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 23dff13aa4..7415211882 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -2717,22 +2717,131 @@
"result_error": "Discord nicht erreichbar, bitte später erneut versuchen."
},
"ultrawiki": {
- "explore": {
- "vault": {
- "title": "Obsidian-Vault",
- "hint": "Dieselben Inhalte als Markdown-Dateien auf der Festplatte.",
- "export": "Exportieren",
- "exporting": "Wird geschrieben …",
- "exported": "{0} Notizen geschrieben, {1} unverändert.",
- "notes": "{0} Notizen",
- "never": "Noch nie exportiert",
- "last": "Zuletzt am {0}",
- "register": "Bei Obsidian anmelden",
- "registering": "Wird angemeldet …",
- "registered": "In Obsidian eingetragen",
- "not_installed": "Obsidian ist auf diesem Gerät nicht installiert. Die Dateien liegen trotzdem bereit — du kannst sie mit jedem Markdown-Programm öffnen.",
- "error": "Hat nicht geklappt: {0}"
+ "explore": {
+ "vault": {
+ "title": "Obsidian-Vault",
+ "hint": "Dieselben Inhalte als Markdown-Dateien auf der Festplatte.",
+ "export": "Exportieren",
+ "exporting": "Wird geschrieben …",
+ "exported": "{0} Notizen geschrieben, {1} unverändert.",
+ "notes": "{0} Notizen",
+ "never": "Noch nie exportiert",
+ "last": "Zuletzt am {0}",
+ "register": "Bei Obsidian anmelden",
+ "registering": "Wird angemeldet …",
+ "registered": "In Obsidian eingetragen",
+ "not_installed": "Obsidian ist auf diesem Gerät nicht installiert. Die Dateien liegen trotzdem bereit — du kannst sie mit jedem Markdown-Programm öffnen.",
+ "error": "Hat nicht geklappt: {0}"
+ },
+ "vault": {
+ "title": "Obsidian-Vault",
+ "hint": "Dieselben Inhalte als Markdown-Dateien auf der Festplatte.",
+ "export": "Exportieren",
+ "exporting": "Wird geschrieben …",
+ "exported": "{0} Notizen geschrieben, {1} unverändert.",
+ "notes": "{0} Notizen",
+ "never": "Noch nie exportiert",
+ "last": "Zuletzt am {0}",
+ "register": "Bei Obsidian anmelden",
+ "registering": "Wird angemeldet …",
+ "registered": "In Obsidian eingetragen",
+ "not_installed": "Obsidian ist auf diesem Gerät nicht installiert. Die Dateien liegen trotzdem bereit — du kannst sie mit jedem Markdown-Programm öffnen.",
+ "error": "Hat nicht geklappt: {0}"
+ },
+ "tab": "Entdecken",
+ "loading": "Wissensbestand wird gelesen …",
+ "error": "Der Wissensbestand konnte nicht gelesen werden.",
+ "entities_title": "Begriffe",
+ "entities_count": "{0} Begriffe",
+ "moments_title": "Momente",
+ "moments_count": "{0} Momente",
+ "graph_title": "Verbindungen",
+ "search_placeholder": "Begriff suchen …",
+ "no_search_hits": "Kein Begriff passt zu „{0}“.",
+ "mentions": "{0}×",
+ "mentions_long": "{0} Erwähnungen",
+ "period": "{0} bis {1}",
+ "neighbors": "Taucht auf mit",
+ "no_neighbors": "Kommt bisher immer allein vor.",
+ "shared": "{0} gemeinsame Momente",
+ "back": "Zurück zur Übersicht",
+ "open_source": "Beleg öffnen",
+ "source_prefix": "aus",
+ "min_mentions": "Ab {0} Erwähnungen",
+ "graph_shown": "{0} von {1} Begriffen",
+ "graph_hint": "Weniger häufige Begriffe sind ausgeblendet — Regler nach links für alle.",
+ "graph_empty": "Kein Begriff wird oft genug erwähnt. Stell den Regler auf 1.",
+ "moments_of": "Momente mit {0}",
+ "empty": {
+ "no_sources": "Es ist noch keine Quelle verbunden. Verbinde zuerst eine Quelle, dann kann Jarvis etwas wissen.",
+ "nothing_imported": "Eine Quelle ist verbunden, aber es wurde noch nichts geholt. Starte den Import bei den Quellen.",
+ "nothing_distilled": "Es liegen Einträge da, aber noch keiner wurde ausgewertet. Dafür braucht es ein eingerichtetes Sprachmodell in den Einstellungen.",
+ "no_entities": "Die Einträge wurden ausgewertet, aber es kamen keine Namen oder Orte darin vor. Die Momente unten kannst du trotzdem durchblättern."
+ }
+ },
+ "explore": {
+ "vault": {
+ "title": "Obsidian-Vault",
+ "hint": "Dieselben Inhalte als Markdown-Dateien auf der Festplatte.",
+ "export": "Exportieren",
+ "exporting": "Wird geschrieben …",
+ "exported": "{0} Notizen geschrieben, {1} unverändert.",
+ "notes": "{0} Notizen",
+ "never": "Noch nie exportiert",
+ "last": "Zuletzt am {0}",
+ "register": "Bei Obsidian anmelden",
+ "registering": "Wird angemeldet …",
+ "registered": "In Obsidian eingetragen",
+ "not_installed": "Obsidian ist auf diesem Gerät nicht installiert. Die Dateien liegen trotzdem bereit — du kannst sie mit jedem Markdown-Programm öffnen.",
+ "error": "Hat nicht geklappt: {0}"
+ },
+ "tab": "Entdecken",
+ "loading": "Wissensbestand wird gelesen …",
+ "error": "Der Wissensbestand konnte nicht gelesen werden.",
+ "entities_title": "Begriffe",
+ "entities_count": "{0} Begriffe",
+ "moments_title": "Momente",
+ "moments_count": "{0} Momente",
+ "graph_title": "Verbindungen",
+ "search_placeholder": "Begriff suchen …",
+ "no_search_hits": "Kein Begriff passt zu „{0}“.",
+ "mentions": "{0}×",
+ "mentions_long": "{0} Erwähnungen",
+ "period": "{0} bis {1}",
+ "neighbors": "Taucht auf mit",
+ "no_neighbors": "Kommt bisher immer allein vor.",
+ "shared": "{0} gemeinsame Momente",
+ "back": "Zurück zur Übersicht",
+ "open_source": "Beleg öffnen",
+ "source_prefix": "aus",
+ "min_mentions": "Ab {0} Erwähnungen",
+ "graph_shown": "{0} von {1} Begriffen",
+ "graph_hint": "Weniger häufige Begriffe sind ausgeblendet — Regler nach links für alle.",
+ "graph_empty": "Kein Begriff wird oft genug erwähnt. Stell den Regler auf 1.",
+ "moments_of": "Momente mit {0}",
+ "empty": {
+ "no_sources": "Es ist noch keine Quelle verbunden. Verbinde zuerst eine Quelle, dann kann Jarvis etwas wissen.",
+ "nothing_imported": "Eine Quelle ist verbunden, aber es wurde noch nichts geholt. Starte den Import bei den Quellen.",
+ "nothing_distilled": "Es liegen Einträge da, aber noch keiner wurde ausgewertet. Dafür braucht es ein eingerichtetes Sprachmodell in den Einstellungen.",
+ "no_entities": "Die Einträge wurden ausgewertet, aber es kamen keine Namen oder Orte darin vor. Die Momente unten kannst du trotzdem durchblättern."
+ }
},
+ "explore": {
+ "vault": {
+ "title": "Obsidian-Vault",
+ "hint": "Dieselben Inhalte als Markdown-Dateien auf der Festplatte.",
+ "export": "Exportieren",
+ "exporting": "Wird geschrieben …",
+ "exported": "{0} Notizen geschrieben, {1} unverändert.",
+ "notes": "{0} Notizen",
+ "never": "Noch nie exportiert",
+ "last": "Zuletzt am {0}",
+ "register": "Bei Obsidian anmelden",
+ "registering": "Wird angemeldet …",
+ "registered": "In Obsidian eingetragen",
+ "not_installed": "Obsidian ist auf diesem Gerät nicht installiert. Die Dateien liegen trotzdem bereit — du kannst sie mit jedem Markdown-Programm öffnen.",
+ "error": "Hat nicht geklappt: {0}"
+ },
"tab": "Entdecken",
"loading": "Wissensbestand wird gelesen …",
"error": "Der Wissensbestand konnte nicht gelesen werden.",
@@ -2755,13 +2864,7 @@
"min_mentions": "Ab {0} Erwähnungen",
"graph_shown": "{0} von {1} Begriffen",
"graph_hint": "Weniger häufige Begriffe sind ausgeblendet — Regler nach links für alle.",
- "graph_hint_short": "Zeigen ab",
"graph_empty": "Kein Begriff wird oft genug erwähnt. Stell den Regler auf 1.",
- "legend_size": "Größer = häufiger erwähnt",
- "legend_recency": "Länger her → gerade eben",
- "reader_hint": "Begriff wählen, um nur dessen Momente zu lesen",
- "read_more": "Ganzen Moment lesen",
- "read_less": "Moment zuklappen",
"moments_of": "Momente mit {0}",
"empty": {
"no_sources": "Es ist noch keine Quelle verbunden. Verbinde zuerst eine Quelle, dann kann Jarvis etwas wissen.",
@@ -3157,6 +3260,14 @@
"partial": "{0} von {1} Quellen vollständig angekommen.",
"numbers": "gelesen {0} · {1} neu · {2} geändert · {3} unverändert · {4} gespeichert"
},
+ "eta": {
+ "under_minute": "unter einer Minute",
+ "minutes": "etwa {0} Minuten",
+ "hours": "etwa {0} Stunden",
+ "days": "etwa {0} Tage",
+ "weeks": "etwa {0} Wochen",
+ "months": "etwa {0} Monate"
+ },
"overview": {
"eyebrow_verdict": "Kann ich es nutzen?",
"eyebrow_sources": "Woher es kommt",
@@ -3171,6 +3282,9 @@
"detail_starting": "Solange er nicht offen ist, kann er nicht sagen, was er enthält — deshalb stehen hier keine Zahlen. Das erledigt sich meist Sekunden nach dem Start; wenn nicht, sagen die Prüfungen unten warum.",
"detail_done": "Alle {0} Einträge sind durchsuchbar und zusammengefasst.",
"detail_working": "{0} von {1} sind noch {2}. Alles andere ist schon durchsuchbar; wie lange der Rest dauert, wird gerade gemessen.",
+ "pace_paused": "Zusammenfassungen pausieren absichtlich: {0}",
+ "detail_working_stalled": "{0} von {1} sind noch {2}, und während der Messung hat sich nichts bewegt. Die Warteschlange steht still, sie läuft nicht nur langsam.",
+ "detail_working_eta": "{0} von {1} sind noch {2} — {3} im gerade gemessenen Tempo ({4} pro Stunde). Alles andere ist schon durchsuchbar.",
"detail_stalled": "{0} von {1} werden noch {2} — aber im Moment arbeitet nichts daran.",
"detail_notready": "Unten muss erst etwas geklärt werden, bevor Fragen beantwortet werden können. Die Liste darunter sagt, was.",
"detail_empty": "Füge eine Quelle hinzu, dann landen ihre Inhalte hier. Gelesen wird nichts, bevor du es erlaubst.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index c7d3070835..7ccf90a609 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -2718,22 +2718,116 @@
"result_error": "Couldn't reach Discord, please try again later."
},
"ultrawiki": {
- "explore": {
- "vault": {
- "title": "Obsidian vault",
- "hint": "The same knowledge as Markdown files on disk.",
- "export": "Export",
- "exporting": "Writing …",
- "exported": "{0} notes written, {1} unchanged.",
- "notes": "{0} notes",
- "never": "Never exported",
- "last": "Last run {0}",
- "register": "Add to Obsidian",
- "registering": "Adding …",
- "registered": "Added to Obsidian",
- "not_installed": "Obsidian is not installed on this machine. The files are written anyway — any Markdown app can open them.",
- "error": "That did not work: {0}"
+ "explore": {
+ "vault": {
+ "title": "Obsidian vault",
+ "hint": "The same knowledge as Markdown files on disk.",
+ "export": "Export",
+ "exporting": "Writing …",
+ "exported": "{0} notes written, {1} unchanged.",
+ "notes": "{0} notes",
+ "never": "Never exported",
+ "last": "Last run {0}",
+ "register": "Add to Obsidian",
+ "registering": "Adding …",
+ "registered": "Added to Obsidian",
+ "not_installed": "Obsidian is not installed on this machine. The files are written anyway — any Markdown app can open them.",
+ "error": "That did not work: {0}"
+ },
+ "tab": "Explore",
+ "loading": "Reading the knowledge base …",
+ "error": "The knowledge base could not be read.",
+ "entities_title": "Topics",
+ "entities_count": "{0} topics",
+ "moments_title": "Moments",
+ "moments_count": "{0} moments",
+ "graph_title": "Connections",
+ "search_placeholder": "Search a topic …",
+ "no_search_hits": "No topic matches “{0}”.",
+ "mentions": "{0}×",
+ "mentions_long": "{0} mentions",
+ "period": "{0} to {1}",
+ "neighbors": "Appears with",
+ "no_neighbors": "Has only ever appeared on its own.",
+ "shared": "{0} shared moments",
+ "back": "Back to the overview",
+ "open_source": "Open the evidence",
+ "source_prefix": "from",
+ "min_mentions": "From {0} mentions",
+ "graph_shown": "{0} of {1} topics",
+ "graph_hint": "Rarer topics are hidden — move the slider left to show all.",
+ "graph_empty": "No topic is mentioned often enough. Set the slider to 1.",
+ "moments_of": "Moments involving {0}",
+ "empty": {
+ "no_sources": "No source is connected yet. Connect one first, then Jarvis has something to know.",
+ "nothing_imported": "A source is connected but nothing has been fetched yet. Start the import under Sources.",
+ "nothing_distilled": "Entries are stored but none has been analysed yet. That needs a language model configured in the settings.",
+ "no_entities": "The entries were analysed but named no people or places. You can still browse the moments below."
+ }
+ },
+ "explore": {
+ "vault": {
+ "title": "Obsidian vault",
+ "hint": "The same knowledge as Markdown files on disk.",
+ "export": "Export",
+ "exporting": "Writing …",
+ "exported": "{0} notes written, {1} unchanged.",
+ "notes": "{0} notes",
+ "never": "Never exported",
+ "last": "Last run {0}",
+ "register": "Add to Obsidian",
+ "registering": "Adding …",
+ "registered": "Added to Obsidian",
+ "not_installed": "Obsidian is not installed on this machine. The files are written anyway — any Markdown app can open them.",
+ "error": "That did not work: {0}"
+ },
+ "tab": "Explore",
+ "loading": "Reading the knowledge base …",
+ "error": "The knowledge base could not be read.",
+ "entities_title": "Topics",
+ "entities_count": "{0} topics",
+ "moments_title": "Moments",
+ "moments_count": "{0} moments",
+ "graph_title": "Connections",
+ "search_placeholder": "Search a topic …",
+ "no_search_hits": "No topic matches “{0}”.",
+ "mentions": "{0}×",
+ "mentions_long": "{0} mentions",
+ "period": "{0} to {1}",
+ "neighbors": "Appears with",
+ "no_neighbors": "Has only ever appeared on its own.",
+ "shared": "{0} shared moments",
+ "back": "Back to the overview",
+ "open_source": "Open the evidence",
+ "source_prefix": "from",
+ "min_mentions": "From {0} mentions",
+ "graph_shown": "{0} of {1} topics",
+ "graph_hint": "Rarer topics are hidden — move the slider left to show all.",
+ "graph_empty": "No topic is mentioned often enough. Set the slider to 1.",
+ "moments_of": "Moments involving {0}",
+ "empty": {
+ "no_sources": "No source is connected yet. Connect one first, then Jarvis has something to know.",
+ "nothing_imported": "A source is connected but nothing has been fetched yet. Start the import under Sources.",
+ "nothing_distilled": "Entries are stored but none has been analysed yet. That needs a language model configured in the settings.",
+ "no_entities": "The entries were analysed but named no people or places. You can still browse the moments below."
+ }
},
+ "explore": {
+ "vault": {
+ "title": "Obsidian vault",
+ "hint": "The same knowledge as Markdown files on disk.",
+ "export": "Export",
+ "exporting": "Writing …",
+ "exported": "{0} notes written, {1} unchanged.",
+ "notes": "{0} notes",
+ "never": "Never exported",
+ "last": "Last run {0}",
+ "register": "Add to Obsidian",
+ "registering": "Adding …",
+ "registered": "Added to Obsidian",
+ "not_installed": "Obsidian is not installed on this machine. The files are written anyway — any Markdown app can open them.",
+ "error": "That did not work: {0}"
+ },
"tab": "Explore",
"loading": "Reading the knowledge base …",
"error": "The knowledge base could not be read.",
@@ -2756,13 +2850,7 @@
"min_mentions": "From {0} mentions",
"graph_shown": "{0} of {1} topics",
"graph_hint": "Rarer topics are hidden — move the slider left to show all.",
- "graph_hint_short": "Show from",
"graph_empty": "No topic is mentioned often enough. Set the slider to 1.",
- "legend_size": "Bigger = mentioned more often",
- "legend_recency": "Longer ago → just now",
- "reader_hint": "Pick a topic to read only its moments",
- "read_more": "Read the whole moment",
- "read_less": "Collapse this moment",
"moments_of": "Moments involving {0}",
"empty": {
"no_sources": "No source is connected yet. Connect one first, then Jarvis has something to know.",
@@ -3158,6 +3246,14 @@
"partial": "{0} of {1} source(s) fully landed.",
"numbers": "read {0} · {1} new · {2} changed · {3} unchanged · {4} stored"
},
+ "eta": {
+ "under_minute": "under a minute",
+ "minutes": "about {0} minutes",
+ "hours": "about {0} hours",
+ "days": "about {0} days",
+ "weeks": "about {0} weeks",
+ "months": "about {0} months"
+ },
"overview": {
"eyebrow_verdict": "Can I use it?",
"eyebrow_sources": "Where it comes from",
@@ -3172,6 +3268,9 @@
"detail_starting": "Until it opens it cannot say what it holds, so no numbers are shown. This usually clears within seconds of starting the app; if it does not, the checks below say why.",
"detail_done": "All {0} items are searchable and summarised.",
"detail_working": "{0} of {1} are still {2}. Everything else can be searched right now; how long the rest takes is still being measured.",
+ "pace_paused": "Summaries are paused on purpose: {0}",
+ "detail_working_stalled": "{0} of {1} are still {2}, and nothing has moved while this was measured. The queue is standing still rather than running slowly.",
+ "detail_working_eta": "{0} of {1} are still {2} — {3} at the pace measured just now ({4} an hour). Everything else can be searched right now.",
"detail_stalled": "{0} of {1} are still {2} — but nothing is processing them right now.",
"detail_notready": "Something below has to be sorted out before questions can be answered. The list underneath says what.",
"detail_empty": "Add a source and its contents land here. Nothing is read before you approve it.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 720039baa9..a65ab410e1 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -2717,22 +2717,116 @@
"result_error": "No se pudo llegar a Discord, inténtalo de nuevo más tarde."
},
"ultrawiki": {
- "explore": {
- "vault": {
- "title": "Bóveda de Obsidian",
- "hint": "El mismo conocimiento como archivos Markdown en el disco.",
- "export": "Exportar",
- "exporting": "Escribiendo …",
- "exported": "{0} notas escritas, {1} sin cambios.",
- "notes": "{0} notas",
- "never": "Nunca exportado",
- "last": "Última vez {0}",
- "register": "Añadir a Obsidian",
- "registering": "Añadiendo …",
- "registered": "Añadido a Obsidian",
- "not_installed": "Obsidian no está instalado en este equipo. Los archivos se escriben igualmente: cualquier app de Markdown puede abrirlos.",
- "error": "No funcionó: {0}"
+ "explore": {
+ "vault": {
+ "title": "Bóveda de Obsidian",
+ "hint": "El mismo conocimiento como archivos Markdown en el disco.",
+ "export": "Exportar",
+ "exporting": "Escribiendo …",
+ "exported": "{0} notas escritas, {1} sin cambios.",
+ "notes": "{0} notas",
+ "never": "Nunca exportado",
+ "last": "Última vez {0}",
+ "register": "Añadir a Obsidian",
+ "registering": "Añadiendo …",
+ "registered": "Añadido a Obsidian",
+ "not_installed": "Obsidian no está instalado en este equipo. Los archivos se escriben igualmente: cualquier app de Markdown puede abrirlos.",
+ "error": "No funcionó: {0}"
+ },
+ "tab": "Explorar",
+ "loading": "Leyendo la base de conocimiento …",
+ "error": "No se pudo leer la base de conocimiento.",
+ "entities_title": "Temas",
+ "entities_count": "{0} temas",
+ "moments_title": "Momentos",
+ "moments_count": "{0} momentos",
+ "graph_title": "Conexiones",
+ "search_placeholder": "Buscar un tema …",
+ "no_search_hits": "Ningún tema coincide con «{0}».",
+ "mentions": "{0}×",
+ "mentions_long": "{0} menciones",
+ "period": "{0} a {1}",
+ "neighbors": "Aparece junto a",
+ "no_neighbors": "Hasta ahora siempre aparece solo.",
+ "shared": "{0} momentos compartidos",
+ "back": "Volver al resumen",
+ "open_source": "Abrir la evidencia",
+ "source_prefix": "de",
+ "min_mentions": "Desde {0} menciones",
+ "graph_shown": "{0} de {1} temas",
+ "graph_hint": "Los temas menos frecuentes están ocultos: mueve el control a la izquierda para verlos todos.",
+ "graph_empty": "Ningún tema se menciona lo suficiente. Pon el control en 1.",
+ "moments_of": "Momentos con {0}",
+ "empty": {
+ "no_sources": "Todavía no hay ninguna fuente conectada. Conecta una primero y Jarvis tendrá algo que saber.",
+ "nothing_imported": "Hay una fuente conectada pero aún no se ha traído nada. Inicia la importación en Fuentes.",
+ "nothing_distilled": "Hay entradas guardadas pero ninguna se ha analizado todavía. Para eso hace falta un modelo de lenguaje configurado en los ajustes.",
+ "no_entities": "Las entradas se analizaron pero no mencionaron personas ni lugares. Aun así puedes hojear los momentos de abajo."
+ }
+ },
+ "explore": {
+ "vault": {
+ "title": "Bóveda de Obsidian",
+ "hint": "El mismo conocimiento como archivos Markdown en el disco.",
+ "export": "Exportar",
+ "exporting": "Escribiendo …",
+ "exported": "{0} notas escritas, {1} sin cambios.",
+ "notes": "{0} notas",
+ "never": "Nunca exportado",
+ "last": "Última vez {0}",
+ "register": "Añadir a Obsidian",
+ "registering": "Añadiendo …",
+ "registered": "Añadido a Obsidian",
+ "not_installed": "Obsidian no está instalado en este equipo. Los archivos se escriben igualmente: cualquier app de Markdown puede abrirlos.",
+ "error": "No funcionó: {0}"
+ },
+ "tab": "Explorar",
+ "loading": "Leyendo la base de conocimiento …",
+ "error": "No se pudo leer la base de conocimiento.",
+ "entities_title": "Temas",
+ "entities_count": "{0} temas",
+ "moments_title": "Momentos",
+ "moments_count": "{0} momentos",
+ "graph_title": "Conexiones",
+ "search_placeholder": "Buscar un tema …",
+ "no_search_hits": "Ningún tema coincide con «{0}».",
+ "mentions": "{0}×",
+ "mentions_long": "{0} menciones",
+ "period": "{0} a {1}",
+ "neighbors": "Aparece junto a",
+ "no_neighbors": "Hasta ahora siempre aparece solo.",
+ "shared": "{0} momentos compartidos",
+ "back": "Volver al resumen",
+ "open_source": "Abrir la evidencia",
+ "source_prefix": "de",
+ "min_mentions": "Desde {0} menciones",
+ "graph_shown": "{0} de {1} temas",
+ "graph_hint": "Los temas menos frecuentes están ocultos: mueve el control a la izquierda para verlos todos.",
+ "graph_empty": "Ningún tema se menciona lo suficiente. Pon el control en 1.",
+ "moments_of": "Momentos con {0}",
+ "empty": {
+ "no_sources": "Todavía no hay ninguna fuente conectada. Conecta una primero y Jarvis tendrá algo que saber.",
+ "nothing_imported": "Hay una fuente conectada pero aún no se ha traído nada. Inicia la importación en Fuentes.",
+ "nothing_distilled": "Hay entradas guardadas pero ninguna se ha analizado todavía. Para eso hace falta un modelo de lenguaje configurado en los ajustes.",
+ "no_entities": "Las entradas se analizaron pero no mencionaron personas ni lugares. Aun así puedes hojear los momentos de abajo."
+ }
},
+ "explore": {
+ "vault": {
+ "title": "Bóveda de Obsidian",
+ "hint": "El mismo conocimiento como archivos Markdown en el disco.",
+ "export": "Exportar",
+ "exporting": "Escribiendo …",
+ "exported": "{0} notas escritas, {1} sin cambios.",
+ "notes": "{0} notas",
+ "never": "Nunca exportado",
+ "last": "Última vez {0}",
+ "register": "Añadir a Obsidian",
+ "registering": "Añadiendo …",
+ "registered": "Añadido a Obsidian",
+ "not_installed": "Obsidian no está instalado en este equipo. Los archivos se escriben igualmente: cualquier app de Markdown puede abrirlos.",
+ "error": "No funcionó: {0}"
+ },
"tab": "Explorar",
"loading": "Leyendo la base de conocimiento …",
"error": "No se pudo leer la base de conocimiento.",
@@ -2755,13 +2849,7 @@
"min_mentions": "Desde {0} menciones",
"graph_shown": "{0} de {1} temas",
"graph_hint": "Los temas menos frecuentes están ocultos: mueve el control a la izquierda para verlos todos.",
- "graph_hint_short": "Mostrar desde",
"graph_empty": "Ningún tema se menciona lo suficiente. Pon el control en 1.",
- "legend_size": "Más grande = mencionado más veces",
- "legend_recency": "Hace tiempo → ahora mismo",
- "reader_hint": "Elige un tema para leer solo sus momentos",
- "read_more": "Leer el momento completo",
- "read_less": "Plegar este momento",
"moments_of": "Momentos con {0}",
"empty": {
"no_sources": "Todavía no hay ninguna fuente conectada. Conecta una primero y Jarvis tendrá algo que saber.",
@@ -3157,6 +3245,14 @@
"partial": "{0} de {1} fuentes llegaron completas.",
"numbers": "leídos {0} · {1} nuevos · {2} cambiados · {3} sin cambios · {4} guardados"
},
+ "eta": {
+ "under_minute": "menos de un minuto",
+ "minutes": "unos {0} minutos",
+ "hours": "unas {0} horas",
+ "days": "unas {0} días",
+ "weeks": "unas {0} semanas",
+ "months": "unos {0} meses"
+ },
"overview": {
"eyebrow_verdict": "¿Puedo usarlo?",
"eyebrow_sources": "De dónde viene",
@@ -3171,6 +3267,9 @@
"detail_starting": "Mientras no se abra no puede decir qué contiene, por eso no se muestran cifras. Suele resolverse a los pocos segundos de arrancar; si no, las comprobaciones de abajo dicen por qué.",
"detail_done": "Los {0} elementos son buscables y están resumidos.",
"detail_working": "{0} de {1} siguen {2}. Todo lo demás ya se puede buscar; cuánto tarda el resto se está midiendo.",
+ "pace_paused": "Los resúmenes están pausados a propósito: {0}",
+ "detail_working_stalled": "{0} de {1} siguen {2}, y nada se ha movido durante la medición. La cola está parada, no simplemente lenta.",
+ "detail_working_eta": "{0} de {1} siguen {2} — {3} al ritmo medido ahora mismo ({4} por hora). Todo lo demás ya se puede buscar.",
"detail_stalled": "{0} de {1} siguen {2}, pero ahora mismo nada los está procesando.",
"detail_notready": "Hay algo que resolver antes de poder responder preguntas. La lista de abajo dice qué.",
"detail_empty": "Añade una fuente y su contenido aparecerá aquí. Nada se lee antes de que lo apruebes.",
diff --git a/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts b/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
index 02a4bf853a..e4935d023f 100644
--- a/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
@@ -376,6 +376,51 @@ export interface UltraWikiPipeline {
/** One honest English sentence: what is happening, or what blocks it. */
reason?: string;
processed: Record<string, number>;
+ /**
+ * stage -> why it is standing still, for the stages that are. Mirrors
+ * PipelineWorker.stage_pause_reasons(). A lane parked ON PURPOSE (summaries
+ * during an index rebuild) and a broken one both show `processed: 0`
+ * forever; this string is the only thing that tells them apart, which is
+ * why it had to stop living only in the log file.
+ */
+ paused?: Record<string, string>;
+}
+
+/** One measured lane of {@link UltraWikiThroughput}. */
+export interface UltraWikiThroughputLane {
+ /** Completed items an hour, or null while still being measured. */
+ rate_per_hour: number | null;
+ /** Items this lane still has to get through. */
+ backlog: number;
+ /**
+ * Seconds until the backlog clears at the measured rate. Null means either
+ * "not measured long enough" or "not moving" — never an invented number.
+ * `stalled` distinguishes the two.
+ */
+ eta_seconds: number | null;
+ measured_s: number;
+ measured_items: number;
+ /** Observed long enough to be sure, and nothing moved. */
+ stalled: boolean;
+ /** Why this lane is deliberately parked, when it is. */
+ paused_reason: string;
+}
+
+/**
+ * How fast the pipeline actually moves, measured from the worker's own
+ * completed transitions — mirrors jarvis/ultrawiki/throughput.py.
+ *
+ * The section used to state a 236 000-item backlog with no duration attached
+ * and the words "you do not have to wait" underneath, over a queue that
+ * measured four days. Nothing here is estimated from a provider or model
+ * name: an unmeasurable rate reports null and the UI says it is measuring.
+ */
+export interface UltraWikiThroughput {
+ embed?: UltraWikiThroughputLane;
+ distill?: UltraWikiThroughputLane;
+ /** Both lanes summed, or null while either half is unknown. */
+ eta_seconds?: number | null;
+ measured?: boolean;
}
export interface UltraWikiSearchLeg {
@@ -421,6 +466,8 @@ export interface UltraWikiStatus {
};
progress?: UltraWikiProgress;
pipeline: UltraWikiPipeline;
+ /** Measured rate + ETA per lane. Empty until the worker can answer. */
+ throughput?: UltraWikiThroughput;
sources: UltraWikiSource[];
jobs: UltraWikiJob[];
search_legs: {
diff --git a/jarvis/ui/web/frontend/src/lib/ultrawikiEta.ts b/jarvis/ui/web/frontend/src/lib/ultrawikiEta.ts
new file mode 100644
index 0000000000..1f1b40aead
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/ultrawikiEta.ts
@@ -0,0 +1,93 @@
+/**
+ * Turning a measured backlog duration into a sentence a person can act on.
+ *
+ * Why this exists (2026-07-27). The overview stated a 236 000-item backlog and
+ * followed it with "you do not have to wait". Both halves came from real
+ * numbers; neither said how long, and the answer was four days for the
+ * embedding queue alone. A duration is the difference between a detail you can
+ * ignore and a decision you need to make, so it is now shown wherever the
+ * backlog is.
+ *
+ * The rules are the same as the backend's (jarvis/ultrawiki/throughput.py) and
+ * they matter more than the formatting:
+ *
+ * - `null` seconds is NOT zero and not infinity. It means the rate was not
+ * measurable, and the caller says so instead of printing a number.
+ * - A stalled lane gets no duration at all. "Never at this rate" is not a
+ * date, and rendering one implies the queue is moving.
+ * - The precision is deliberately coarse. Nobody decides differently between
+ * "4.1 days" and "4 days 3 hours", and a spuriously precise estimate over a
+ * queue this size reads as a promise it cannot keep.
+ */
+import type { UltraWikiThroughputLane } from "@/lib/ultrawikiApi";
+
+type Translate = (key: string) => string;
+
+/**
+ * A duration as localized prose, or `""` when there is nothing honest to say.
+ *
+ * Buckets rather than a unit conversion, because each bucket is a different
+ * sentence in a language with plural rules — a single "{0} {unit}" template
+ * cannot survive translation into all of them.
+ */
+export function formatEta(seconds: number | null | undefined, t: Translate): string {
+ if (seconds === null || seconds === undefined || !Number.isFinite(seconds)) {
+ return "";
+ }
+ const total = Math.max(0, seconds);
+ if (total < 90) return t("ultrawiki.eta.under_minute");
+ const minutes = total / 60;
+ if (minutes < 90) return t("ultrawiki.eta.minutes").replace("{0}", String(Math.round(minutes)));
+ const hours = minutes / 60;
+ if (hours < 36) return t("ultrawiki.eta.hours").replace("{0}", String(Math.round(hours)));
+ const days = hours / 24;
+ if (days < 14) {
+ // One decimal below two weeks: the difference between 4 and 5 days is a
+ // different weekend, and rounding it away hides that.
+ const shown = days < 10 ? days.toFixed(1).replace(/\.0$/, "") : String(Math.round(days));
+ return t("ultrawiki.eta.days").replace("{0}", shown);
+ }
+ const weeks = days / 7;
+ if (weeks < 9) return t("ultrawiki.eta.weeks").replace("{0}", String(Math.round(weeks)));
+ return t("ultrawiki.eta.months").replace("{0}", String(Math.round(days / 30)));
+}
+
+/** What a lane can honestly be said to be doing right now. */
+export type PaceKind = "measuring" | "stalled" | "paused" | "moving" | "done";
+
+export interface Pace {
+ kind: PaceKind;
+ /** Localized duration, `""` unless `kind === "moving"`. */
+ eta: string;
+ /** Whole items an hour, rounded; `null` unless measured. */
+ perHour: number | null;
+ /** The backend's own sentence for a parked lane, `""` otherwise. */
+ pausedReason: string;
+}
+
+/**
+ * Classify one lane. The order is the point: a lane that is parked on purpose
+ * must never be reported as stalled, and a lane still being measured must
+ * never be reported as moving.
+ */
+export function paceOf(lane: UltraWikiThroughputLane | undefined, t: Translate): Pace {
+ const empty: Pace = { kind: "measuring", eta: "", perHour: null, pausedReason: "" };
+ if (!lane) return empty;
+ const pausedReason = lane.paused_reason || "";
+ if (lane.backlog === 0) {
+ return { kind: "done", eta: "", perHour: lane.rate_per_hour, pausedReason };
+ }
+ if (pausedReason) {
+ return { kind: "paused", eta: "", perHour: lane.rate_per_hour, pausedReason };
+ }
+ if (lane.rate_per_hour === null || lane.rate_per_hour === undefined) return empty;
+ if (lane.stalled) {
+ return { kind: "stalled", eta: "", perHour: 0, pausedReason };
+ }
+ return {
+ kind: "moving",
+ eta: formatEta(lane.eta_seconds, t),
+ perHour: Math.round(lane.rate_per_hour),
+ pausedReason,
+ };
+}
diff --git a/jarvis/ui/web/ultrawiki_routes.py b/jarvis/ui/web/ultrawiki_routes.py
index c6c2ac6ed9..ff7b10f328 100644
--- a/jarvis/ui/web/ultrawiki_routes.py
+++ b/jarvis/ui/web/ultrawiki_routes.py
@@ -241,7 +241,9 @@ async def _search_legs_async(cfg: Any) -> dict[str, Any]:
def _apply_reembed_to_legs(
- legs: dict[str, Any], reembed: dict[str, Any]
+ legs: dict[str, Any],
+ reembed: dict[str, Any],
+ throughput: dict[str, Any] | None = None,
) -> dict[str, Any]:
"""Mark the vector leg unavailable while a model switch is rebuilding.
@@ -253,6 +255,13 @@ def _apply_reembed_to_legs(
Reporting the leg as available anyway is how the health screen came to say
"Both exact words and meaning are searchable" during an outage that lasted
as long as the rebuild.
+
+ The counter says WHICH population it counts, which the bare "2 592 of
+ 4 712" did not. Read beside an overview reporting 235 915 items queued,
+ that number was taken for the whole job and made the rebuild look nearly
+ done; it only ever covered the items that could already be searched by
+ meaning before the switch. Everything imported since queues behind it, so
+ the estimate carries the whole embedding backlog, not the rebuild's slice.
"""
model = str(reembed.get("model") or "")
if not model:
@@ -262,7 +271,14 @@ def _apply_reembed_to_legs(
return legs
done = int(reembed.get("done") or 0)
total = int(reembed.get("total") or 0)
- progress = f"{done} of {total} item(s) done" if total else "just started"
+ if total:
+ scope = (
+ f"{done} of the {total} item(s) that could already be searched by "
+ "meaning have been re-measured"
+ )
+ else:
+ scope = "it has just started"
+ eta = _embed_eta_phrase(throughput)
return {
**legs,
"vector": {
@@ -273,13 +289,29 @@ def _apply_reembed_to_legs(
# keyword-only costs, and two sentences saying the same thing read
# as two different problems.
"reason": (
- f"semantic search is rebuilding on {model} ({progress}) — it "
- "comes back by itself when the rebuild finishes."
+ f"semantic search is rebuilding on {model} — {scope}. Anything "
+ "imported since queues behind it" + eta + "."
),
},
}
+def _embed_eta_phrase(throughput: dict[str, Any] | None) -> str:
+ """``", and the whole queue needs about 4 days at the current rate"``, or ``""``.
+
+ Empty whenever the rate is not yet measurable or the lane is standing
+ still — an un-timed sentence is better than an invented duration, which is
+ the failure this whole payload exists to correct.
+ """
+ from jarvis.ultrawiki.throughput import format_duration # noqa: PLC0415 — lazy
+
+ lane = dict((throughput or {}).get("embed") or {})
+ pretty = format_duration(lane.get("eta_seconds"))
+ if not pretty or not lane.get("backlog"):
+ return ""
+ return f", and the whole embedding queue needs about {pretty} at the current rate"
+
+
# ---------------------------------------------------------------------------
# Status + providers
# ---------------------------------------------------------------------------
@@ -348,10 +380,14 @@ async def get_status(request: Request) -> dict[str, Any]:
"counts": data.get("counts", {}),
"progress": data.get("progress") or build_progress(data.get("counts")),
"pipeline": data.get("pipeline", {}),
+ # Measured rate + ETA per lane. Empty until the worker has watched
+ # itself long enough to answer honestly (throughput.py) — a client
+ # renders "still measuring" rather than a first-minute extrapolation.
+ "throughput": data.get("throughput", {}),
"sources": data.get("sources", []),
"jobs": data.get("jobs", []),
"search_legs": _apply_reembed_to_legs(
- await _search_legs_async(cfg), reembed
+ await _search_legs_async(cfg), reembed, data.get("throughput") or {}
),
"degradations": data.get("degradations", []),
}
diff --git a/jarvis/ultrawiki/health.py b/jarvis/ultrawiki/health.py
index 58a113f0af..e308e011a3 100644
--- a/jarvis/ultrawiki/health.py
+++ b/jarvis/ultrawiki/health.py
@@ -394,6 +394,78 @@ def _search_check(status: dict[str, Any]) -> HealthCheck:
)
+def _pace_sentence(status: dict[str, Any]) -> str:
+ """How long the rest takes, in one sentence, from measured work only.
+
+ Three honest outcomes, never a fourth invented one:
+
+ * not measured long enough yet → say that,
+ * measured and moving → the duration,
+ * measured and NOT moving → say it is not moving, with no duration, because
+ "never at this rate" is not a date and printing one implies progress.
+ """
+ from jarvis.ultrawiki.throughput import format_duration # noqa: PLC0415 — lazy
+
+ lane = dict((dict(status.get("throughput") or {})).get("embed") or {})
+ if not lane or lane.get("rate_per_hour") is None:
+ return "It runs in the background; how long the rest takes is still being measured."
+ if lane.get("stalled"):
+ return (
+ "It is not moving at the moment, so the rest has no completion "
+ "time — the queue is standing still rather than running slowly."
+ )
+ pretty = format_duration(lane.get("eta_seconds"))
+ rate = lane.get("rate_per_hour")
+ if not pretty:
+ return "It runs in the background."
+ return (
+ f"At the rate measured just now ({_num(round(float(rate)))} item(s) an "
+ f"hour) the rest needs about {pretty}."
+ )
+
+
+def _pace_facts(status: dict[str, Any]) -> dict[str, Any]:
+ """The measured numbers behind :func:`_pace_sentence`, for the UI."""
+ lane = dict((dict(status.get("throughput") or {})).get("embed") or {})
+ return {
+ "rate_per_hour": lane.get("rate_per_hour"),
+ "eta_seconds": lane.get("eta_seconds"),
+ "measured_s": lane.get("measured_s"),
+ }
+
+
+def _summaries_check(status: dict[str, Any]) -> HealthCheck | None:
+ """Say when the summarising lane is deliberately parked, or ``None``.
+
+ Why this row exists (2026-07-27). The summary counter sat at 216 for hours
+ while every other number climbed, and nothing on screen explained it. The
+ lane was doing exactly what it was told: an embedding-model switch pauses
+ distillation on purpose, because ``begin_reembed`` demotes the items and
+ every summary written during a rebuild is written again after the swap.
+ That reason was logged once and never shown, so from the outside a
+ correctly parked stage and a broken one were the same picture — a frozen
+ number with no explanation, which is precisely how a working system loses
+ the reader's trust.
+ """
+ pipeline = dict(status.get("pipeline") or {})
+ reason = str(dict(pipeline.get("paused") or {}).get("distill") or "")
+ if not reason:
+ return None
+ progress = _progress_of(status)
+ summarised = int(progress.get("summarised") or 0)
+ return HealthCheck(
+ id="summaries",
+ title="Summaries are paused on purpose",
+ state="working",
+ detail=(
+ reason.rstrip(".")
+ + f". {_num(summarised)} item(s) have one so far; the rest keep "
+ "their full text and stay searchable meanwhile."
+ ),
+ facts={"summarised": summarised, "paused_reason": reason},
+ )
+
+
def _processing_check(status: dict[str, Any]) -> HealthCheck:
"""The row that used to lie.
@@ -461,16 +533,24 @@ def _processing_check(status: dict[str, Any]) -> HealthCheck:
facts={**facts, "blocked": bool(pipeline.get("blocked"))},
)
if waiting:
+ # "You do not have to wait for the rest" was the wording here, and on a
+ # 236 000-item backlog moving at 0.65 items per second it was the most
+ # misleading sentence on the screen (2026-07-27): four days of embedding
+ # before the first new summary, presented as a detail you could ignore.
+ # It is a fair thing to say about a queue measured in minutes and a
+ # false one about a queue measured in days, and only the measured rate
+ # can tell those apart — so the row now states the duration and lets the
+ # reader decide whether it is worth acting on.
+ pace = _pace_sentence(status)
return HealthCheck(
id="processing",
title=f"{_num(waiting)} item(s) still {step}",
state="working",
detail=(
- f"This runs in the background. The {_num(searchable)} item(s) "
- "already processed can be searched right now — you do not "
- "have to wait for the rest."
+ f"The {_num(searchable)} item(s) already processed can be "
+ "searched right now. " + pace
),
- facts=facts,
+ facts={**facts, **_pace_facts(status)},
)
if state == "paused":
return HealthCheck(
@@ -577,6 +657,11 @@ def build_health(
_search_check(status),
_processing_check(status),
]
+ # Only present while the lane is genuinely parked, and it sits after
+ # processing because it explains a number that row just showed moving.
+ summaries = _summaries_check(status)
+ if summaries is not None:
+ checks.append(summaries)
worst = max((_SEVERITY[c.state] for c in checks), default=0)
overall = next(k for k, v in _SEVERITY.items() if v == worst)
# The headline answers the only question that matters at a glance: can I
diff --git a/jarvis/ultrawiki/pipeline.py b/jarvis/ultrawiki/pipeline.py
index bb35268a57..39aa878898 100644
--- a/jarvis/ultrawiki/pipeline.py
+++ b/jarvis/ultrawiki/pipeline.py
@@ -49,6 +49,7 @@ from collections.abc import Awaitable, Callable
from datetime import UTC, datetime
from typing import Any
+from jarvis.ultrawiki.throughput import ThroughputTracker
from jarvis.ultrawiki.types import DocType, ItemState
log = logging.getLogger(__name__)
@@ -235,6 +236,14 @@ class PipelineWorker:
self._distill_ready_fn = distill_ready_fn
#: Per-stage processed counters (successful transitions only).
self.processed: dict[str, int] = {"keyword": 0, "embed": 0, "distill": 0}
+ #: Sliding-window rate meters over those counters, one per SLOW lane.
+ #: Keyword indexing needs no model and never paces anything, so it gets
+ #: no meter — the two stages that call out to a model are the two that
+ #: decide how long a corpus takes.
+ self._rate: dict[str, ThroughputTracker] = {
+ "embed": ThroughputTracker(),
+ "distill": ThroughputTracker(),
+ }
self._ready_cache: tuple[float, str, bool, str] | None = None
self._distill_ready_cache: tuple[float, bool, str] | None = None
#: stage -> the pause reason last logged, so a persistent gap logs once.
@@ -259,6 +268,27 @@ class PipelineWorker:
"""Copy of the per-stage processed counters."""
return dict(self.processed)
+ def throughput(self) -> dict[str, dict[str, Any]]:
+ """Measured rate of the two model-bound lanes (see
+ :mod:`jarvis.ultrawiki.throughput`).
+
+ The service turns these into an ETA against the live backlog. Reported
+ rather than computed here because the backlog is the store's business,
+ not the worker's.
+ """
+ return {name: meter.snapshot() for name, meter in self._rate.items()}
+
+ def stage_pause_reasons(self) -> dict[str, str]:
+ """Why each paused stage is paused, ``{}`` when everything runs.
+
+ These sentences already existed — they were logged once per change and
+ never left the log file. A summarising lane that has been deliberately
+ parked for the duration of an index rebuild is indistinguishable, from
+ the outside, from one that is broken: both show ``distill: 0`` forever.
+ The difference is this string, so it has to reach the screen.
+ """
+ return dict(self._pause_reasons)
+
def embed_block(self) -> dict[str, Any] | None:
"""The live provider-level embedding block, or ``None``.
@@ -323,6 +353,13 @@ class PipelineWorker:
if not attempted or self._media_mode() == "eager":
attempted += await self._media_pass()
await self._promote_pass()
+ # Sample AFTER every pass, including passes that achieved nothing: a
+ # lane that is refused or paused has to keep feeding its meter, or a
+ # standstill would simply stop updating and read as the last healthy
+ # rate forever.
+ now = time.monotonic()
+ for name, meter in self._rate.items():
+ meter.sample(now, self.processed.get(name, 0))
return attempted
async def _reembed_is_running(self) -> bool:
diff --git a/jarvis/ultrawiki/service.py b/jarvis/ultrawiki/service.py
index 34f9be753c..cf2ae6be14 100644
--- a/jarvis/ultrawiki/service.py
+++ b/jarvis/ultrawiki/service.py
@@ -647,6 +647,13 @@ class UltraWikiService:
state, reason = self._pipeline_state(
progress, sources, slots, running=pipeline_running, embed_block=embed_block
)
+ # How long the backlog on screen actually takes, measured from the
+ # worker's own completed transitions. See jarvis/ultrawiki/throughput.py
+ # for the five-hour session that made an un-timed backlog unacceptable.
+ pause_reasons = (
+ self._pipeline.stage_pause_reasons() if self._pipeline is not None else {}
+ )
+ throughput = self._throughput(progress, pause_reasons)
return {
"enabled": self._uw_enabled(),
"started": started,
@@ -676,7 +683,13 @@ class UltraWikiService:
(embed_block or {}).get("needs_attention")
),
"blocked_since": (embed_block or {}).get("since"),
+ # Why a stage is standing still, when it is. A deliberately
+ # parked lane and a broken one both read as "0 processed"
+ # without this.
+ "paused": pause_reasons,
},
+ # Measured rate + resulting ETA per lane; see _throughput.
+ "throughput": throughput,
"sources": sources,
"jobs": _list_job_snapshots(10),
"degradations": list(self._degradations),
@@ -691,6 +704,49 @@ class UltraWikiService:
"rerank": self._rerank_slot_status(),
}
+ def _throughput(
+ self, progress: dict[str, Any], pause_reasons: dict[str, str]
+ ) -> dict[str, Any]:
+ """Measured rate + ETA for the two model-bound lanes. Never raises.
+
+ The backlogs are derived from the ONE progress model rather than
+ recounted here (progress.py exists because a second derivation always
+ drifts):
+
+ * **embedding** — everything not yet past the embed stage, i.e. the
+ ``captured`` and ``keyword_indexed`` buckets. A rebuild's demoted
+ items are already sitting in ``keyword_indexed``, so they are counted
+ once, here, and not added again.
+ * **summarising** — everything that has not reached ``distilled``,
+ minus the dead-lettered items, because those will not arrive there.
+
+ A worker that has not started yet reports empty snapshots, which
+ :func:`~jarvis.ultrawiki.throughput.build_throughput` renders as "not
+ measured yet" rather than as zero.
+ """
+ try:
+ buckets = dict(progress.get("buckets") or {})
+ captured = int(buckets.get("captured") or 0)
+ keyword_indexed = int(buckets.get("keyword_indexed") or 0)
+ embedded = int(buckets.get("embedded") or 0)
+ meters = (
+ self._pipeline.throughput() if self._pipeline is not None else {}
+ )
+ from jarvis.ultrawiki.throughput import ( # noqa: PLC0415 — lazy (AP-26)
+ build_throughput,
+ )
+
+ return build_throughput(
+ embed=dict(meters.get("embed") or {}),
+ distill=dict(meters.get("distill") or {}),
+ embed_backlog=captured + keyword_indexed,
+ distill_backlog=captured + keyword_indexed + embedded,
+ distill_paused_reason=str(pause_reasons.get("distill") or ""),
+ )
+ except Exception as exc: # noqa: BLE001 — status never raises
+ log.debug("UltraWiki throughput assembly failed: %s", exc, exc_info=True)
+ return {}
+
def _pipeline_state(
self,
progress: dict[str, Any],
diff --git a/jarvis/ultrawiki/throughput.py b/jarvis/ultrawiki/throughput.py
new file mode 100644
index 0000000000..fe8a16e6b1
--- /dev/null
+++ b/jarvis/ultrawiki/throughput.py
@@ -0,0 +1,256 @@
+"""How fast the pipeline is actually moving, and what that means in days.
+
+Why this module exists (2026-07-27 forensic). A maintainer watched the Wiki
+section for five hours and reported it had converted "about 200 files". The
+screen he was reading said, in order:
+
+* ``Ready to answer — and still filling up.``
+* ``235 915 of 236 131 are still being prepared for meaning search.``
+* ``Everything else can be searched right now — you do not have to wait.``
+
+Every one of those sentences was true. Together they were a lie of omission,
+because the screen never answered the only question a 236 000-item backlog
+raises: **how long?** Measured on that live store the embedding stage was
+moving 0.65 items per second — a little over four days of uninterrupted work
+for the queue on screen, and that is before a single summary is written. "You
+do not have to wait" is not a defensible thing to print over four days.
+
+The missing number was never unknowable. The worker has always counted its
+own successful transitions; nothing sampled that counter over time and divided.
+This module does exactly that and nothing else.
+
+Design rules, all of them about not replacing one confident lie with another:
+
+* **Measured, never assumed.** A rate comes only from observed work. There is
+ no hardcoded "items per second" for any backend, and no estimate derived
+ from a provider or model name (AP-21) — a local model on a fast machine and
+ a cloud key on a throttled account are the same code path here.
+* **Silence beats a guess.** Below :data:`MIN_SAMPLE_SPAN_S` of observation or
+ :data:`MIN_SAMPLE_WORK` of completed work the answer is ``None``, and the UI
+ says it is still measuring. A first-minute extrapolation is how a progress
+ bar earns the reputation this one is trying to lose.
+* **A stalled lane reports a stall, not eternity.** Zero work over a full
+ window is ``rate == 0.0`` with ``eta_seconds is None`` — "not moving",
+ which is actionable, rather than an infinity dressed up as a date.
+* **The window forgets.** Only the last :data:`WINDOW_S` of samples count, so
+ a rate that collapses when a big folder arrives shows up as a collapse
+ instead of being averaged away by a fast first hour.
+"""
+
+from __future__ import annotations
+
+from collections import deque
+from typing import Any
+
+__all__ = [
+ "MIN_SAMPLE_SPAN_S",
+ "MIN_SAMPLE_WORK",
+ "WINDOW_S",
+ "ThroughputTracker",
+ "build_throughput",
+ "format_duration",
+]
+
+#: How much recent history a rate is averaged over. Long enough that one slow
+#: batch does not swing it, short enough that a genuine slowdown surfaces
+#: within minutes rather than being diluted by a faster hour.
+WINDOW_S = 900.0
+
+#: Minimum observation span before any rate is published. A pipeline that just
+#: started has no honest rate, and printing one anyway is the whole defect.
+MIN_SAMPLE_SPAN_S = 90.0
+
+#: Minimum completed items in the window before a rate is published. Guards the
+#: other direction: 15 minutes in which exactly one item finished says nothing
+#: about the next thousand.
+MIN_SAMPLE_WORK = 5
+
+
+class ThroughputTracker:
+ """A sliding window over one cumulative counter.
+
+ The caller owns the clock (``now`` is passed in, never read here) so tests
+ are deterministic and the production caller can keep using the monotonic
+ clock a wall-clock jump cannot corrupt.
+
+ One tracker per lane: the embedding stage and the distillation stage move
+ at completely different speeds, and averaging them produces a number that
+ describes neither.
+ """
+
+ def __init__(self, *, window_s: float = WINDOW_S) -> None:
+ self._window_s = max(1.0, float(window_s))
+ #: (now, cumulative_done), oldest first.
+ self._samples: deque[tuple[float, int]] = deque()
+
+ def sample(self, now: float, done: int) -> None:
+ """Record the cumulative counter at *now*, then drop stale samples.
+
+ A counter that went BACKWARDS (the worker restarted and its per-stage
+ counters began again at zero) resets the window instead of reporting
+ the negative delta as a rate — a restart is missing history, not
+ negative progress.
+ """
+ try:
+ now = float(now)
+ done = int(done)
+ except (TypeError, ValueError):
+ return
+ if self._samples and done < self._samples[-1][1]:
+ self._samples.clear()
+ self._samples.append((now, done))
+ horizon = now - self._window_s
+ while len(self._samples) > 2 and self._samples[0][0] < horizon:
+ self._samples.popleft()
+
+ def rate_per_second(self) -> float | None:
+ """Completed items per second, or ``None`` when not yet measurable.
+
+ ``0.0`` is a real answer meaning "observed long enough, nothing moved";
+ ``None`` means "not observed long enough to say".
+
+ The work floor (:data:`MIN_SAMPLE_WORK`) applies only while the window
+ is still filling. Once a FULL window has been observed, a small number
+ is no longer a thin sample — it is the measurement. A lane creeping
+ along at two items every quarter of an hour is exactly the case a
+ backlog estimate is most needed for, and holding out for five would
+ have kept that lane permanently unreportable: the slower it ran, the
+ longer it stayed silent, which is precisely backwards.
+ """
+ if len(self._samples) < 2:
+ return None
+ first_at, first_done = self._samples[0]
+ last_at, last_done = self._samples[-1]
+ span = last_at - first_at
+ if span < MIN_SAMPLE_SPAN_S:
+ return None
+ worked = last_done - first_done
+ if worked <= 0:
+ return 0.0
+ if worked < MIN_SAMPLE_WORK and span < self._window_s:
+ # Still filling the window, and too few items to divide into a
+ # backlog of hundreds of thousands.
+ return None
+ return worked / span
+
+ def snapshot(self) -> dict[str, Any]:
+ """What was observed, for a surface that wants to show its working."""
+ if len(self._samples) < 2:
+ return {"rate_per_second": None, "measured_s": 0.0, "measured_items": 0}
+ first_at, first_done = self._samples[0]
+ last_at, last_done = self._samples[-1]
+ return {
+ "rate_per_second": self.rate_per_second(),
+ "measured_s": round(max(0.0, last_at - first_at), 1),
+ "measured_items": max(0, last_done - first_done),
+ }
+
+
+def build_throughput(
+ *,
+ embed: dict[str, Any],
+ distill: dict[str, Any],
+ embed_backlog: int,
+ distill_backlog: int,
+ distill_paused_reason: str = "",
+) -> dict[str, Any]:
+ """Assemble the honest "how long is left" payload for the status route.
+
+ Args:
+ embed: :meth:`ThroughputTracker.snapshot` of the embedding lane.
+ distill: the same for the summarising lane.
+ embed_backlog: items that still have to be embedded.
+ distill_backlog: items that still have to be summarised.
+ distill_paused_reason: why summaries are not running, if they are not.
+ Carried through verbatim so the UI never has to infer a stall from
+ a rate of zero — a paused lane and a dead lane look identical in
+ the numbers and are completely different situations.
+
+ Returns:
+ One dict per lane with ``rate_per_hour``, ``backlog``, ``eta_seconds``
+ (``None`` when unmeasurable or stalled) and ``paused_reason``, plus a
+ top-level ``eta_seconds`` for the whole job: the two lanes summed,
+ because an item is not finished until it has been summarised, and the
+ stages run one after the other rather than side by side.
+ """
+ embed_lane = _lane(embed, embed_backlog)
+ distill_lane = _lane(distill, distill_backlog, paused_reason=distill_paused_reason)
+
+ # The total is only honest when BOTH halves are known. A paused summary
+ # lane with an unmeasurable rate must not silently shorten the estimate to
+ # just the embedding half — that is the same optimism this module exists
+ # to remove. Report what is known per lane and leave the total open.
+ total: float | None
+ if embed_lane["eta_seconds"] is None or distill_lane["eta_seconds"] is None:
+ total = None
+ else:
+ total = embed_lane["eta_seconds"] + distill_lane["eta_seconds"]
+
+ return {
+ "embed": embed_lane,
+ "distill": distill_lane,
+ "eta_seconds": total,
+ # True when something is genuinely being observed to move. The UI uses
+ # this to decide between "measuring…" and a number.
+ "measured": embed_lane["rate_per_hour"] is not None
+ or distill_lane["rate_per_hour"] is not None,
+ }
+
+
+def _lane(
+ snapshot: dict[str, Any], backlog: int, *, paused_reason: str = ""
+) -> dict[str, Any]:
+ """One lane's measured rate, backlog and resulting ETA."""
+ rate_s = snapshot.get("rate_per_second")
+ backlog = max(0, int(backlog or 0))
+ eta: float | None = None
+ rate_per_hour: float | None = None
+ if isinstance(rate_s, (int, float)):
+ rate_per_hour = round(float(rate_s) * 3600.0, 1)
+ if backlog == 0:
+ eta = 0.0
+ elif rate_s > 0:
+ eta = backlog / float(rate_s)
+ # rate == 0 with a backlog: standing still. eta stays None on purpose —
+ # "never at this rate" is not a duration, and printing one implies the
+ # queue is moving.
+ return {
+ "rate_per_hour": rate_per_hour,
+ "backlog": backlog,
+ "eta_seconds": eta,
+ "measured_s": float(snapshot.get("measured_s") or 0.0),
+ "measured_items": int(snapshot.get("measured_items") or 0),
+ "stalled": rate_per_hour == 0.0 and backlog > 0,
+ "paused_reason": str(paused_reason or ""),
+ }
+
+
+def format_duration(seconds: float | None) -> str:
+ """A duration a person reads at a glance, or ``""`` when unknown.
+
+ Deliberately coarse and deliberately English-source-only (the UI composes
+ the localized sentence around this from its own strings): the difference
+ between "4 days" and "4 days 7 hours" changes no decision anyone makes
+ while looking at a backlog this size.
+ """
+ if seconds is None:
+ return ""
+ try:
+ total = max(0.0, float(seconds))
+ except (TypeError, ValueError):
+ return ""
+ if total < 90:
+ return "under a minute"
+ minutes = total / 60.0
+ if minutes < 90:
+ return f"{round(minutes)} minutes"
+ hours = minutes / 60.0
+ if hours < 36:
+ return f"{round(hours)} hours"
+ days = hours / 24.0
+ if days < 14:
+ return f"{days:.1f} days".replace(".0 ", " ")
+ weeks = days / 7.0
+ if weeks < 9:
+ return f"{round(weeks)} weeks"
+ return f"{round(days / 30.0)} months"
diff --git a/tests/unit/ultrawiki/test_health.py b/tests/unit/ultrawiki/test_health.py
index 406da1b16e..a9a6102fd9 100644
--- a/tests/unit/ultrawiki/test_health.py
+++ b/tests/unit/ultrawiki/test_health.py
@@ -389,13 +389,57 @@ def test_a_rebuilding_vector_leg_is_not_reported_as_working_search():
)
assert legs["vector"]["available"] is False
assert legs["vector"]["rebuilding"] is True
- assert "300 of 4712" in legs["vector"]["reason"]
+ reason = legs["vector"]["reason"]
+ assert "300" in reason and "4712" in reason
check = _check(build_health(_status(search_legs=legs), []), "search")
assert check["state"] == "attention"
assert "rebuilding" in check["detail"]
+def test_the_rebuild_counter_says_which_population_it_counts():
+ """The number that was read as the whole job (2026-07-27).
+
+ ``2 592 of 4 712`` sat a few centimetres under "235 915 items are queued
+ for processing". Both were right; nothing said they counted different
+ populations, so the rebuild looked nearly finished while the real backlog
+ was fifty times larger and untouched by that fraction. The counter now
+ names its own scope and says the rest queues behind it.
+ """
+ from jarvis.ui.web.ultrawiki_routes import _apply_reembed_to_legs
+
+ reason = _apply_reembed_to_legs(
+ {"vector": {"available": True}},
+ {"model": "bge-m3", "done": 2592, "total": 4712},
+ )["vector"]["reason"]
+ assert "already be searched by meaning" in reason
+ assert "queues behind it" in reason
+
+
+def test_a_measured_rate_puts_a_duration_on_the_rebuild():
+ """A backlog without a duration is the defect; carry the measured one."""
+ from jarvis.ui.web.ultrawiki_routes import _apply_reembed_to_legs
+
+ reason = _apply_reembed_to_legs(
+ {"vector": {"available": True}},
+ {"model": "bge-m3", "done": 2592, "total": 4712},
+ {"embed": {"backlog": 232_163, "eta_seconds": 232_163 / 0.65}},
+ )["vector"]["reason"]
+ assert "days" in reason
+
+
+def test_an_unmeasured_rate_adds_no_invented_duration():
+ """Silence beats a guess — the whole contract of throughput.py."""
+ from jarvis.ui.web.ultrawiki_routes import _apply_reembed_to_legs
+
+ reason = _apply_reembed_to_legs(
+ {"vector": {"available": True}},
+ {"model": "bge-m3", "done": 2592, "total": 4712},
+ {"embed": {"backlog": 232_163, "eta_seconds": None}},
+ )["vector"]["reason"]
+ assert "at the current rate" not in reason
+
+
def test_no_rebuild_leaves_the_vector_leg_exactly_as_probed():
"""The steady state must not pay for the rebuild path."""
from jarvis.ui.web.ultrawiki_routes import _apply_reembed_to_legs
@@ -403,3 +447,97 @@ def test_no_rebuild_leaves_the_vector_leg_exactly_as_probed():
legs = {"keyword": {"available": True}, "vector": {"available": True}}
assert _apply_reembed_to_legs(legs, {}) is legs
assert _check(build_health(_status(search_legs=legs), []), "search")["state"] == "ok"
+
+
+def test_a_backlog_states_how_long_it_takes():
+ """The sentence that made a four-day queue look like a detail.
+
+ "You do not have to wait for the rest" is fair over a queue of minutes and
+ false over one of days. On the 2026-07-27 store it sat under 235 915
+ queued items moving at 0.65 items a second, with nothing on screen saying
+ so. The row now quotes the measured pace instead.
+ """
+ status = _status(
+ counts={
+ "captured": 98_506,
+ "keyword_indexed": 133_657,
+ "embedded": 3_752,
+ "distilled": 216,
+ "failed": 0,
+ "total": 236_131,
+ },
+ pipeline={"running": True, "state": "processing", "reason": "working"},
+ throughput={
+ "embed": {
+ "rate_per_hour": 2340.0,
+ "backlog": 232_163,
+ "eta_seconds": 232_163 / 0.65,
+ "stalled": False,
+ "paused_reason": "",
+ }
+ },
+ )
+ check = _check(build_health(status, []), "processing")
+ assert check["state"] == "working"
+ assert "days" in check["detail"]
+ assert "you do not have to wait" not in check["detail"].lower()
+
+
+def test_an_unmeasured_backlog_says_it_is_measuring():
+ """No rate yet is not the same as no backlog, and neither is a guess."""
+ status = _status(
+ counts={
+ "captured": 500,
+ "keyword_indexed": 0,
+ "embedded": 0,
+ "distilled": 0,
+ "failed": 0,
+ "total": 500,
+ },
+ pipeline={"running": True, "state": "processing", "reason": "working"},
+ throughput={"embed": {"rate_per_hour": None, "backlog": 500}},
+ )
+ check = _check(build_health(status, []), "processing")
+ assert "still being measured" in check["detail"]
+
+
+def test_a_deliberately_parked_summary_lane_explains_itself():
+ """216 summaries frozen for hours with no reason on screen.
+
+ The lane was doing exactly what it was told — distillation pauses during an
+ embedding rebuild, because every summary written meanwhile is written again
+ after the swap — but that reason only ever reached the log file, so a
+ correctly parked stage and a broken one looked identical.
+ """
+ status = _status(
+ counts={
+ "captured": 0,
+ "keyword_indexed": 0,
+ "embedded": 3_752,
+ "distilled": 216,
+ "failed": 0,
+ "total": 3_968,
+ },
+ pipeline={
+ "running": True,
+ "state": "processing",
+ "reason": "working",
+ "paused": {
+ "distill": (
+ "summaries are paused while the search index is rebuilt on "
+ "the new embedding model"
+ )
+ },
+ },
+ )
+ health = build_health(status, [])
+ check = _check(health, "summaries")
+ assert check["state"] == "working"
+ assert "rebuilt" in check["detail"]
+ assert "216" in check["detail"]
+
+
+def test_no_summaries_row_when_nothing_is_parked():
+ """The steady state must not grow an extra row explaining nothing."""
+ health = build_health(_status(), [])
+ assert all(c["id"] != "summaries" for c in health["checks"])
diff --git a/tests/unit/ultrawiki/test_throughput.py b/tests/unit/ultrawiki/test_throughput.py
new file mode 100644
index 0000000000..cfdb96a329
--- /dev/null
+++ b/tests/unit/ultrawiki/test_throughput.py
@@ -0,0 +1,161 @@
+"""Guards for the measured-pace model (:mod:`jarvis.ultrawiki.throughput`).
+
+The defect this module exists to prevent is a screen that states a backlog
+without stating how long it takes, so the tests are mostly about the three
+ways the answer is allowed to be "I do not know" — too early, standing still,
+and deliberately parked. Every one of those used to render as either silence
+or a confident number, and both were wrong in the same direction.
+"""
+
+from __future__ import annotations
+
+from jarvis.ultrawiki.throughput import (
+ MIN_SAMPLE_SPAN_S,
+ ThroughputTracker,
+ build_throughput,
+ format_duration,
+)
+
+
+class TestThroughputTracker:
+ def test_no_rate_before_the_minimum_observation_span(self) -> None:
+ """A first-minute extrapolation is the defect, not the feature."""
+ tracker = ThroughputTracker()
+ tracker.sample(0.0, 0)
+ tracker.sample(MIN_SAMPLE_SPAN_S - 1.0, 500)
+ assert tracker.rate_per_second() is None
+
+ def test_measures_a_steady_rate(self) -> None:
+ tracker = ThroughputTracker()
+ tracker.sample(0.0, 0)
+ tracker.sample(200.0, 100)
+ assert tracker.rate_per_second() == 0.5
+
+ def test_a_lane_that_moved_nothing_reports_zero_not_none(self) -> None:
+ """Observed long enough and nothing happened is a real answer.
+
+ ``None`` would make a standstill indistinguishable from a pipeline that
+ started ten seconds ago, and the UI has to tell those apart.
+ """
+ tracker = ThroughputTracker()
+ tracker.sample(0.0, 7)
+ tracker.sample(600.0, 7)
+ assert tracker.rate_per_second() == 0.0
+
+ def test_a_restarted_counter_resets_instead_of_going_negative(self) -> None:
+ """The worker's counters begin again at zero after a restart."""
+ tracker = ThroughputTracker()
+ tracker.sample(0.0, 900)
+ tracker.sample(100.0, 0) # restart
+ tracker.sample(300.0, 100)
+ rate = tracker.rate_per_second()
+ assert rate is not None and rate > 0
+
+ def test_the_window_forgets_old_samples(self) -> None:
+ """A fast first hour must not hide a collapse happening now."""
+ tracker = ThroughputTracker(window_s=300.0)
+ tracker.sample(0.0, 0)
+ tracker.sample(100.0, 1000) # fast
+ tracker.sample(1000.0, 1010) # much later, barely moved
+ tracker.sample(1300.0, 1012)
+ rate = tracker.rate_per_second()
+ # The fast opening is outside the window; what is left is a crawl.
+ assert rate is not None and rate < 1.0
+
+ def test_a_crawling_lane_is_reportable_once_the_window_is_full(self) -> None:
+ """The slower a lane runs, the MORE it needs an estimate.
+
+ Requiring a fixed number of completed items before answering made the
+ floor scale with the slowness: a lane doing two items a quarter-hour
+ would have stayed "still measuring" forever, which is the one case a
+ backlog duration is genuinely wanted for.
+ """
+ tracker = ThroughputTracker(window_s=300.0)
+ tracker.sample(0.0, 0)
+ tracker.sample(300.0, 2)
+ rate = tracker.rate_per_second()
+ assert rate is not None and 0 < rate < 0.01
+
+ def test_a_thin_sample_stays_silent_while_the_window_fills(self) -> None:
+ """Before a full window, a couple of items is still not a rate."""
+ tracker = ThroughputTracker(window_s=900.0)
+ tracker.sample(0.0, 0)
+ tracker.sample(120.0, 2)
+ assert tracker.rate_per_second() is None
+
+
+class TestBuildThroughput:
+ @staticmethod
+ def _snapshot(rate: float | None, items: int = 500) -> dict[str, object]:
+ return {"rate_per_second": rate, "measured_s": 600.0, "measured_items": items}
+
+ def test_eta_is_backlog_over_measured_rate(self) -> None:
+ payload = build_throughput(
+ embed=self._snapshot(0.5),
+ distill=self._snapshot(0.1),
+ embed_backlog=1800,
+ distill_backlog=360,
+ )
+ assert payload["embed"]["eta_seconds"] == 3600
+ assert payload["distill"]["eta_seconds"] == 3600
+ # An item is not finished until it is summarised, and the stages run
+ # one after the other rather than side by side.
+ assert payload["eta_seconds"] == 7200
+
+ def test_a_stalled_lane_gets_no_completion_time(self) -> None:
+ """"Never at this rate" is not a duration and must not render as one."""
+ payload = build_throughput(
+ embed=self._snapshot(0.0, items=0),
+ distill=self._snapshot(0.0, items=0),
+ embed_backlog=200_000,
+ distill_backlog=200_000,
+ )
+ assert payload["embed"]["eta_seconds"] is None
+ assert payload["embed"]["stalled"] is True
+ assert payload["eta_seconds"] is None
+
+ def test_an_unmeasured_lane_leaves_the_total_open(self) -> None:
+ """Half a measurement must not shorten the estimate to half the job.
+
+ This is the live 2026-07-27 shape: embedding measurable, summarising
+ parked at zero for the whole rebuild. Reporting the embedding half as
+ the total is the same optimism the module exists to remove.
+ """
+ payload = build_throughput(
+ embed=self._snapshot(0.65),
+ distill=self._snapshot(None),
+ embed_backlog=232_163,
+ distill_backlog=235_915,
+ distill_paused_reason="summaries are paused while the index rebuilds",
+ )
+ assert payload["embed"]["eta_seconds"] is not None
+ assert payload["distill"]["eta_seconds"] is None
+ assert payload["eta_seconds"] is None
+ assert "rebuild" in payload["distill"]["paused_reason"]
+
+ def test_an_empty_backlog_is_done_not_unknown(self) -> None:
+ payload = build_throughput(
+ embed=self._snapshot(0.5),
+ distill=self._snapshot(0.5),
+ embed_backlog=0,
+ distill_backlog=0,
+ )
+ assert payload["eta_seconds"] == 0.0
+ assert payload["embed"]["stalled"] is False
+
+
+class TestFormatDuration:
+ def test_none_formats_to_nothing(self) -> None:
+ assert format_duration(None) == ""
+
+ def test_the_live_backlog_reads_in_days(self) -> None:
+ """232 163 items at the measured 0.65/s — the number that started this."""
+ assert "days" in format_duration(232_163 / 0.65)
+
+ def test_buckets_climb_with_the_duration(self) -> None:
+ assert format_duration(30) == "under a minute"
+ assert "minutes" in format_duration(600)
+ assert "hours" in format_duration(6 * 3600)
+ assert "days" in format_duration(4 * 86_400)
+ assert "weeks" in format_duration(30 * 86_400)
+ assert "months" in format_duration(200 * 86_400)