Skip to content
Python

feat(gui): Settings ▸ Machine ▸ Observability (OB-6, UX-059 ob6 and ob6b)

Devika Verma685681a672ed
diff --git a/coworker/server/app.py b/coworker/server/app.py
index 13ce8a78..9d98bd4c 100644
--- a/coworker/server/app.py
+++ b/coworker/server/app.py
@@ -3343,8 +3343,9 @@ def create_app(manager: SessionManager) -> FastAPI:
m.get("role") in ("user", "assistant") or m.get("kind") == "export_notice"
for m in engine.messages
):
+ # Not saved here: an empty draft session must not appear in the sidebar. The
+ # notice is kept on the engine and saved with the session's first turn.
engine._append_notice("export_notice", export_notice)
- manager.save(session_id, engine, touch=False)
await ws.send_json({"type": "export_notice", "data": {"text": export_notice}})
inbound_times: deque[float] = deque()
diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsx
index 5ade286c..39729a63 100644
--- a/surfaces/gui/src/App.tsx
+++ b/surfaces/gui/src/App.tsx
@@ -1096,6 +1096,11 @@ export function App() {
else if (d.status === "truncated")
setItems((p) => [...p, { kind: "notice", tone: "warn", text: d.text || t("app.notice.truncated") }]);
break;
+ case "export_notice":
+ // OB-6: the company's policy sends this machine's content somewhere; a new session
+ // says what goes where (server-authored, persisted like mode_notice).
+ setItems((p) => [...p, { kind: "notice", tone: "info", text: d.text || "" }]);
+ break;
case "mode_notice":
if (["interactive", "auto-approve", "bypass-approvals", "plan", "discuss", "custom"].includes(d.mode)) setMode(d.mode);
// Server-authored + persisted (owner ruling 2026-08-24): the Auto-Approve
diff --git a/surfaces/gui/src/api.ts b/surfaces/gui/src/api.ts
index 9b9bc283..45e3ac24 100644
--- a/surfaces/gui/src/api.ts
+++ b/surfaces/gui/src/api.ts
@@ -2347,6 +2347,96 @@ export async function setSandboxSettings(
return res.json();
}
+// OB-6: Settings ▸ Machine ▸ Observability — where recordings go and what they include, on
+// the machine that ran the work. Keys and header values are write-only: answers carry
+// masked hints ("pk-lf-••••••••3a91"), never a value.
+export type ObservabilityDestination =
+ | { kind: "off" }
+ | { kind: "langfuse"; host: string }
+ | { kind: "otlp"; url: string; header_names: string[] };
+export interface ObservabilityInclude {
+ messages: boolean;
+ tool_io: boolean;
+ context: boolean;
+ names: boolean;
+}
+export interface ObservabilitySettings {
+ record: boolean;
+ retention_days: 7 | 30 | 90;
+ destination: ObservabilityDestination;
+ include: ObservabilityInclude;
+ secrets: { public_key?: string; secret_key?: string; headers?: Record<string, string> };
+ managed: { by: string; name: string; at: string } | null;
+ notice: string | null;
+}
+export interface ObservabilitySecretsIn {
+ public_key?: string;
+ secret_key?: string;
+ headers?: Record<string, string>;
+}
+export interface ObservabilityStatus {
+ state: "off" | "sending" | "retrying" | "failed" | "managed";
+ last_sent_at: number | null; // seconds
+ sent: number;
+ sent_today: number;
+ failed: number;
+ dropped: number;
+ last_error: string;
+}
+
+export async function getObservabilitySettings(machineId?: string | null): Promise<ObservabilitySettings> {
+ const res = await fetch(`${engineBase(machineId)}/v1/observability/settings`);
+ return res.json();
+}
+
+export async function setObservabilitySettings(
+ patch: Partial<Pick<ObservabilitySettings, "record" | "retention_days" | "destination">> & {
+ include?: Partial<ObservabilityInclude>;
+ secrets?: ObservabilitySecretsIn;
+ },
+ machineId?: string | null,
+): Promise<{ ok: boolean; error?: string } & Partial<ObservabilitySettings>> {
+ const res = await fetch(`${engineBase(machineId)}/v1/observability/settings`, {
+ method: "PUT",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(patch),
+ });
+ return res.json();
+}
+
+export async function getObservabilityStatus(machineId?: string | null): Promise<ObservabilityStatus> {
+ const res = await fetch(`${engineBase(machineId)}/v1/observability/status`);
+ return res.json();
+}
+
+export async function sendObservabilityTest(
+ machineId?: string | null,
+): Promise<{ ok: boolean; status: number; text: string; ms?: number }> {
+ const res = await fetch(`${engineBase(machineId)}/v1/observability/test`, { method: "POST" });
+ return res.json();
+}
+
+/** One session's recording, content included, as a file the browser saves. */
+export async function downloadSessionRecording(sessionId: string, machineId?: string | null): Promise<boolean> {
+ const res = await fetch(`${engineBase(machineId)}/v1/sessions/${encodeURIComponent(sessionId)}/recording`);
+ if (!res.ok) return false;
+ const url = URL.createObjectURL(await res.blob());
+ const a = document.createElement("a");
+ a.href = url;
+ a.download = `recording-${sessionId.replace(/[^A-Za-z0-9_.-]/g, "_")}.json`;
+ document.body.appendChild(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 1000);
+ return true;
+}
+
+/** A machine's sessions (id and title), for picking one recording to save. */
+export async function getMachineSessions(machineId?: string | null): Promise<{ session_id: string; title?: string | null }[]> {
+ const res = await fetch(`${engineBase(machineId)}/v1/sessions`);
+ return (await res.json()).sessions ?? [];
+}
+
// OPE-207: the readiness checklist behind Settings ▸ Sandbox (the rows `openworker machine
// sandbox status` prints, with a key and whether the app may fix each one itself), and
// the guided setup job that walks it on the machine where sessions run.
diff --git a/surfaces/gui/src/components/ObservabilitySection.test.tsx b/surfaces/gui/src/components/ObservabilitySection.test.tsx
new file mode 100644
index 00000000..0ac18c02
--- /dev/null
+++ b/surfaces/gui/src/components/ObservabilitySection.test.tsx
@@ -0,0 +1,162 @@
+// Settings ▸ Machine ▸ Observability (OB-6, mocks UX-059 ob6 and ob6b). The page reads the
+// machine's settings and status, writes back what changes, sends keys once and never shows
+// them again (only the masked hints the machine returns), reports a refused key in plain
+// words, and turns read-only when a company policy manages it.
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import i18n from "i18next";
+import zh from "../locales/zh.json";
+
+const base = {
+ record: true,
+ retention_days: 30,
+ destination: { kind: "off" },
+ include: { messages: false, tool_io: false, context: false, names: false },
+ secrets: {},
+ managed: null,
+ notice: null,
+};
+let snapshot: any = { ...base };
+let status: any = { state: "off", last_sent_at: null, sent: 0, sent_today: 0, failed: 0, dropped: 0, last_error: "" };
+
+// Like the machine: keys go in, masked hints come back, a managed page refuses changes.
+const setObservabilitySettings = vi.fn(async (patch: any) => {
+ if (snapshot.managed && ("include" in patch || "destination" in patch)) return { ok: false, error: "Managed by Acme Corp" };
+ const next = { ...snapshot, ...patch, include: { ...snapshot.include, ...(patch.include || {}) } };
+ delete next.secrets;
+ next.secrets = { ...snapshot.secrets };
+ if (patch.secrets?.public_key) next.secrets.public_key = "pk-lf-••••••••3a91";
+ if (patch.secrets?.secret_key) next.secrets.secret_key = "sk-lf-••••••••";
+ snapshot = next;
+ return { ok: true, ...snapshot };
+});
+const sendObservabilityTest = vi.fn(async () => ({ ok: false, status: 401, text: "The destination refused the key", ms: 12 }));
+
+vi.mock("../api", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("../api")>();
+ return {
+ ...actual,
+ getObservabilitySettings: vi.fn(async () => snapshot),
+ setObservabilitySettings: (patch: any) => setObservabilitySettings(patch),
+ getObservabilityStatus: vi.fn(async () => status),
+ sendObservabilityTest: () => sendObservabilityTest(),
+ getMachineSessions: vi.fn(async () => [{ session_id: "s1", title: "Quarterly notes" }]),
+ downloadSessionRecording: vi.fn(async () => true),
+ };
+});
+
+import { ObservabilitySection } from "./ObservabilitySection";
+
+const lastPatch = () => {
+ const calls = setObservabilitySettings.mock.calls;
+ return calls[calls.length - 1]?.[0];
+};
+
+describe("Settings ▸ Observability", () => {
+ beforeEach(() => {
+ snapshot = { ...base };
+ status = { state: "off", last_sent_at: null, sent: 0, sent_today: 0, failed: 0, dropped: 0, last_error: "" };
+ setObservabilitySettings.mockClear();
+ sendObservabilityTest.mockClear();
+ });
+ afterEach(async () => {
+ cleanup();
+ await i18n.changeLanguage("en");
+ });
+
+ it("Off by default: nothing leaves, the content switches are off, the status says so", async () => {
+ render(<ObservabilitySection />);
+ await screen.findByTestId("obs-section");
+ expect(screen.getByTestId("obs-dest-off").getAttribute("aria-pressed")).toBe("true");
+ expect(screen.getByText("Nothing leaves this machine")).toBeTruthy();
+ for (const k of ["messages", "tool_io", "context", "names"]) {
+ expect(within(screen.getByTestId(`obs-include-${k}`)).getByRole("switch").getAttribute("aria-checked")).toBe("false");
+ }
+ expect(screen.getByTestId("obs-keep-30").getAttribute("aria-checked")).toBe("true");
+ await waitFor(() => expect(screen.getByTestId("obs-status-pill").textContent).toBe("Off"));
+ expect(screen.getByText(/Never sent, whatever is on/)).toBeTruthy();
+ });
+
+ it("Langfuse: the address and keys are saved once; keys come back masked, never shown", async () => {
+ render(<ObservabilitySection />);
+ await screen.findByTestId("obs-section");
+ fireEvent.click(screen.getByTestId("obs-dest-langfuse"));
+ expect(setObservabilitySettings).not.toHaveBeenCalled(); // no address yet
+ const card = screen.getByTestId("obs-langfuse");
+ fireEvent.change(within(card).getByLabelText("Langfuse address"), { target: { value: "https://langfuse.acme.internal" } });
+ fireEvent.change(within(card).getByLabelText("Public key"), { target: { value: "pk-lf-1234567890ab3a91" } });
+ fireEvent.change(within(card).getByLabelText("Secret key"), { target: { value: "sk-lf-very-secret" } });
+ fireEvent.blur(within(card).getByLabelText("Secret key"));
+ await waitFor(() =>
+ expect(lastPatch()).toEqual({
+ destination: { kind: "langfuse", host: "https://langfuse.acme.internal" },
+ secrets: { public_key: "pk-lf-1234567890ab3a91", secret_key: "sk-lf-very-secret" },
+ }),
+ );
+ // The fields empty again; the hints are what the machine sent back.
+ await waitFor(() => expect((within(card).getByLabelText("Secret key") as HTMLInputElement).value).toBe(""));
+ expect((within(card).getByLabelText("Public key") as HTMLInputElement).placeholder).toBe("pk-lf-••••••••3a91");
+ expect((within(card).getByLabelText("Secret key") as HTMLInputElement).placeholder).toContain("sk-lf-••••••••");
+ expect(document.body.textContent).not.toContain("sk-lf-very-secret");
+ // A wrong key reads plainly.
+ fireEvent.click(within(card).getByTestId("obs-test"));
+ await waitFor(() => expect(screen.getByTestId("obs-test-result").textContent).toBe("The destination refused the key"));
+ });
+
+ it("a switch writes only its own field; the metadata row stays locked", async () => {
+ snapshot = { ...base, destination: { kind: "otlp", url: "https://otel.example.com/v1/traces", header_names: ["x-team"] },
+ secrets: { headers: { "x-team": "••••••••" } } };
+ status = { state: "sending", last_sent_at: Date.now() / 1000 - 12, sent: 2000, sent_today: 1284, failed: 0, dropped: 0, last_error: "" };
+ render(<ObservabilitySection />);
+ await screen.findByTestId("obs-otlp");
+ fireEvent.click(within(screen.getByTestId("obs-include-tool_io")).getByRole("switch"));
+ await waitFor(() => expect(lastPatch()).toEqual({ include: { tool_io: true } }));
+ const locked = within(screen.getByTestId("obs-include-metadata")).getByRole("switch") as HTMLButtonElement;
+ expect(locked.disabled && locked.getAttribute("aria-checked") === "true").toBe(true);
+ await waitFor(() => expect(screen.getByTestId("obs-status").textContent).toContain("Today: 1,284 steps sent · 0 failed · 0 dropped."));
+ expect(screen.getByTestId("obs-status").textContent).toContain("Last sent 12 seconds ago");
+ expect(screen.getByTestId("obs-status-pill").textContent).toBe("Sending");
+ });
+
+ it("a refused key shows in the status, and Record steps off is one switch", async () => {
+ snapshot = { ...base, destination: { kind: "langfuse", host: "https://cloud.langfuse.com" } };
+ status = { state: "failed", last_sent_at: null, sent: 0, sent_today: 0, failed: 1, dropped: 0, last_error: "The destination refused the key" };
+ render(<ObservabilitySection />);
+ await screen.findByTestId("obs-langfuse");
+ await waitFor(() => expect(screen.getByTestId("obs-status-error").textContent).toBe("The destination refused the key"));
+ expect(screen.getByTestId("obs-status-pill").textContent).toBe("Failed");
+ fireEvent.click(within(screen.getByTestId("obs-record")).getByRole("switch"));
+ await waitFor(() => expect(lastPatch()).toEqual({ record: false }));
+ fireEvent.click(screen.getByTestId("obs-keep-7"));
+ await waitFor(() => expect(lastPatch()).toEqual({ retention_days: 7 }));
+ });
+
+ it("managed by a company policy: read-only, says who set it and what goes where", async () => {
+ snapshot = { ...base, destination: { kind: "langfuse", host: "https://langfuse.acme.internal" },
+ include: { messages: true, tool_io: false, context: false, names: true },
+ managed: { by: "Acme Corp", name: "Security team default", at: "2026-10-12" } };
+ render(<ObservabilitySection />);
+ await screen.findByTestId("obs-managed");
+ expect(screen.getByText("Managed by Acme Corp")).toBeTruthy();
+ expect(screen.getByText("Langfuse · langfuse.acme.internal")).toBeTruthy();
+ expect(screen.getByText('Set by policy "Security team default" · 2026-10-12')).toBeTruthy();
+ const switches = screen.getAllByRole("switch") as HTMLButtonElement[];
+ expect(switches.every((s) => s.disabled)).toBe(true);
+ expect(switches.map((s) => s.getAttribute("aria-checked"))).toEqual(["true", "true", "false", "false", "true"]);
+ expect(screen.getByTestId("obs-managed-callout").textContent).toBe(
+ "Your messages and the AI's answers and session and user names from this machine are sent to Acme Corp's Langfuse. A small notice appears in each new session.",
+ );
+ expect(screen.queryByTestId("obs-dest-langfuse")).toBeNull();
+ expect(screen.queryByLabelText("Secret key")).toBeNull();
+ });
+
+ it("reads in Chinese", async () => {
+ i18n.addResourceBundle("zh", "translation", zh, true, true);
+ await i18n.changeLanguage("zh");
+ render(<ObservabilitySection />);
+ await screen.findByTestId("obs-section");
+ expect(screen.getByText("把记录发送到")).toBeTruthy();
+ expect(screen.getByText("不会有任何内容离开这台机器")).toBeTruthy();
+ expect(screen.getByTestId("obs-keep-30").textContent).toBe("30 天");
+ });
+});
diff --git a/surfaces/gui/src/components/ObservabilitySection.tsx b/surfaces/gui/src/components/ObservabilitySection.tsx
new file mode 100644
index 00000000..2d0c03c7
--- /dev/null
+++ b/surfaces/gui/src/components/ObservabilitySection.tsx
@@ -0,0 +1,589 @@
+// Settings ▸ Machine ▸ Observability (OB-6, mocks UX-059 ob6 and ob6b; phase-2 design §10).
+// Four parts: On this machine (record steps, keep for, save one session's recording), Send
+// recordings to (Off, Langfuse, an OpenTelemetry endpoint), What to include, and Status.
+// Everything is the chosen machine's, read and written through /v1/observability/* (the
+// machine proxy for a remote one). Keys and header values are write-only: the page shows
+// the masked hints the machine sends back, and an empty field never clears a stored key.
+// When a company policy sets it, the page is read-only and says who set it (ob6b).
+import { useEffect, useRef, useState } from "react";
+import { useTranslation } from "react-i18next";
+import {
+ downloadSessionRecording,
+ getMachineSessions,
+ getObservabilitySettings,
+ getObservabilityStatus,
+ sendObservabilityTest,
+ setObservabilitySettings,
+ type Machine,
+ type ObservabilityInclude,
+ type ObservabilitySettings,
+ type ObservabilityStatus,
+} from "../api";
+import { Toggle } from "./Toggle";
+import { PanelHead } from "./IntegrationsView";
+
+const CARD = "rounded-xl2 border border-line bg-panel";
+const SEC = "text-meta font-medium text-muted mt-6 mb-2";
+const ROW = "flex items-center gap-4 px-4 py-3.5";
+const ROW_TITLE = "text-ui font-medium text-ink";
+const ROW_SUB = "text-meta text-muted mt-0.5 leading-relaxed";
+const INPUT =
+ "flex-1 min-w-0 px-3 py-2 rounded-lg border border-line bg-paper text-ui text-ink font-mono outline-none focus:border-accent placeholder:text-faint";
+const BTN_SMALL = "text-meta px-2.5 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0 disabled:opacity-40";
+const PILL = "inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-meta border shrink-0";
+const PILL_TONE = {
+ ok: "bg-okSoft text-ok border-okLine",
+ warn: "bg-warnSoft text-warnInk border-transparent",
+ bad: "bg-dangerSoft text-danger border-transparent",
+ plain: "bg-chrome text-muted border-line",
+};
+const MAX_HEADERS = 8;
+type Kind = "off" | "langfuse" | "otlp";
+const INCLUDE_ROWS: (keyof ObservabilityInclude)[] = ["messages", "tool_io", "context", "names"];
+
+function Pill({ tone, children, testId }: { tone: keyof typeof PILL_TONE; children: React.ReactNode; testId?: string }) {
+ return (
+ <span className={`${PILL} ${PILL_TONE[tone]}`} data-testid={testId}>
+ {children}
+ </span>
+ );
+}
+
+function hostOf(url: string): string {
+ try {
+ return new URL(url).host || url;
+ } catch {
+ return url;
+ }
+}
+
+export function ObservabilitySection({ machine }: { machine?: Machine | null }) {
+ const { t, i18n } = useTranslation();
+ const mid = machine?.id ?? null;
+ const [cfg, setCfg] = useState<ObservabilitySettings | null>(null);
+ const [status, setStatus] = useState<ObservabilityStatus | null>(null);
+ const [loadFailed, setLoadFailed] = useState(false);
+ const [error, setError] = useState("");
+ // The card shown under "Send recordings to": the saved choice, or one being filled in.
+ const [kind, setKind] = useState<Kind>("off");
+ const [host, setHost] = useState("");
+ const [publicKey, setPublicKey] = useState("");
+ const [secretKey, setSecretKey] = useState("");
+ const [url, setUrl] = useState("");
+ const [headers, setHeaders] = useState<{ name: string; value: string }[]>([]);
+ const [testing, setTesting] = useState(false);
+ const [test, setTest] = useState<{ ok: boolean; status: number; text: string; ms?: number } | null>(null);
+ const [saving, setSaving] = useState<{ sessions: { session_id: string; title?: string | null }[]; pick: string } | null>(null);
+ const [now, setNow] = useState(() => Date.now());
+ const loaded = useRef(false);
+
+ const adopt = (s: ObservabilitySettings) => {
+ setCfg(s);
+ const d = s.destination;
+ if (!loaded.current || d.kind !== "off") setKind(d.kind);
+ if (d.kind === "langfuse") setHost(d.host);
+ if (d.kind === "otlp") {
+ setUrl(d.url);
+ setHeaders(d.header_names.map((name) => ({ name, value: "" })));
+ }
+ loaded.current = true;
+ };
+
+ useEffect(() => {
+ loaded.current = false;
+ getObservabilitySettings(mid)
+ .then(adopt)
+ .catch(() => setLoadFailed(true));
+ }, [mid]); // eslint-disable-line react-hooks/exhaustive-deps
+
+ // The status card follows the machine while the page is open.
+ useEffect(() => {
+ let live = true;
+ const load = () =>
+ getObservabilityStatus(mid)
+ .then((s) => live && setStatus(s))
+ .catch(() => {});
+ load();
+ const timer = window.setInterval(() => {
+ load();
+ setNow(Date.now());
+ }, 5000);
+ return () => {
+ live = false;
+ window.clearInterval(timer);
+ };
+ }, [mid]);
+
+ const save = async (patch: Parameters<typeof setObservabilitySettings>[0]) => {
+ const res = await setObservabilitySettings(patch, mid);
+ if (!res.ok) {
+ setError(res.error || t("obs.error_save"));
+ return false;
+ }
+ setError("");
+ adopt(res as ObservabilitySettings);
+ getObservabilityStatus(mid).then(setStatus).catch(() => {});
+ return true;
+ };
+
+ if (loadFailed) {
+ return (
+ <section>
+ <PanelHead title={t("obs.title")} sub={t("obs.sub")} />
+ <p className="text-ui text-muted">{t("obs.load_failed")}</p>
+ </section>
+ );
+ }
+ if (!cfg) return null;
+
+ const managed = cfg.managed;
+ const saved = cfg.destination;
+ const validUrl = (v: string) => /^https?:\/\/[^/\s]+/.test(v.trim());
+
+ // -- Send recordings to ----------------------------------------------------------------
+ const choose = (k: Kind) => {
+ setKind(k);
+ setTest(null);
+ if (k === "off") void save({ destination: { kind: "off" } });
+ else if (k === "langfuse" && validUrl(host)) void save({ destination: { kind: "langfuse", host: host.trim() } });
+ else if (k === "otlp" && validUrl(url))
+ void save({ destination: { kind: "otlp", url: url.trim(), header_names: headers.map((h) => h.name).filter(Boolean) } });
+ };
+
+ const saveLangfuse = async () => {
+ if (!validUrl(host)) {
+ if (host.trim()) setError(t("obs.error_address"));
+ return false;
+ }
+ const secrets: { public_key?: string; secret_key?: string } = {};
+ if (publicKey.trim()) secrets.public_key = publicKey.trim();
+ if (secretKey.trim()) secrets.secret_key = secretKey.trim();
+ const changed = saved.kind !== "langfuse" || saved.host !== host.trim() || Object.keys(secrets).length > 0;
+ if (!changed) return true;
+ const ok = await save({ destination: { kind: "langfuse", host: host.trim() }, ...(Object.keys(secrets).length ? { secrets } : {}) });
+ if (ok) {
+ setPublicKey("");
+ setSecretKey("");
+ }
+ return ok;
+ };
+
+ const saveOtlp = async (rows = headers) => {
+ if (!validUrl(url)) {
+ if (url.trim()) setError(t("obs.error_address"));
+ return false;
+ }
+ const names = rows.map((h) => h.name.trim()).filter(Boolean);
+ const values = Object.fromEntries(rows.filter((h) => h.name.trim() && h.value).map((h) => [h.name.trim(), h.value]));
+ const ok = await save({
+ destination: { kind: "otlp", url: url.trim(), header_names: names },
+ ...(Object.keys(values).length ? { secrets: { headers: values } } : {}),
+ });
+ if (ok) setHeaders(names.map((name) => ({ name, value: "" })));
+ return ok;
+ };
+
+ const runTest = async () => {
+ setTesting(true);
+ setTest(null);
+ const ready = kind === "langfuse" ? await saveLangfuse() : kind === "otlp" ? await saveOtlp() : false;
+ if (ready) {
+ try {
+ setTest(await sendObservabilityTest(mid));
+ } catch {
+ setTest({ ok: false, status: 0, text: t("obs.test.unreachable") });
+ }
+ }
+ setTesting(false);
+ };
+
+ const testPill = test ? (
+ test.ok ? (
+ <Pill tone="ok" testId="obs-test-result">
+ ✓ {t(kind === "langfuse" ? "obs.test.ok_langfuse" : "obs.test.ok_otlp", { ms: test.ms ?? 0 })}
+ </Pill>
+ ) : (
+ <Pill tone="bad" testId="obs-test-result">
+ {test.status === 401 || test.status === 403 ? t("obs.refused_key") : test.text}
+ </Pill>
+ )
+ ) : null;
+
+ // -- Status --------------------------------------------------------------------------------
+ const relative = (sec: number) => {
+ const diff = Math.round(sec - now / 1000);
+ const rtf = new Intl.RelativeTimeFormat(i18n.language === "zh" ? "zh" : "en", { numeric: "auto" });
+ const abs = Math.abs(diff);
+ if (abs < 60) return rtf.format(diff, "second");
+ if (abs < 3600) return rtf.format(Math.round(diff / 60), "minute");
+ if (abs < 86400) return rtf.format(Math.round(diff / 3600), "hour");
+ return rtf.format(Math.round(diff / 86400), "day");
+ };
+ const fmt = (n: number) => n.toLocaleString(i18n.language === "zh" ? "zh-CN" : "en-US");
+ const statusCard = (
+ <div className={CARD} data-testid="obs-status">
+ <div className={ROW}>
+ <div className="flex-1 min-w-0">
+ <div className={ROW_TITLE}>
+ {!status || status.state === "off"
+ ? t("obs.status.off_title")
+ : status.last_sent_at
+ ? t("obs.status.last_sent", { when: relative(status.last_sent_at) })
+ : t("obs.status.nothing_yet")}
+ </div>
+ <div className={ROW_SUB}>
+ {!status || status.state === "off"
+ ? t("obs.status.off_sub")
+ : t("obs.status.counts", { sent: fmt(status.sent_today), failed: fmt(status.failed), dropped: fmt(status.dropped) }) +
+ " " +
+ (status.state === "failed"
+ ? t("obs.status.failed_sub")
+ : t("obs.status.resumes"))}
+ </div>
+ {status && (status.state === "retrying" || status.state === "failed") && status.last_error ? (
+ <div className="text-meta text-danger mt-1" data-testid="obs-status-error">
+ {status.last_error === "The destination refused the key" ? t("obs.refused_key") : status.last_error === "Address not found" ? t("obs.not_found") : status.last_error}
+ </div>
+ ) : null}
+ </div>
+ {status ? (
+ <Pill
+ tone={status.state === "sending" || status.state === "managed" ? "ok" : status.state === "retrying" ? "warn" : status.state === "failed" ? "bad" : "plain"}
+ testId="obs-status-pill"
+ >
+ {t(`obs.state.${status.state}`)}
+ </Pill>
+ ) : null}
+ </div>
+ </div>
+ );
+
+ // -- The company manages it (ob6b) -------------------------------------------------------------
+ if (managed) {
+ const destName = saved.kind === "langfuse" ? "Langfuse" : saved.kind === "otlp" ? t("obs.dest.otlp") : t("obs.dest.off");
+ const place = saved.kind === "langfuse" ? hostOf(saved.host) : saved.kind === "otlp" ? hostOf(saved.url) : "";
+ const items = INCLUDE_ROWS.filter((k) => cfg.include[k]).map((k) => t(`obs.callout_item.${k}`));
+ const listed = items.length > 1 ? items.slice(0, -1).join(t("obs.list_sep")) + t("obs.list_and") + items[items.length - 1] : items[0] ?? "";
+ const sentWhat = listed.charAt(0).toUpperCase() + listed.slice(1);
+ return (
+ <section data-testid="obs-section">
+ <h2 className="text-title font-semibold tracking-tight mb-3">{t("obs.title")}</h2>
+ <div className="flex gap-3 items-start rounded-xl2 border border-line bg-chrome px-4 py-3.5" data-testid="obs-managed">
+ <svg viewBox="0 0 24 24" className="w-[18px] h-[18px] mt-0.5 shrink-0 text-muted" fill="none" stroke="currentColor" strokeWidth="1.7" aria-hidden="true">
+ <path d="M12 3l8 4v5c0 5-3.5 8-8 9-4.5-1-8-4-8-9V7z" />
+ </svg>
+ <div>
+ <div className="text-ui font-medium text-ink">{t("obs.managed.by", { by: managed.by })}</div>
+ <div className="text-ui text-muted mt-0.5">{t("obs.managed.sub")}</div>
+ </div>
+ </div>
+ <div className={SEC}>{t("obs.sec.send_to")}</div>
+ <div className={CARD}>
+ <div className={ROW}>
+ <div className="flex-1 min-w-0">
+ <div className={ROW_TITLE}>{place ? `${destName} · ${place}` : destName}</div>
+ <div className={ROW_SUB}>
+ {[managed.name ? t("obs.managed.set_by", { name: managed.name }) : t("obs.managed.set_by_policy"), managed.at].filter(Boolean).join(" · ")}
+ </div>
+ </div>
+ <Pill tone="plain">🔒 {t("obs.managed.locked")}</Pill>
+ </div>
+ </div>
+ <div className={SEC}>{t("obs.sec.included")}</div>
+ <div className={`${CARD} divide-y divide-line`}>
+ <div className={ROW}>
+ <div className={`flex-1 ${ROW_TITLE}`}>{t("obs.include.metadata_short")}</div>
+ <Toggle checked={saved.kind !== "off"} onChange={() => {}} disabled />
+ </div>
+ {INCLUDE_ROWS.map((k) => (
+ <div key={k} className={ROW}>
+ <div className="flex-1 min-w-0">
+ <div className={ROW_TITLE}>{t(`obs.include.${k}`)}</div>
+ {k === "names" && cfg.include.names ? <div className={ROW_SUB}>{t("obs.include.names_on")}</div> : null}
+ </div>
+ <Toggle checked={cfg.include[k]} onChange={() => {}} disabled />
+ </div>
+ ))}
+ </div>
+ {items.length && saved.kind !== "off" ? (
+ <div className="mt-3 rounded-xl2 bg-accentSoft text-accent text-ui px-4 py-3" data-testid="obs-managed-callout">
+ {t("obs.managed.callout", { what: sentWhat, by: managed.by, where: destName })}
+ </div>
+ ) : null}
+ <div className={SEC}>{t("obs.sec.status")}</div>
+ {statusCard}
+ </section>
+ );
+ }
+
+ // -- The person's own settings (ob6) -------------------------------------------------------------
+ const destCard = (k: Kind, title: string, sub: string) => (
+ <button
+ type="button"
+ key={k}
+ data-testid={`obs-dest-${k}`}
+ aria-pressed={kind === k}
+ onClick={() => choose(k)}
+ className={
+ "text-left rounded-xl2 border px-4 py-3.5 transition-colors " +
+ (kind === k ? "border-accent bg-accentSoft ring-1 ring-accent" : "border-line bg-panel hover:border-lineStrong")
+ }
+ >
+ <div className="text-ui font-medium text-ink">{title}</div>
+ <div className="text-meta text-muted mt-0.5 leading-relaxed">{sub}</div>
+ </button>
+ );
+ const field = (label: string, input: React.ReactNode) => (
+ <div className="flex items-center gap-4 px-4 py-2.5">
+ <div className="w-44 shrink-0 text-ui text-ink">{label}</div>
+ {input}
+ </div>
+ );
+ const sendingOn = saved.kind !== "off";
+
+ return (
+ <section data-testid="obs-section">
+ <PanelHead title={t("obs.title")} sub={t("obs.sub")} />
+
+ <div className={SEC}>{t("obs.sec.machine")}</div>
+ <div className={`${CARD} divide-y divide-line`}>
+ <div className={ROW}>
+ <div className="flex-1 min-w-0">
+ <div className={ROW_TITLE}>{t("obs.record.title")}</div>
+ <div className={ROW_SUB}>{cfg.record ? t("obs.record.sub") : t("obs.record.off")}</div>
+ </div>
+ <span data-testid="obs-record">
+ <Toggle checked={cfg.record} onChange={(v) => void save({ record: v })} />
+ </span>
+ </div>
+ <div className={ROW}>
+ <div className="flex-1 min-w-0">
+ <div className={ROW_TITLE}>{t("obs.keep.title")}</div>
+ <div className={ROW_SUB}>{t("obs.keep.sub")}</div>
+ </div>
+ <div className="inline-flex rounded-lg border border-line overflow-hidden shrink-0" role="radiogroup" aria-label={t("obs.keep.title")}>
+ {([7, 30, 90] as const).map((d) => (
+ <button
+ key={d}
+ type="button"
+ role="radio"
+ aria-checked={cfg.retention_days === d}
+ data-testid={`obs-keep-${d}`}
+ onClick={() => void save({ retention_days: d })}
+ className={
+ "text-meta px-3 py-1.5 border-l border-line first:border-l-0 " +
+ (cfg.retention_days === d ? "bg-accentSoft text-accent font-medium" : "bg-paper text-muted hover:text-ink")
+ }
+ >
+ {t("obs.keep.days", { count: d })}
+ </button>
+ ))}
+ </div>
+ </div>
+ <div className={ROW}>
+ <div className="flex-1 min-w-0">
+ <div className={ROW_TITLE}>{t("obs.file.title")}</div>
+ <div className={ROW_SUB}>{t("obs.file.sub")}</div>
+ {saving ? (
+ <div className="flex items-center gap-2 mt-2.5">
+ <select
+ className="flex-1 min-w-0 px-2.5 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink"
+ value={saving.pick}
+ aria-label={t("obs.file.pick")}
+ onChange={(e) => setSaving({ ...saving, pick: e.target.value })}
+ >
+ {saving.sessions.length === 0 ? <option value="">{t("obs.file.none")}</option> : null}
+ {saving.sessions.map((s) => (
+ <option key={s.session_id} value={s.session_id}>
+ {s.title || s.session_id}
+ </option>
+ ))}
+ </select>
+ <button
+ type="button"
+ className={BTN_SMALL}
+ disabled={!saving.pick}
+ onClick={() => {
+ void downloadSessionRecording(saving.pick, mid).then((ok) => (ok ? setSaving(null) : setError(t("obs.file.failed"))));
+ }}
+ >
+ {t("obs.file.save")}
+ </button>
+ <button type="button" className={BTN_SMALL} onClick={() => setSaving(null)}>
+ {t("obs.file.cancel")}
+ </button>
+ </div>
+ ) : null}
+ </div>
+ {saving ? null : (
+ <button
+ type="button"
+ className={BTN_SMALL}
+ data-testid="obs-file"
+ onClick={() =>
+ void getMachineSessions(mid)
+ .then((sessions) => setSaving({ sessions, pick: sessions[0]?.session_id ?? "" }))
+ .catch(() => setError(t("obs.file.failed")))
+ }
+ >
+ {t("obs.file.button")}
+ </button>
+ )}
+ </div>
+ </div>
+
+ <div className={SEC}>{t("obs.sec.send_to")}</div>
+ <div className="grid grid-cols-3 gap-2.5">
+ {destCard("off", t("obs.dest.off"), t("obs.dest.off_sub"))}
+ {destCard("langfuse", "Langfuse", t("obs.dest.langfuse_sub"))}
+ {destCard("otlp", t("obs.dest.otlp"), t("obs.dest.otlp_sub"))}
+ </div>
+ {!cfg.record && kind !== "off" ? <p className="text-meta text-warnInk mt-2">{t("obs.record_off_note")}</p> : null}
+
+ {kind === "langfuse" ? (
+ <div className={`${CARD} mt-2.5 divide-y divide-line`} data-testid="obs-langfuse">
+ {field(
+ t("obs.langfuse.address"),
+ <input
+ className={INPUT}
+ value={host}
+ placeholder="https://cloud.langfuse.com"
+ aria-label={t("obs.langfuse.address")}
+ onChange={(e) => setHost(e.target.value)}
+ onBlur={() => void saveLangfuse()}
+ />,
+ )}
+ {field(
+ t("obs.langfuse.public_key"),
+ <input
+ className={INPUT}
+ value={publicKey}
+ placeholder={cfg.secrets.public_key || "pk-lf-…"}
+ aria-label={t("obs.langfuse.public_key")}
+ autoComplete="off"
+ onChange={(e) => setPublicKey(e.target.value)}
+ onBlur={() => void (publicKey.trim() && saveLangfuse())}
+ />,
+ )}
+ {field(
+ t("obs.langfuse.secret_key"),
+ <input
+ className={INPUT}
+ type="password"
+ value={secretKey}
+ placeholder={(cfg.secrets.secret_key ? cfg.secrets.secret_key + " " : "sk-lf-… ") + t("obs.kept_note")}
+ aria-label={t("obs.langfuse.secret_key")}
+ autoComplete="off"
+ onChange={(e) => setSecretKey(e.target.value)}
+ onBlur={() => void (secretKey.trim() && saveLangfuse())}
+ />,
+ )}
+ {field(
+ "",
+ <div className="flex items-center gap-2 flex-wrap">
+ <button type="button" className={BTN_SMALL} data-testid="obs-test" disabled={testing || !host.trim()} onClick={() => void runTest()}>
+ {testing ? t("obs.test.sending") : t("obs.test.button")}
+ </button>
+ {testPill}
+ </div>,
+ )}
+ </div>
+ ) : kind === "otlp" ? (
+ <div className={`${CARD} mt-2.5 divide-y divide-line`} data-testid="obs-otlp">
+ {field(
+ t("obs.otlp.url"),
+ <input
+ className={INPUT}
+ value={url}
+ placeholder="https://collector.example.com/v1/traces"
+ aria-label={t("obs.otlp.url")}
+ onChange={(e) => setUrl(e.target.value)}
+ onBlur={() => void saveOtlp()}
+ />,
+ )}
+ {headers.map((h, i) => (
+ <div key={i} className="flex items-center gap-2 px-4 py-2.5">
+ <input
+ className={`${INPUT} max-w-[11rem]`}
+ value={h.name}
+ placeholder={t("obs.otlp.header_name")}
+ aria-label={t("obs.otlp.header_name")}
+ onChange={(e) => setHeaders(headers.map((x, j) => (j === i ? { ...x, name: e.target.value } : x)))}
+ onBlur={() => void (h.name.trim() && h.value && saveOtlp())}
+ />
+ <input
+ className={INPUT}
+ type="password"
+ value={h.value}
+ placeholder={(cfg.secrets.headers?.[h.name] || "") + (cfg.secrets.headers?.[h.name] ? " " + t("obs.kept_note") : t("obs.otlp.header_value"))}
+ aria-label={t("obs.otlp.header_value")}
+ autoComplete="off"
+ onChange={(e) => setHeaders(headers.map((x, j) => (j === i ? { ...x, value: e.target.value } : x)))}
+ onBlur={() => void (h.name.trim() && h.value && saveOtlp())}
+ />
+ <button
+ type="button"
+ className={BTN_SMALL}
+ aria-label={t("common.remove")}
+ onClick={() => {
+ const rest = headers.filter((_, j) => j !== i);
+ setHeaders(rest);
+ void saveOtlp(rest);
+ }}
+ >
+ ×
+ </button>
+ </div>
+ ))}
+ <div className="flex items-center gap-2 flex-wrap px-4 py-2.5">
+ <button
+ type="button"
+ className={BTN_SMALL}
+ disabled={headers.length >= MAX_HEADERS}
+ onClick={() => setHeaders([...headers, { name: "", value: "" }])}
+ >
+ {t("obs.otlp.add_header")}
+ </button>
+ <button type="button" className={BTN_SMALL} data-testid="obs-test" disabled={testing || !url.trim()} onClick={() => void runTest()}>
+ {testing ? t("obs.test.sending") : t("obs.test.button")}
+ </button>
+ {testPill}
+ </div>
+ </div>
+ ) : null}
+ {error ? (
+ <p className="text-meta text-danger mt-2" data-testid="obs-error">
+ {error}
+ </p>
+ ) : null}
+
+ <div className={SEC}>{t("obs.sec.include")}</div>
+ <div className={`${CARD} divide-y divide-line`}>
+ <div className={ROW}>
+ <div className="flex-1 min-w-0">
+ <div className={ROW_TITLE}>{t("obs.include.metadata")}</div>
+ <div className={ROW_SUB}>{t("obs.include.metadata_sub")}</div>
+ </div>
+ <span data-testid="obs-include-metadata">
+ <Toggle checked={sendingOn} onChange={() => {}} disabled title={t("obs.include.metadata_locked")} />
+ </span>
+ </div>
+ {INCLUDE_ROWS.map((k) => (
+ <div key={k} className={ROW}>
+ <div className="flex-1 min-w-0">
+ <div className={ROW_TITLE}>{t(`obs.include.${k}`)}</div>
+ <div className={ROW_SUB}>{t(`obs.include.${k}_sub`)}</div>
+ </div>
+ <span data-testid={`obs-include-${k}`}>
+ <Toggle checked={cfg.include[k]} onChange={(v) => void save({ include: { [k]: v } })} />
+ </span>
+ </div>
+ ))}
+ </div>
+ <p className="text-meta text-faint mt-2 leading-relaxed">{t("obs.never_sent")}</p>
+
+ <div className={SEC}>{t("obs.sec.status")}</div>
+ {statusCard}
+ </section>
+ );
+}
diff --git a/surfaces/gui/src/components/SettingsView.tsx b/surfaces/gui/src/components/SettingsView.tsx
index eda3b60c..c9f02422 100644
--- a/surfaces/gui/src/components/SettingsView.tsx
+++ b/surfaces/gui/src/components/SettingsView.tsx
@@ -78,6 +78,7 @@ import { MachinesSection } from "./MachinesSection";
import { RemoteConnectorsPanel } from "./RemoteConnectorsPanel";
import { MemorySection } from "./MemorySection";
import { SandboxSection } from "./SandboxSection";
+import { ObservabilitySection } from "./ObservabilitySection";
import { CustomizationTab } from "./CustomizationTab";
import { PersonasTab } from "./PersonasTab";
import { SkillsTab } from "./SkillsTab";
@@ -99,6 +100,8 @@ export type SetTab =
| "voice"
| "memory"
| "sandbox"
+ // OB-6: record on or off, keep for, and sending recordings to Langfuse or OpenTelemetry.
+ | "observability"
| "machines"
| "connectors"
// UX-058: the services behind the tools (web search provider + keys, fetch switch).
@@ -132,6 +135,7 @@ type SetIcon =
| "refresh"
| "plug"
| "shield"
+ | "audit"
| "user";
// `labelKey` = the i18n key for the label; tabs without one yet show `label` as is.
type TabDef = { key: SetTab; label: string; labelKey?: string; icon: SetIcon };
@@ -161,6 +165,7 @@ const SET_GROUPS: { name: string; nameKey?: string; scope: "app" | "machine" | "
{ key: "skills", label: "Skills", labelKey: "settings.tab.skills", icon: "book" },
{ key: "memory", label: "Memory", labelKey: "settings.tab.memory", icon: "archive" },
{ key: "sandbox", label: "Sandbox", labelKey: "settingsx.tab.sandbox", icon: "shield" },
+ { key: "observability", label: "Observability", labelKey: "settingsx.tab.observability", icon: "audit" },
{ key: "personas", label: "Coworkers", labelKey: "settings.tab.personas", icon: "sparkle" },
],
},
@@ -407,6 +412,8 @@ export function SettingsView({
/>
) : tab === "sandbox" ? (
<SandboxSection key={scopeId || "local"} machine={scoped} onProviderChanged={onSandboxProviderChanged} />
+ ) : tab === "observability" ? (
+ <ObservabilitySection key={scopeId || "local"} machine={scoped} />
) : tab === "customization" ? (
<CustomizationTab key={scopeId || "local"} machine={scoped} />
) : tab === "machines" ? (
diff --git a/surfaces/gui/src/itemsFromMessages.ts b/surfaces/gui/src/itemsFromMessages.ts
index 9b217e04..c0de5b4e 100644
--- a/surfaces/gui/src/itemsFromMessages.ts
+++ b/surfaces/gui/src/itemsFromMessages.ts
@@ -126,9 +126,10 @@ export function itemsFromMessages(messages: ConversationMessage[]): Item[] {
// the `server` field existed) recover the name from their own text, so old
// transcripts collapse too instead of keeping the wall of stderr.
mcpNoticeItem(m)
- : m.kind === "project_presence"
+ : m.kind === "project_presence" || m.kind === "export_notice"
? // Grant-time pointer (pass 20): the granted folder already has
- // memory/board — informational, one quiet line.
+ // memory/board — informational, one quiet line. The OB-6 notice (a
+ // company policy sends this session's content) reads the same way.
{ kind: "notice", tone: "info", text: m.text || "" }
: m.kind === "reviewer_paused"
? // §8.4 breaker: auto-approve paused itself for the rest of the turn.
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index 17d9d2db..d0f2199b 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -2422,7 +2422,8 @@
"slack": "Slack",
"github": "GitHub",
"machines": "Machines",
- "sandbox": "Sandbox"
+ "sandbox": "Sandbox",
+ "observability": "Observability"
},
"back_to_app": "Back to app",
"machine_scope_aria": "Machine scope",
@@ -3463,5 +3464,117 @@
"overflow_one": "{{count}} call was over the context limit and the conversation was summarised",
"overflow_other": "{{count}} calls were over the context limit and the conversation was summarised"
}
+ },
+ "obs": {
+ "title": "Observability",
+ "sub": "Every step your coworkers take is recorded on this machine so you can see it under Steps. You can also send these recordings to a tool your company uses. They use the OpenTelemetry standard.",
+ "load_failed": "Could not read this machine's observability settings.",
+ "error_save": "Could not save.",
+ "error_address": "Enter an address that starts with http:// or https://.",
+ "list_sep": ", ",
+ "list_and": " and ",
+ "callout_item": {
+ "messages": "your messages and the AI's answers",
+ "tool_io": "tool inputs and results",
+ "context": "the context OpenWorker adds",
+ "names": "session and user names"
+ },
+ "kept_note": "kept with your other keys on this machine",
+ "refused_key": "The destination refused the key",
+ "not_found": "Address not found",
+ "record_off_note": "Recording is off, so nothing is sent.",
+ "never_sent": "Never sent, whatever is on: the model's thinking text, error messages (they hold addresses) and provider-reported cost. Auto-approver verdicts (allowed, blocked, asked you), the reviewer's name and its timings are metadata, so they are always included when sending.",
+ "sec": {
+ "machine": "On this machine",
+ "send_to": "Send recordings to",
+ "include": "What to include when sending",
+ "included": "What is included",
+ "status": "Status"
+ },
+ "record": {
+ "title": "Record steps",
+ "sub": "Needed for Steps, Issues and Usage. About 2.5 MB a day for typical use.",
+ "off": "Off: new sessions are not recorded. Steps, Issues and Usage stay empty for them."
+ },
+ "keep": {
+ "title": "Keep recordings for",
+ "sub": "Older recordings are deleted. Transcripts are not affected. A recording deleted before it was sent counts as dropped.",
+ "days_one": "{{count}} day",
+ "days_other": "{{count}} days"
+ },
+ "file": {
+ "title": "Save a session's recording",
+ "sub": "Everything recorded for one session, content included, as one file. For support or your own records.",
+ "button": "Save…",
+ "pick": "Session",
+ "none": "No sessions yet",
+ "save": "Save file",
+ "cancel": "Cancel",
+ "failed": "Could not save the recording."
+ },
+ "dest": {
+ "off": "Off",
+ "off_sub": "Nothing leaves this machine",
+ "langfuse_sub": "Open source · cloud or self-hosted",
+ "otlp": "OpenTelemetry endpoint",
+ "otlp_sub": "Your own collector, Grafana, Datadog, Phoenix and others"
+ },
+ "langfuse": {
+ "address": "Langfuse address",
+ "public_key": "Public key",
+ "secret_key": "Secret key"
+ },
+ "otlp": {
+ "url": "Traces address (OTLP/HTTP)",
+ "header_name": "Header name",
+ "header_value": "Value",
+ "add_header": "Add a header"
+ },
+ "test": {
+ "button": "Send a test recording",
+ "sending": "Sending…",
+ "ok_langfuse": "Reached Langfuse · {{ms}} ms",
+ "ok_otlp": "Reached the endpoint · {{ms}} ms",
+ "unreachable": "Could not reach this machine."
+ },
+ "include": {
+ "metadata": "Steps, timings, token counts, models and tool names",
+ "metadata_short": "Steps, timings, token counts, models, tool names",
+ "metadata_sub": "Always included while sending. No text from your sessions.",
+ "metadata_locked": "Always included while sending",
+ "messages": "Your messages and the AI's answers",
+ "messages_sub": "What you wrote and what the AI wrote back. Tool inputs and results inside the conversation stay out unless the next switch is on. Cut to 8 KB each; keys and tokens are masked.",
+ "tool_io": "Tool inputs and results",
+ "tool_io_sub": "Commands, file contents, command output and connector data. With the switch above also on: the auto-approver's reasons and what it was shown, and summaries (they quote tool content).",
+ "context": "Context added by OpenWorker",
+ "context_sub": "The system prompt, the tool list, and the context added to each turn (folders, skills menu, mode notes).",
+ "names": "Session and user names",
+ "names_sub": "The session's title, who answered each card, and this machine's name. Off: none of these are sent.",
+ "names_on": "The session's title, who answered each card, and this machine's name are sent."
+ },
+ "status": {
+ "off_title": "Not sending",
+ "off_sub": "Choose where to send recordings to start. Only turns that end after that are sent.",
+ "nothing_yet": "Nothing sent yet",
+ "last_sent": "Last sent {{when}}",
+ "counts": "Today: {{sent}} steps sent · {{failed}} failed · {{dropped}} dropped.",
+ "resumes": "If the destination stops answering, nothing is lost: sending resumes where it stopped.",
+ "failed_sub": "Sending has stopped until the settings change."
+ },
+ "state": {
+ "off": "Off",
+ "sending": "Sending",
+ "retrying": "Retrying",
+ "failed": "Failed",
+ "managed": "Sending"
+ },
+ "managed": {
+ "by": "Managed by {{by}}",
+ "sub": "Your organisation's policy sets where recordings go and what they include. Ask your admin to change it.",
+ "set_by": "Set by policy \"{{name}}\"",
+ "set_by_policy": "Set by policy",
+ "locked": "Locked",
+ "callout": "{{what}} from this machine are sent to {{by}}'s {{where}}. A small notice appears in each new session."
+ }
}
}
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index 84111f1c..828e8961 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -2378,7 +2378,8 @@
"slack": "Slack",
"github": "GitHub",
"machines": "机器",
- "sandbox": "沙箱"
+ "sandbox": "沙箱",
+ "observability": "可观测性"
},
"back_to_app": "返回应用",
"machine_scope_aria": "机器范围",
@@ -3409,5 +3410,116 @@
"failed_other": "{{count}} 次调用失败(用量未知)",
"overflow_other": "{{count}} 次调用超出上下文上限,对话已被摘要"
}
+ },
+ "obs": {
+ "title": "可观测性",
+ "sub": "你的同事执行的每一步都会记录在这台机器上,你可以在“步骤”中查看。你也可以把这些记录发送到公司使用的工具。记录采用 OpenTelemetry 标准。",
+ "load_failed": "无法读取这台机器的可观测性设置。",
+ "error_save": "无法保存。",
+ "error_address": "请输入以 http:// 或 https:// 开头的地址。",
+ "list_sep": "、",
+ "list_and": "和",
+ "callout_item": {
+ "messages": "你的消息和 AI 的回答",
+ "tool_io": "工具输入和结果",
+ "context": "OpenWorker 添加的上下文",
+ "names": "会话和用户名称"
+ },
+ "kept_note": "与你的其他密钥一起保存在这台机器上",
+ "refused_key": "目标拒绝了这个密钥",
+ "not_found": "找不到该地址",
+ "record_off_note": "记录已关闭,因此不会发送任何内容。",
+ "never_sent": "无论开关如何,以下内容都不会发送:模型的思考文本、错误信息(其中含有地址)以及服务商报告的费用。自动审批的结论(允许、拦截、询问你)、审核者的名称和耗时属于元数据,发送时始终包含。",
+ "sec": {
+ "machine": "在这台机器上",
+ "send_to": "把记录发送到",
+ "include": "发送时包含的内容",
+ "included": "包含的内容",
+ "status": "状态"
+ },
+ "record": {
+ "title": "记录步骤",
+ "sub": "“步骤”“问题”和“用量”需要它。一般使用每天约 2.5 MB。",
+ "off": "已关闭:新会话不会被记录,它们的“步骤”“问题”和“用量”将为空。"
+ },
+ "keep": {
+ "title": "记录保留时长",
+ "sub": "更早的记录会被删除,对话记录不受影响。尚未发送就被删除的记录计为已丢弃。",
+ "days_other": "{{count}} 天"
+ },
+ "file": {
+ "title": "保存一个会话的记录",
+ "sub": "一个会话记录的全部内容(包括正文),保存为一个文件。用于技术支持或你自己的存档。",
+ "button": "保存…",
+ "pick": "会话",
+ "none": "还没有会话",
+ "save": "保存文件",
+ "cancel": "取消",
+ "failed": "无法保存这份记录。"
+ },
+ "dest": {
+ "off": "关闭",
+ "off_sub": "不会有任何内容离开这台机器",
+ "langfuse_sub": "开源 · 云端或自托管",
+ "otlp": "OpenTelemetry 端点",
+ "otlp_sub": "你自己的收集器、Grafana、Datadog、Phoenix 等"
+ },
+ "langfuse": {
+ "address": "Langfuse 地址",
+ "public_key": "公钥",
+ "secret_key": "私钥"
+ },
+ "otlp": {
+ "url": "追踪地址(OTLP/HTTP)",
+ "header_name": "请求头名称",
+ "header_value": "值",
+ "add_header": "添加请求头"
+ },
+ "test": {
+ "button": "发送一条测试记录",
+ "sending": "正在发送…",
+ "ok_langfuse": "已连接 Langfuse · {{ms}} 毫秒",
+ "ok_otlp": "已连接端点 · {{ms}} 毫秒",
+ "unreachable": "无法连接这台机器。"
+ },
+ "include": {
+ "metadata": "步骤、耗时、令牌数、模型和工具名称",
+ "metadata_short": "步骤、耗时、令牌数、模型、工具名称",
+ "metadata_sub": "发送时始终包含。不含会话中的任何文字。",
+ "metadata_locked": "发送时始终包含",
+ "messages": "你的消息和 AI 的回答",
+ "messages_sub": "你写的内容和 AI 的回复。除非打开下一个开关,否则对话中的工具输入和结果不会发送。每条最多 8 KB;密钥和令牌会被遮盖。",
+ "tool_io": "工具输入和结果",
+ "tool_io_sub": "命令、文件内容、命令输出和连接器数据。如果上面的开关也打开:还包括自动审批的理由及其看到的内容,以及摘要(它们会引用工具内容)。",
+ "context": "OpenWorker 添加的上下文",
+ "context_sub": "系统提示、工具列表,以及每轮添加的上下文(文件夹、技能菜单、模式说明)。",
+ "names": "会话和用户名称",
+ "names_sub": "会话标题、回答每张卡片的人,以及这台机器的名称。关闭时这些都不会发送。",
+ "names_on": "会话标题、回答每张卡片的人,以及这台机器的名称会被发送。"
+ },
+ "status": {
+ "off_title": "未在发送",
+ "off_sub": "选择发送目标后开始发送。只发送此后结束的轮次。",
+ "nothing_yet": "还没有发送任何内容",
+ "last_sent": "上次发送:{{when}}",
+ "counts": "今天:已发送 {{sent}} 个步骤 · {{failed}} 次失败 · {{dropped}} 个已丢弃。",
+ "resumes": "如果目标停止响应,不会丢失任何内容:发送会从中断处继续。",
+ "failed_sub": "在设置更改之前,发送已停止。"
+ },
+ "state": {
+ "off": "关闭",
+ "sending": "发送中",
+ "retrying": "重试中",
+ "failed": "失败",
+ "managed": "发送中"
+ },
+ "managed": {
+ "by": "由 {{by}} 管理",
+ "sub": "你所在组织的策略决定记录发送到哪里以及包含哪些内容。如需更改,请联系管理员。",
+ "set_by": "由策略“{{name}}”设置",
+ "set_by_policy": "由策略设置",
+ "locked": "已锁定",
+ "callout": "这台机器上的{{what}}会发送到 {{by}} 的 {{where}}。每个新会话都会显示一条简短提示。"
+ }
}
}
diff --git a/surfaces/gui/src/routes.ts b/surfaces/gui/src/routes.ts
index 311ff874..324de93d 100644
--- a/surfaces/gui/src/routes.ts
+++ b/surfaces/gui/src/routes.ts
@@ -30,6 +30,8 @@ const TAB_BY_SLUG: Record<string, string> = {
connectors: "connectors",
// UX-058: the services behind the tools.
customization: "customization",
+ // OB-6: recording, keep for, and sending recordings.
+ observability: "observability",
// UX-049: per-connector glance pages.
slack: "slack",
github: "github",
diff --git a/surfaces/gui/src/types.ts b/surfaces/gui/src/types.ts
index bbfc593c..de6c52ca 100644
--- a/surfaces/gui/src/types.ts
+++ b/surfaces/gui/src/types.ts
@@ -26,6 +26,7 @@ export type EventType =
| "interrupted"
| "model_changed"
| "mode_notice"
+ | "export_notice"
| "memory_saved"
| "compacting"
| "compacted"
diff --git a/tests/test_observability_export_server.py b/tests/test_observability_export_server.py
index 4af2cc4a..eb1bd5b4 100644
--- a/tests/test_observability_export_server.py
+++ b/tests/test_observability_export_server.py
@@ -110,11 +110,13 @@ def test_a_company_policy_makes_the_page_read_only_and_tells_new_sessions(tmp_pa
assert "PLANT" not in json.dumps(got)
r = client.put("/v1/observability/settings", json={"include": {"tool_io": True}})
assert r.status_code == 409 and r.json()["error"] == "Managed by Acme Corp"
- # Each new session says what goes where, once.
+ # Each new session says what goes where, once. An empty draft is not saved for it.
with client.websocket_connect("/ws/session/fresh") as ws:
msgs = [ws.receive_json() for _ in range(2)]
notice = next(m for m in msgs if m["type"] == "export_notice")
assert notice["data"]["text"] == "Acme Corp receives this session's messages (Langfuse, langfuse.acme.internal)."
+ assert "fresh" not in [s["session_id"] for s in client.get("/v1/sessions").json()["sessions"]]
+ _turn(client, "fresh") # reconnects (no second notice) and runs the first turn
kinds = [m.get("kind") for m in client.get("/v1/sessions/fresh/messages").json()["messages"]]
assert kinds.count("export_notice") == 1
manager.observability.close()