Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(memory): expose session fact failures and error context

muterCab805dd8198f
diff --git a/apps/node-services/src/memory/README.md b/apps/node-services/src/memory/README.md
index 747d4cc0..c522aed0 100644
--- a/apps/node-services/src/memory/README.md
+++ b/apps/node-services/src/memory/README.md
@@ -774,11 +774,21 @@ The two kinds of automatic retry each have a final or persistent failure state,
Wiki indexing has no Memory queue: TeamHub's publication job retries until Memory indexes the published Wiki,
and the Memory scheduler reconciles Daily and Weekly reports every minute.
-`GET /internal/v1/health/failures` returns `scheduler` (`exhausted`, `pending_retries` and their totals) and
-`raw_chunk_sources` (failed sources and counts per owner). Each list holds at most 200 items, error summaries are cut
+`GET /internal/v1/health/failures` returns `scheduler` (`exhausted`, `pending_retries` and their totals),
+`raw_chunk_sources` (failed sources and counts per owner), and `session_facts` (latest failed fact sync per Agent).
+Each list holds at most 200 items, error summaries are cut
to 300 characters, and no text is included. An unconfigured store returns `{"configured": false}`, a failed query
returns `{"error": "unavailable"}`, and the other parts still return 200.
+Session fact diagnostics are process-local (`scope: "process"`, `observed_since`) and reset on restart;
+zero means no observed failed syncs, not that all persisted sources have facts. Each failed Agent reports
+`failed_windows`, `last_failure_at`, and `last_error_kind` from its latest finished sync. A sync that aborts
+before a complete count reports `failed_windows: null`. Only a successful sync for the same Agent clears
+its failure; partial extraction keeps it visible. Existing sync triggers retry the unfinished windows.
+The `memory.session_fact_extraction_failed` log includes `error_kind`, `agent_id`, `tenant_id`, `owner_id`,
+and the batch's `windows` count. Error kinds use structured model-call errors (or `unknown`), never text
+matching; these added fields contain no source text or model output.
+
`POST /internal/v1/health/failures:retry` accepts only `scheduler.task_keys` (all tasks when omitted);
any other field returns 400. Calendar tasks and the dependents they stopped go back to pending with
zero attempts and the request wakes the scheduler, which runs them within about a second; the
diff --git a/apps/node-services/src/memory/main.ts b/apps/node-services/src/memory/main.ts
index 0579b19f..20e0727c 100644
--- a/apps/node-services/src/memory/main.ts
+++ b/apps/node-services/src/memory/main.ts
@@ -140,6 +140,7 @@ export async function startMemoryService({
serviceToken: config.serviceToken,
chunkSearch: chunkIndex,
chunkFailures: chunkIndex,
+ factFailures: sessionFacts,
onPocketNoteChanged: async (change) => {
// A rebuilding Human gets Tracking Items from its replayed Dailies.
if (
diff --git a/apps/node-services/src/memory/server.ts b/apps/node-services/src/memory/server.ts
index 0e1fb994..fd8e5963 100644
--- a/apps/node-services/src/memory/server.ts
+++ b/apps/node-services/src/memory/server.ts
@@ -46,6 +46,7 @@ import {
MemoryBrowserNotFoundError,
} from "./memory-browser.js";
import type { ChunkSearchProvider, MemoryChunkIndex } from "./chunk-index.js";
+import type { SessionFactIndex } from "./session-fact-index.js";
import { writeMemoryLog } from "./run-telemetry.js";
export async function startMemoryServer(options: {
@@ -72,6 +73,7 @@ export async function startMemoryServer(options: {
getMemoryEntry?: typeof getMemoryEntry;
chunkSearch?: ChunkSearchProvider;
chunkFailures?: Pick<MemoryChunkIndex, "failedSources">;
+ factFailures?: Pick<SessionFactIndex, "failures">;
rebuildSubjects?: () => Promise<RebuildSubject[]>;
rebuildSessionDates?: (subject: RebuildSubject) => Promise<string[]>;
/** Drops the subject's indexed Wiki and reports when a rebuild starts. */
@@ -427,11 +429,12 @@ const FAILURE_LIST_LIMIT = 200;
async function failureSummary(options: {
scheduler: Pick<MemoryScheduler, "failures">;
chunkFailures?: Pick<MemoryChunkIndex, "failedSources">;
+ factFailures?: Pick<SessionFactIndex, "failures">;
}) {
// Each store degrades alone so one broken database still shows the others.
const section = async <T extends object>(
name: string,
- read: (() => Promise<T>) | undefined,
+ read: (() => T | Promise<T>) | undefined,
) => {
if (!read) return { configured: false };
try {
@@ -451,6 +454,11 @@ async function failureSummary(options: {
options.chunkFailures &&
(() => options.chunkFailures!.failedSources(FAILURE_LIST_LIMIT)),
);
+ const sessionFacts = await section(
+ "session_facts",
+ options.factFailures &&
+ (() => options.factFailures!.failures(FAILURE_LIST_LIMIT)),
+ );
return {
scheduler: {
exhausted_total: exhausted.length,
@@ -459,6 +467,7 @@ async function failureSummary(options: {
pending_retries: pending_retries.slice(0, FAILURE_LIST_LIMIT),
},
raw_chunk_sources: rawChunkSources,
+ session_facts: sessionFacts,
};
}
diff --git a/apps/node-services/src/memory/session-fact-index.ts b/apps/node-services/src/memory/session-fact-index.ts
index 6a1cbe3f..ed3ed0f3 100644
--- a/apps/node-services/src/memory/session-fact-index.ts
+++ b/apps/node-services/src/memory/session-fact-index.ts
@@ -1,5 +1,6 @@
import { createHash } from "node:crypto";
import type { PersonalKnowledgeQueryResponse } from "@linger/wire-contracts/node-services-internal/client";
+import type { components as NodeServicesInternal } from "@linger/wire-contracts/node-services-internal/types";
import type postgres from "postgres";
import { tokenizeSearchText } from "../bm25.js";
import { chunkSource, type SourceChunk } from "./search/chunks.js";
@@ -20,7 +21,7 @@ import {
type FactBatchWindow,
type FactWindow,
} from "./session-fact-extraction.js";
-import { isComputerOffline } from "../runtime-model-call.js";
+import { isComputerOffline, ModelCallError } from "../runtime-model-call.js";
import { memoryDatabase } from "./database.js";
import { localDateWindow } from "./date.js";
import { memoryLogger } from "./run-telemetry.js";
@@ -65,6 +66,10 @@ export interface FactSyncResult {
failed: number;
}
+type SessionFactFailure = NodeServicesInternal["schemas"]["SessionFactFailure"];
+type SessionFactFailures =
+ NodeServicesInternal["schemas"]["SessionFactFailures"];
+
export interface FactSearchInput extends ChunkSearchInput {
/** When the asked event happened: a window that votes, never a filter. */
event_from?: string;
@@ -181,6 +186,9 @@ export class SessionFactIndex {
readonly #concurrency: number;
// One sync per Agent at a time, so repeated triggers never extract twice.
readonly #agents = new Map<string, Promise<unknown>>();
+ // Process-local observations, not a persisted inventory of pending windows.
+ readonly #observedSince = new Date().toISOString();
+ readonly #failures = new Map<string, SessionFactFailure>();
constructor(options: {
/** Memory's shared pool; the role ends it, not the index. */
@@ -198,11 +206,33 @@ export class SessionFactIndex {
syncAgent(agentId: string): Promise<FactSyncResult> {
const run = (this.#agents.get(agentId) ?? Promise.resolve())
.catch(() => undefined)
- .then(() => this.#syncAgent(agentId));
+ .then(() => this.#syncAgent(agentId))
+ .catch((error: unknown) => {
+ this.#failures.set(agentId, {
+ agent_id: agentId,
+ failed_windows: null,
+ last_failure_at: new Date().toISOString(),
+ last_error_kind:
+ error instanceof ModelCallError ? error.kind : "unknown",
+ });
+ throw error;
+ });
this.#agents.set(agentId, run);
return run;
}
+ /** Latest failed syncs observed by this process; success clears only that Agent. */
+ failures(limit = 200): Omit<SessionFactFailures, "configured"> {
+ return {
+ scope: "process",
+ observed_since: this.#observedSince,
+ total: this.#failures.size,
+ items: [...this.#failures.values()]
+ .slice(0, limit)
+ .map((item) => ({ ...item })),
+ };
+ }
+
async #syncAgent(agentId: string): Promise<FactSyncResult> {
const sources = await this.#sql<FactSource[]>`
WITH candidate AS (
@@ -310,6 +340,7 @@ export class SessionFactIndex {
// An offline Computer fails every later batch too; they wait for the
// next sync instead.
let offline = false;
+ let lastErrorKind = "unknown";
const runBatch = async (batch: readonly PendingWindow[]) => {
if (offline) {
result.failed += batch.length;
@@ -326,8 +357,14 @@ export class SessionFactIndex {
// Not recorded as done, so the next sync retries the windows.
result.failed += batch.length;
offline ||= isComputerOffline(error);
+ lastErrorKind =
+ error instanceof ModelCallError ? error.kind : "unknown";
memoryLogger().log("error", "memory.session_fact_extraction_failed", {
error,
+ error_kind: lastErrorKind,
+ agent_id: agentId,
+ tenant_id: tenantId,
+ owner_id: ownerActorId,
windows: batch.length,
});
return;
@@ -336,6 +373,7 @@ export class SessionFactIndex {
const facts = extracted.get(item.window.sha256);
if (!facts) {
result.failed += 1;
+ lastErrorKind = "invalid_output";
continue;
}
await this.#store(source, item.window, facts);
@@ -352,6 +390,16 @@ export class SessionFactIndex {
},
),
);
+ if (result.failed) {
+ this.#failures.set(agentId, {
+ agent_id: agentId,
+ failed_windows: result.failed,
+ last_failure_at: new Date().toISOString(),
+ last_error_kind: lastErrorKind,
+ });
+ } else {
+ this.#failures.delete(agentId);
+ }
return result;
}
diff --git a/apps/node-services/tests/memory/server.test.ts b/apps/node-services/tests/memory/server.test.ts
index cdd7a331..315d8ff5 100644
--- a/apps/node-services/tests/memory/server.test.ts
+++ b/apps/node-services/tests/memory/server.test.ts
@@ -578,6 +578,20 @@ describe("failure health", () => {
const chunkFailures = {
failedSources: vi.fn().mockRejectedValue(new Error("pg down")),
};
+ const factSummary = {
+ scope: "process" as const,
+ observed_since: "2026-09-29T00:00:00.000Z",
+ total: 1,
+ items: [
+ {
+ agent_id: "agent_a",
+ failed_windows: 2,
+ last_failure_at: "2026-09-29T01:00:00.000Z",
+ last_error_kind: "invalid_output",
+ },
+ ],
+ };
+ const factFailures = { failures: vi.fn().mockReturnValue(factSummary) };
const server = await startMemoryServer({
dataRoot,
host: "127.0.0.1",
@@ -585,6 +599,7 @@ describe("failure health", () => {
scheduler,
serviceToken: "test",
chunkFailures,
+ factFailures,
});
const headers = {
authorization: "Bearer test",
@@ -600,6 +615,7 @@ describe("failure health", () => {
expect(
(await fetch(`${server.url}/internal/v1/health/failures`)).status,
).toBe(401);
+ expect(factFailures.failures).not.toHaveBeenCalled();
expect((await retry({}, { ...headers, authorization: "" })).status).toBe(
401,
);
@@ -615,6 +631,20 @@ describe("failure health", () => {
pending_retries: [],
},
raw_chunk_sources: { error: "unavailable" },
+ session_facts: { configured: true, ...factSummary },
+ });
+ expect(factFailures.failures).toHaveBeenCalledExactlyOnceWith(200);
+ factFailures.failures.mockImplementationOnce(() => {
+ throw new Error("Unavailable");
+ });
+ const degraded = await fetch(
+ `${server.url}/internal/v1/health/failures`,
+ { headers },
+ );
+ expect(degraded.status).toBe(200);
+ expect(await degraded.json()).toMatchObject({
+ scheduler: { exhausted_total: 0 },
+ session_facts: { error: "unavailable" },
});
for (const invalid of [
{ extra: {} },
@@ -623,6 +653,7 @@ describe("failure health", () => {
{ scheduler: { task_keys: ["init:rebuild:agent_a:2026-09-30"] } },
{ scheduler: { task_keys: [] } },
{ openwiki_jobs: { owner_id: "owner_a" } },
+ { session_facts: {} },
[],
]) {
expect((await retry(invalid)).status).toBe(400);
@@ -822,6 +853,7 @@ describe("failure health", () => {
total: 1,
});
expect(summary).not.toHaveProperty("openwiki_jobs");
+ expect(summary.session_facts).toEqual({ configured: false });
expect(failedSources).toHaveBeenCalledWith(200);
} finally {
await server.close();
diff --git a/apps/node-services/tests/memory/session-fact-index.test.ts b/apps/node-services/tests/memory/session-fact-index.test.ts
index 4650867e..d5034eb9 100644
--- a/apps/node-services/tests/memory/session-fact-index.test.ts
+++ b/apps/node-services/tests/memory/session-fact-index.test.ts
@@ -1,11 +1,171 @@
-import { describe, expect, it } from "vitest";
+import { createJsonLogger } from "@linger/service-kit/node";
+import type postgres from "postgres";
+import { describe, expect, it, vi } from "vitest";
+import { ModelCallError } from "../../src/runtime-model-call.js";
+import {
+ memoryLogger,
+ setMemoryLogger,
+} from "../../src/memory/run-telemetry.js";
+import type { extractWindowBatch } from "../../src/memory/session-fact-extraction.js";
import {
factChunk,
factContext,
messageAt,
sessionFactText,
+ SessionFactIndex,
} from "../../src/memory/session-fact-index.js";
+function syncHarness() {
+ const sql = vi.fn().mockResolvedValue([]);
+ Object.assign(sql, {
+ begin: (work: (transaction: typeof sql) => Promise<void>) => work(sql),
+ });
+ const extract = vi
+ .fn<typeof extractWindowBatch>()
+ .mockImplementation(
+ async (batch) => new Map(batch.map(({ window }) => [window.sha256, []])),
+ );
+ const index = new SessionFactIndex({
+ sql: sql as unknown as postgres.Sql,
+ extract,
+ });
+ function sync(agentId: string, contents = ["A private source sentence."]) {
+ sql.mockResolvedValueOnce(
+ contents.map((content, ordinal) => ({
+ id: `${agentId}_${ordinal}`,
+ tenant_id: "tenant_a",
+ owner_id: "owner_a",
+ agent_id: agentId,
+ active_sha256: "a".repeat(64),
+ content,
+ date: "2026-09-29",
+ origin_kind: "pocket_note",
+ mail_class: null,
+ replied: false,
+ })),
+ );
+ return index.syncAgent(agentId);
+ }
+ return { index, extract, sql, sync };
+}
+
+describe("Session fact failure diagnostics", () => {
+ it("reports partial extraction and clears a failure only after that Agent succeeds", async () => {
+ const { index, extract, sync } = syncHarness();
+ expect(index.failures()).toEqual({
+ scope: "process",
+ observed_since: expect.any(String),
+ total: 0,
+ items: [],
+ });
+ extract.mockResolvedValueOnce(new Map());
+ await sync("agent_a");
+ await sync("agent_b");
+ expect(index.failures()).toMatchObject({
+ total: 1,
+ items: [
+ {
+ agent_id: "agent_a",
+ failed_windows: 1,
+ last_error_kind: "invalid_output",
+ },
+ ],
+ });
+ extract.mockImplementationOnce(
+ async (batch) => new Map([[batch[0]!.window.sha256, []]]),
+ );
+ expect(
+ await sync("agent_a", [
+ "First private source.",
+ "Second private source.",
+ ]),
+ ).toMatchObject({ extracted: 1, failed: 1 });
+ expect(index.failures().total).toBe(1);
+ await sync("agent_a");
+ expect(index.failures()).toMatchObject({ total: 0, items: [] });
+ });
+
+ it.each(["invalid_output", "computer_offline", "failed"] as const)(
+ "preserves the structured %s kind and owner in serialized logs",
+ async (kind) => {
+ const { index, extract, sync } = syncHarness();
+ const lines: string[] = [];
+ const previous = memoryLogger();
+ setMemoryLogger(
+ createJsonLogger({
+ service: "test",
+ write: (line) => lines.push(line),
+ }),
+ );
+ try {
+ extract.mockRejectedValueOnce(
+ new ModelCallError(kind, "Model call failed", {
+ output: "private model output",
+ }),
+ );
+ expect(await sync("agent_a")).toMatchObject({ failed: 1 });
+ expect(lines.map((line) => JSON.parse(line))).toMatchObject([
+ {
+ event: "memory.session_fact_extraction_failed",
+ error: { name: "ModelCallError", message: "Model call failed" },
+ error_kind: kind,
+ agent_id: "agent_a",
+ tenant_id: "tenant_a",
+ owner_id: "owner_a",
+ windows: 1,
+ },
+ ]);
+ expect(index.failures()).toMatchObject({
+ total: 1,
+ items: [
+ {
+ agent_id: "agent_a",
+ failed_windows: 1,
+ last_failure_at: expect.any(String),
+ last_error_kind: kind,
+ },
+ ],
+ });
+ expect(
+ JSON.stringify(index.failures()) + lines.join("\n"),
+ ).not.toContain("private");
+ } finally {
+ setMemoryLogger(previous);
+ }
+ },
+ );
+
+ it("keeps aborted syncs visible without inventing a count or inferring kinds from prose", async () => {
+ const { index, sql, sync } = syncHarness();
+ const error = new Error("The owner's Local Computer is offline");
+ sql.mockRejectedValueOnce(error);
+ await expect(index.syncAgent("agent_a")).rejects.toBe(error);
+ sql.mockRejectedValueOnce(new Error("Database unavailable"));
+ await expect(index.syncAgent("agent_b")).rejects.toThrow(
+ "Database unavailable",
+ );
+ expect(index.failures(1)).toMatchObject({
+ total: 2,
+ items: [
+ {
+ agent_id: "agent_a",
+ failed_windows: null,
+ last_error_kind: "unknown",
+ },
+ ],
+ });
+ expect(index.failures(1).items).toHaveLength(1);
+ await sync("agent_a");
+ expect(index.failures().items.map((item) => item.agent_id)).toEqual([
+ "agent_b",
+ ]);
+ expect(syncHarness().index.failures()).toMatchObject({
+ total: 0,
+ items: [],
+ });
+ });
+});
+
describe("Session fact binding", () => {
it("takes the mention time and speaker from the enclosing Room message", () => {
const content = [
diff --git a/contracts/generated/go/nodeservicesinternal/openapi.gen.go b/contracts/generated/go/nodeservicesinternal/openapi.gen.go
index 5197032c..a1108725 100644
--- a/contracts/generated/go/nodeservicesinternal/openapi.gen.go
+++ b/contracts/generated/go/nodeservicesinternal/openapi.gen.go
@@ -1801,6 +1801,7 @@ type MemoryFailureSummaryResponse struct {
PendingRetries []MemoryCalendarFailure `json:"pending_retries"`
PendingRetriesTotal int `json:"pending_retries_total"`
} `json:"scheduler"`
+ SessionFacts MemoryFailureSummaryResponse_SessionFacts `json:"session_facts"`
}
// MemoryFailureSummaryResponse_RawChunkSources defines model for MemoryFailureSummaryResponse.RawChunkSources.
@@ -1808,6 +1809,11 @@ type MemoryFailureSummaryResponse_RawChunkSources struct {
union json.RawMessage
}
+// MemoryFailureSummaryResponse_SessionFacts defines model for MemoryFailureSummaryResponse.SessionFacts.
+type MemoryFailureSummaryResponse_SessionFacts struct {
+ union json.RawMessage
+}
+
// MemoryRebuildRequest Exactly one of memory_subject_key or owner_actor_id. Session dates are discovered from TeamHub up to today in the scheduler zone.
type MemoryRebuildRequest struct {
// From Optional pilot start; earlier Session dates are skipped.
@@ -2248,6 +2254,29 @@ type ServiceTokenErrorResponse struct {
} `json:"error"`
}
+// SessionFactFailure defines model for SessionFactFailure.
+type SessionFactFailure struct {
+ AgentId string `json:"agent_id"`
+
+ // FailedWindows Windows not extracted in the latest sync, or null if the sync aborted before a complete count.
+ FailedWindows *int `json:"failed_windows"`
+
+ // LastErrorKind Last structured ModelCallError kind, invalid_output for omitted windows, or unknown; never inferred from error prose.
+ LastErrorKind string `json:"last_error_kind"`
+ LastFailureAt time.Time `json:"last_failure_at"`
+}
+
+// SessionFactFailures Latest failed Session fact sync per Agent observed by this process. A successful sync clears only that Agent. Resets on restart; zero does not establish that all persisted sources have facts.
+type SessionFactFailures struct {
+ Configured bool `json:"configured"`
+ Items []SessionFactFailure `json:"items"`
+ ObservedSince time.Time `json:"observed_since"`
+ Scope string `json:"scope"`
+
+ // Total Number of Agents whose latest observed sync failed, before the list limit.
+ Total int `json:"total"`
+}
+
// SetDocumentTitleSemanticOperation defines model for SetDocumentTitleSemanticOperation.
type SetDocumentTitleSemanticOperation struct {
Kind string `json:"kind"`
@@ -3278,6 +3307,94 @@ func (t *MemoryFailureSummaryResponse_RawChunkSources) UnmarshalJSON(b []byte) e
return err
}
+// AsMemoryFailureSectionNotConfigured returns the union data inside the MemoryFailureSummaryResponse_SessionFacts as a MemoryFailureSectionNotConfigured
+func (t MemoryFailureSummaryResponse_SessionFacts) AsMemoryFailureSectionNotConfigured() (MemoryFailureSectionNotConfigured, error) {
+ var body MemoryFailureSectionNotConfigured
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromMemoryFailureSectionNotConfigured overwrites any union data inside the MemoryFailureSummaryResponse_SessionFacts as the provided MemoryFailureSectionNotConfigured
+func (t *MemoryFailureSummaryResponse_SessionFacts) FromMemoryFailureSectionNotConfigured(v MemoryFailureSectionNotConfigured) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeMemoryFailureSectionNotConfigured performs a merge with any union data inside the MemoryFailureSummaryResponse_SessionFacts, using the provided MemoryFailureSectionNotConfigured
+func (t *MemoryFailureSummaryResponse_SessionFacts) MergeMemoryFailureSectionNotConfigured(v MemoryFailureSectionNotConfigured) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsMemoryFailureSectionUnavailable returns the union data inside the MemoryFailureSummaryResponse_SessionFacts as a MemoryFailureSectionUnavailable
+func (t MemoryFailureSummaryResponse_SessionFacts) AsMemoryFailureSectionUnavailable() (MemoryFailureSectionUnavailable, error) {
+ var body MemoryFailureSectionUnavailable
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromMemoryFailureSectionUnavailable overwrites any union data inside the MemoryFailureSummaryResponse_SessionFacts as the provided MemoryFailureSectionUnavailable
+func (t *MemoryFailureSummaryResponse_SessionFacts) FromMemoryFailureSectionUnavailable(v MemoryFailureSectionUnavailable) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeMemoryFailureSectionUnavailable performs a merge with any union data inside the MemoryFailureSummaryResponse_SessionFacts, using the provided MemoryFailureSectionUnavailable
+func (t *MemoryFailureSummaryResponse_SessionFacts) MergeMemoryFailureSectionUnavailable(v MemoryFailureSectionUnavailable) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionFactFailures returns the union data inside the MemoryFailureSummaryResponse_SessionFacts as a SessionFactFailures
+func (t MemoryFailureSummaryResponse_SessionFacts) AsSessionFactFailures() (SessionFactFailures, error) {
+ var body SessionFactFailures
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionFactFailures overwrites any union data inside the MemoryFailureSummaryResponse_SessionFacts as the provided SessionFactFailures
+func (t *MemoryFailureSummaryResponse_SessionFacts) FromSessionFactFailures(v SessionFactFailures) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionFactFailures performs a merge with any union data inside the MemoryFailureSummaryResponse_SessionFacts, using the provided SessionFactFailures
+func (t *MemoryFailureSummaryResponse_SessionFacts) MergeSessionFactFailures(v SessionFactFailures) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+func (t MemoryFailureSummaryResponse_SessionFacts) MarshalJSON() ([]byte, error) {
+ b, err := t.union.MarshalJSON()
+ return b, err
+}
+
+func (t *MemoryFailureSummaryResponse_SessionFacts) UnmarshalJSON(b []byte) error {
+ err := t.union.UnmarshalJSON(b)
+ return err
+}
+
// RequestEditorFn is the function signature for the RequestEditor callback function
type RequestEditorFn func(ctx context.Context, req *http.Request) error
diff --git a/contracts/generated/typescript/src/generated/node-services-internal/types.ts b/contracts/generated/typescript/src/generated/node-services-internal/types.ts
index d0748416..3da57011 100644
--- a/contracts/generated/typescript/src/generated/node-services-internal/types.ts
+++ b/contracts/generated/typescript/src/generated/node-services-internal/types.ts
@@ -1041,6 +1041,31 @@ export interface components {
| components["schemas"]["MemoryFailureSectionNotConfigured"]
| components["schemas"]["MemoryFailureSectionUnavailable"]
| components["schemas"]["RawChunkSourceFailures"];
+ session_facts:
+ | components["schemas"]["MemoryFailureSectionNotConfigured"]
+ | components["schemas"]["MemoryFailureSectionUnavailable"]
+ | components["schemas"]["SessionFactFailures"];
+ };
+ /** @description Latest failed Session fact sync per Agent observed by this process. A successful sync clears only that Agent. Resets on restart; zero does not establish that all persisted sources have facts. */
+ SessionFactFailures: {
+ /** @constant */
+ configured: true;
+ /** @constant */
+ scope: "process";
+ /** Format: date-time */
+ observed_since: string;
+ /** @description Number of Agents whose latest observed sync failed, before the list limit. */
+ total: number;
+ items: components["schemas"]["SessionFactFailure"][];
+ };
+ SessionFactFailure: {
+ agent_id: string;
+ /** @description Windows not extracted in the latest sync, or null if the sync aborted before a complete count. */
+ failed_windows: number | null;
+ /** Format: date-time */
+ last_failure_at: string;
+ /** @description Last structured ModelCallError kind, invalid_output for omitted windows, or unknown; never inferred from error prose. */
+ last_error_kind: string;
};
RawChunkSourceFailures: {
/** @constant */
diff --git a/contracts/openapi/node-services-internal/openapi.yaml b/contracts/openapi/node-services-internal/openapi.yaml
index e4719746..d89774ee 100644
--- a/contracts/openapi/node-services-internal/openapi.yaml
+++ b/contracts/openapi/node-services-internal/openapi.yaml
@@ -2313,6 +2313,7 @@ components:
required:
- scheduler
- raw_chunk_sources
+ - session_facts
properties:
scheduler:
type: object
@@ -2344,6 +2345,64 @@ components:
- $ref: "#/components/schemas/MemoryFailureSectionNotConfigured"
- $ref: "#/components/schemas/MemoryFailureSectionUnavailable"
- $ref: "#/components/schemas/RawChunkSourceFailures"
+ session_facts:
+ oneOf:
+ - $ref: "#/components/schemas/MemoryFailureSectionNotConfigured"
+ - $ref: "#/components/schemas/MemoryFailureSectionUnavailable"
+ - $ref: "#/components/schemas/SessionFactFailures"
+ SessionFactFailures:
+ type: object
+ additionalProperties: false
+ description: >-
+ Latest failed Session fact sync per Agent observed by this process. A successful sync clears
+ only that Agent. Resets on restart; zero does not establish that all persisted sources have facts.
+ required:
+ - configured
+ - scope
+ - observed_since
+ - total
+ - items
+ properties:
+ configured:
+ type: boolean
+ const: true
+ scope:
+ type: string
+ const: process
+ observed_since:
+ type: string
+ format: date-time
+ total:
+ type: integer
+ minimum: 0
+ description: Number of Agents whose latest observed sync failed, before the list limit.
+ items:
+ type: array
+ maxItems: 200
+ items:
+ $ref: "#/components/schemas/SessionFactFailure"
+ SessionFactFailure:
+ type: object
+ additionalProperties: false
+ required:
+ - agent_id
+ - failed_windows
+ - last_failure_at
+ - last_error_kind
+ properties:
+ agent_id:
+ type: string
+ failed_windows:
+ type: integer
+ nullable: true
+ minimum: 1
+ description: Windows not extracted in the latest sync, or null if the sync aborted before a complete count.
+ last_failure_at:
+ type: string
+ format: date-time
+ last_error_kind:
+ type: string
+ description: Last structured ModelCallError kind, invalid_output for omitted windows, or unknown; never inferred from error prose.
RawChunkSourceFailures:
type: object
additionalProperties: false