The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(memory-sources): read a draining embed backlog as pending, not failed\n\nRight after a large sync the Sources row flipped to the amber "Ingested\nonly / Stored without vectors. Semantic search unavailable." while the\nchunks were merely queued for the embed backfill, then cleared itself a\nfew minutes later. Since tinymemory 1.14 vectors come from the deduped\nreembed_backfill job rather than inline at ingest, so every sizeable sync\nleaves a transient backlog that the row read as a failure.\n\nFrontend:\n- sourcePipelineStatus gains a soft `vectors_pending` state. Pending\n chunks are "waiting" while the engine reports a re-embed chain with\n rows to process (memory_tree_memory_backfill_status.in_progress) or the\n source's newest chunk is inside the core's five-minute `recent` window.\n The amber warning stays for the global semantic_recall latch, an\n embeddings-family blocking cause (budget/auth/unconfigured/dim\n mismatch/local model), or a backlog with nothing queued and no chunk\n for over five minutes.\n- MemorySourcesRegistry polls the backfill status as a fourth best-effort\n call and hands it to rows; a failed RPC falls back to freshness.\n- MemorySourceRow renders a neutral "{count} chunks waiting for vectors"\n note and keeps the freshness pill in the soft state. The verdict is\n no longer suppressed by a terminal result chip (`settled = !progress`),\n which un-skips the spec that documented that hole.\n- New i18n key sync.pipeline.vectorsPending in all 14 locales.\n\nRust:\n- SYNC_PASS_MAX_ITEMS 500 -> 200. One pass is one AcceptSourceItems call\n that embeds each document in turn (~1.7 s each); 500 items ran ~14 min\n into the host's 15-minute deadline and logged a false\n "initial sync failed ... timed out" after every document had landed.\n The Sources-row button loops up to 50 passes (per-click ceiling now\n 10k). The four single-pass entry points (periodic tick, manual provider\n sync, connection_created initial sync, Slack ingest RPC) move at most\n 200 items per invocation instead of 500; connection_created is the path\n that logged the false failure.\n\nTests: derivation cases for every hard/soft branch, row render cases for\nthe note beside a result chip and the amber fallback, registry wiring +\nRPC-failure fallback, Playwright spec gated on the core's own hard-vs-soft\nverdict.\n\nCloses #6025\n
Shanu385b4f75ff64
diff --git a/.claude/memory.md b/.claude/memory.mdindex 185673b018..78a0cd6eef 100644--- a/.claude/memory.md+++ b/.claude/memory.md@@ -352,3 +352,13 @@ Quick reference for anyone starting with Claude on this project. Updated by the- **`app/src/pages/Intelligence.tsx` is rendered ONLY by `Brain.tsx`** (`/settings/intelligence` redirects to `/brain?tab=intelligence`), inside a card with `h-full overflow-hidden` (`Brain.tsx` ~line 255). A code comment there asserts the embedded panels "own their own scroll directly" — true for the sibling `PanelPage`/`PanelScaffold` panels (MemoryDataPanel etc.), but Intelligence previously returned a bare `<div className="z-10 relative">` with NO height/scroll, so its content overflowed the card and was clipped with no scrollbar.- **Fix pattern (matches `PanelPage`)**: root `flex h-full min-h-0 flex-col` → pinned `SettingsHeader` wrapper (`flex-shrink-0`) → body `min-h-0 flex-1 overflow-y-auto` wrapping ChipTabs + the content card. `ToastContainer`/`ConfirmationModal` stay as siblings OUTSIDE the scroll region. The scroll body carries `data-testid="intelligence-scroll"` for the regression test.- **Gotcha for any panel embedded in Brain's Knowledge/Memory card**: it must own its own vertical scroll (the card is `overflow-hidden`). Don't rely on a parent scroll — there isn't one.++## Sources row: pending vs stuck vectors (Issue #6025)++- **`chunks_pending` alone is ambiguous** — since tinymemory 1.14 vectors come from the `reembed_backfill` job, not inline at ingest, so every sizeable sync leaves a transient backlog. `sourcePipelineStatus.ts` reads it as soft `vectors_pending` while `memory_tree_memory_backfill_status.in_progress` is true or `freshness` is `active`/`recent` (≤5 min); amber `stored_without_vectors` only for the `semantic_recall` latch, an embeddings-family `first_blocking_cause`, or an idle backlog with nothing queued.+- **`backfill_in_progress` is a process-global flag, not a query** — set when a re-embed chain is armed, cleared only when the chain ends (Done/Skipped/StaleSignature/Failed), so it stays true while the job sits starved in `ready` behind `extract_chunk` on the single LLM permit. Not per-workspace.+- **Test fixtures: a stuck backlog needs `freshness: 'idle'`** — `chunks_pending > 0` with `recent`/`active` freshness renders the neutral note, not the warning. `vi.mock` factories for `utils/tauriCommands/memoryTree` must list `memoryTreeBackfillStatus` or `MemorySourcesRegistry.refresh` throws inside its `Promise.all`.+- **`t()` does not interpolate** — the caller replaces placeholders: `t('sync.pipeline.vectorsPending').replace('{count}', n.toLocaleString())` (pattern from `SyncAuditPanel.tsx`).+- **`SYNC_PASS_MAX_ITEMS` (200) has five consumers** — the Sources-row loop (`composio_sync_budgeted`, ≤50 passes) plus four single-pass entry points: `periodic.rs`, `memory/ops/sync.rs`, `bus_part_02.rs` (`connection_created` initial sync), `slack/rpc.rs`. One pass is one `AcceptSourceItems` call that embeds each document in turn (~1.7 s each) against the 15-min `module_call_slow!` deadline; 500 tripped it.+- **`providers_ops.rs` sits at exactly 750 lines** — the `check-openhuman-rust-layout.mjs` limit; edits there must be net-zero lines or split the file.+- **`node app/scripts/build-parallel.mjs` fails with `vite: command not found`** when run directly — it shells out to bare `tsc`/`vite`; use `pnpm build` or prefix `PATH=app/node_modules/.bin:$PATH`.diff --git a/app/src/components/intelligence/MemorySourceRow.pipelineWarning.test.tsx b/app/src/components/intelligence/MemorySourceRow.pipelineWarning.test.tsxindex c886513429..c3115c7faa 100644--- a/app/src/components/intelligence/MemorySourceRow.pipelineWarning.test.tsx+++ b/app/src/components/intelligence/MemorySourceRow.pipelineWarning.test.tsx@@ -25,7 +25,14 @@ import { describe, expect, it, vi } from 'vitest';import type { MemorySourceEntry, SourceStatus } from '../../services/memorySourcesService';import { MemorySourceRow } from './MemorySourceRow';-vi.mock('../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (k: string) => k }) }));+// Keys come back verbatim, except the one with a placeholder: it comes back as+// its English shape so the count interpolation is asserted, not just the key.+vi.mock('../../lib/i18n/I18nContext', () => ({+ useT: () => ({+ t: (k: string) =>+ k === 'sync.pipeline.vectorsPending' ? '{count} chunks waiting for vectors' : k,+ }),+}));const SOURCE_ID = 'src_brain_1';@@ -40,14 +47,20 @@ function makeSource(overrides: Partial<MemorySourceEntry> = {}): MemorySourceEnt};}-/** The incident's shape: everything ingested, nothing embedded. */+/**+ * The incident's shape: everything ingested, nothing embedded, and nothing+ * moving — the newest chunk is long past the core's five-minute `recent`+ * window and no backfill snapshot says a chain is draining it. (A backlog+ * that IS moving is the neutral "waiting for vectors" note, pinned at the+ * bottom of this file — openhuman#6025.)+ */function storedWithoutVectors(overrides: Partial<SourceStatus> = {}): SourceStatus {return {source_id: SOURCE_ID,chunks_synced: 2581,chunks_pending: 2581,- last_chunk_at_ms: Date.now(),- freshness: 'recent',+ last_chunk_at_ms: Date.now() - 60 * 60_000,+ freshness: 'idle',...overrides,} as SourceStatus;}@@ -57,6 +70,7 @@ function renderRow(overrides: Partial<React.ComponentProps<typeof MemorySourceRosource: makeSource(),status: null,pipeline: null,+ backfill: null,isAuthenticated: true,isSyncing: false,isBuilding: false,@@ -130,10 +144,11 @@ describe('MemorySourceRow — the row tells the truth about embedding state', ()});describe('MemorySourceRow — what suppresses the warning', () => {- // `settled = !progress && !result` in MemorySourceRow.tsx. This suppression is- // correct (mid-sync `chunks_pending` is legitimately transient) and is also the- // most plausible way for the indicator to never appear: a source wedged in a- // progress state would warn about nothing forever. Both directions are pinned.+ // `settled = !progress` in MemorySourceRow.tsx (openhuman#6025 dropped the+ // `!result` half). Suppressing while progress streams is correct (mid-sync+ // `chunks_pending` is legitimately transient) and is also the most plausible+ // way for the indicator to never appear: a source wedged in a progress state+ // would warn about nothing forever. Both directions are pinned.it('hides the warning while a sync is actively reporting progress', () => {renderRow({status: storedWithoutVectors(),@@ -145,31 +160,19 @@ describe('MemorySourceRow — what suppresses the warning', () => {expect(warning()).not.toBeInTheDocument();});- // Skipped, not deleted, and it asserts the DESIRED behaviour rather than the- // current one — which is the only framing that satisfies both reviews on this- // thread.- //- // The bug: `settled = !progress && !result` (MemorySourceRow.tsx:100), and- // MemorySourcesRegistry clears `result` only when the NEXT sync starts- // (`:213`, `:358`). Nothing else drops it. So after any completed or failed- // sync the "stored without vectors" warning is suppressed indefinitely —- // exactly the incident this file exists for.- //- // Asserting the suppression as correct would make the bug a required- // contract, so a genuine fix would turn this red (CodeRabbit's objection, and- // it is right). Deleting the case would leave it invisible again, which is- // how it hid in the first place (Codex's objection, also right). Defining the- // expected behaviour and skipping until it holds does neither: it is a- // written-down spec for the fix, and it goes green the moment the fix lands.- //- // UNSKIP when the suppression is narrowed to `!progress`, or when the- // registry clears `syncResults` once the row's status refreshes post-sync.- // Tracked in ~/tinyhuman/bugs/W6-ui-bugs.md #14.- it.skip('should still warn after a sync finishes while chunks remain unembedded', () => {+ // A terminal result chip no longer suppresses the verdict (openhuman#6025):+ // the chip sits on the row until the NEXT sync starts, so `!result` hid a+ // real hole in recall indefinitely — exactly the incident this file exists+ // for. The verdict now tells a draining backlog from a stuck one itself,+ // so the chip is not needed as a proxy. This case was written, and skipped,+ // as the spec for that fix; it went green the moment the fix landed.+ it('still warns after a sync finishes while chunks remain unembedded', () => {renderRow({status: storedWithoutVectors(),progress: null,- result: { ok: true } as unknown as React.ComponentProps<typeof MemorySourceRow>['result'],+ result: { kind: 'success', items: 2581, note: null } as unknown as React.ComponentProps<+ typeof MemorySourceRow+ >['result'],});expect(warning()).toBeInTheDocument();@@ -208,3 +211,78 @@ describe('MemorySourceRow — what suppresses the warning', () => {expect(screen.queryByTestId(`memory-source-signin-${SOURCE_ID}`)).not.toBeInTheDocument();});});++describe('MemorySourceRow — a backlog that is still draining is pending, not failed (openhuman#6025)', () => {+ const pendingNote = () => screen.queryByTestId(`memory-source-vectors-pending-${SOURCE_ID}`);++ it('shows the neutral waiting note, not the warning, while a re-embed chain has rows to process', () => {+ // The report: 676 chunks, 322 pending, ten minutes after a Gmail sync, and+ // the row went amber for a backlog the engine was already draining.+ renderRow({+ status: storedWithoutVectors({ chunks_synced: 676, chunks_pending: 322 }),+ backfill: { in_progress: true, pending_jobs: 1 },+ });++ expect(warning()).not.toBeInTheDocument();+ const note = pendingNote();+ expect(note).toBeInTheDocument();+ expect(note).toHaveTextContent('322 chunks waiting for vectors');+ // The freshness pill stays; the amber "Ingested only" pill does not appear.+ expect(screen.getByText('sync.idle')).toBeInTheDocument();+ expect(+ screen.queryByTestId(`memory-source-ingested-only-${SOURCE_ID}`)+ ).not.toBeInTheDocument();+ });++ it('shows the waiting note while the newest chunk is recent, even with no backfill snapshot', () => {+ renderRow({+ status: storedWithoutVectors({+ chunks_pending: 4,+ freshness: 'recent',+ last_chunk_at_ms: Date.now(),+ }),+ backfill: null,+ });++ expect(warning()).not.toBeInTheDocument();+ expect(pendingNote()).toBeInTheDocument();+ });++ it('keeps the waiting note beside a fresh result chip', () => {+ // The minutes right after `completed` are exactly when the backlog is+ // visible; the chip must hide neither the note nor (above) the warning.+ renderRow({+ status: storedWithoutVectors({ chunks_pending: 322, freshness: 'active' }),+ backfill: { in_progress: true, pending_jobs: 1 },+ result: { kind: 'success', items: 500, note: null } as unknown as React.ComponentProps<+ typeof MemorySourceRow+ >['result'],+ });++ expect(screen.getByTestId(`memory-source-result-${SOURCE_ID}`)).toBeInTheDocument();+ expect(pendingNote()).toBeInTheDocument();+ expect(warning()).not.toBeInTheDocument();+ });++ it('turns amber once the backlog is idle with no chain queued', () => {+ renderRow({+ status: storedWithoutVectors({ chunks_pending: 322 }),+ backfill: { in_progress: false, pending_jobs: 0 },+ });++ expect(pendingNote()).not.toBeInTheDocument();+ expect(warning()).toBeInTheDocument();+ });++ it('hides the note while a sync is actively reporting progress', () => {+ renderRow({+ status: storedWithoutVectors({ chunks_pending: 322, freshness: 'active' }),+ backfill: { in_progress: true, pending_jobs: 1 },+ progress: { processed: 10, total: 2581 } as unknown as React.ComponentProps<+ typeof MemorySourceRow+ >['progress'],+ });++ expect(pendingNote()).not.toBeInTheDocument();+ });+});diff --git a/app/src/components/intelligence/MemorySourceRow.test.tsx b/app/src/components/intelligence/MemorySourceRow.test.tsxindex 1ea2f57324..d744f8c025 100644--- a/app/src/components/intelligence/MemorySourceRow.test.tsx+++ b/app/src/components/intelligence/MemorySourceRow.test.tsx@@ -36,6 +36,7 @@ function renderRow(overrides: Partial<React.ComponentProps<typeof MemorySourceRosource: makeSource(),status: null,pipeline: null,+ backfill: null,isAuthenticated: true,isSyncing: false,isBuilding: false,diff --git a/app/src/components/intelligence/MemorySourceRow.tsx b/app/src/components/intelligence/MemorySourceRow.tsxindex b06ba5d3da..6df4502c20 100644--- a/app/src/components/intelligence/MemorySourceRow.tsx+++ b/app/src/components/intelligence/MemorySourceRow.tsx@@ -15,7 +15,10 @@ import {type SourceStatus,} from '../../services/memorySourcesService';import type { ToastNotification } from '../../types/intelligence';-import type { MemoryTreePipelineStatus } from '../../utils/tauriCommands/memoryTree';+import type {+ BackfillStatus,+ MemoryTreePipelineStatus,+} from '../../utils/tauriCommands/memoryTree';import Button from '../ui/Button';import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger } from '../ui/Collapsible';import Switch from '../ui/Switch';@@ -38,6 +41,7 @@ import {deriveSourcePipelineHealth,pipelineIssueMessageKey,type SourcePipelineHealth,+ VECTORS_PENDING_MESSAGE_KEY,} from './sourcePipelineStatus';import { SourceSettingsPanel } from './SourceSettingsPanel';@@ -46,6 +50,12 @@ interface SourceRowProps {status: SourceStatus | null;/** Global downstream pipeline health (GH-4690); `null` before first poll. */pipeline: MemoryTreePipelineStatus | null;+ /**+ * Global embed-backfill snapshot (openhuman#6025); `null` before the first+ * poll or when that RPC failed. Tells a backlog that is being drained from+ * one nothing is working on.+ */+ backfill: BackfillStatus | null;/** Whether a backend session exists — gates the "Sign in to enable" prompt. */isAuthenticated: boolean;isSyncing: boolean;@@ -82,6 +92,7 @@ export function MemorySourceRow({source,status,pipeline,+ backfill,isAuthenticated,isSyncing,isBuilding,@@ -104,21 +115,29 @@ export function MemorySourceRow({const detail = sourceDetail(source);const lastSync = status ? relativeTimestamp(status.last_chunk_at_ms, t) : null;- // GH-4690: layered pipeline verdict. Only meaningful in a settled state —- // during an active sync (`progress`) or right after one (`result`) the row- // renders live progress / a terminal chip instead, and `chunks_pending` is- // legitimately transient, so we suppress the warning until things settle.- const settled = !progress && !result;+ // GH-4690: layered pipeline verdict. Only meaningful once no sync is+ // reporting live progress — mid-run the row renders the progress bar+ // instead. A terminal result chip does NOT suppress it (openhuman#6025):+ // the chip sits on the row until the next sync starts, and the minutes+ // right after `completed` are exactly when the embed backlog is visible.+ // The verdict itself tells a draining backlog (neutral note) from a stuck+ // one (amber warning), so it no longer needs the chip as a proxy.+ const settled = !progress;const noteKey = result ? syncNoteKey(result) : null;const health: SourcePipelineHealth = settled- ? deriveSourcePipelineHealth(status, pipeline)- : { state: 'none', issues: [], authRelated: false };+ ? deriveSourcePipelineHealth(status, pipeline, backfill)+ : { state: 'none', issues: [], authRelated: false, vectorsPending: false };const ingestedOnly = health.state === 'ingested_only';if (ingestedOnly) {console.debug(`[ui-flow][memory-sources] source=${source.id} ingested-only issues=${health.issues.join(',')}`);}+ if (health.vectorsPending) {+ console.debug(+ `[ui-flow][memory-sources] source=${source.id} vectors-pending chunks=${status?.chunks_pending ?? 0}`+ );+ }return (<li className="py-3" data-testid={`memory-source-row-${source.kind}`}>@@ -229,6 +248,17 @@ export function MemorySourceRow({)}</div>)}+ {health.vectorsPending && status && (+ <p+ className="mt-1 pl-7 text-xs text-content-muted"+ data-testid={`memory-source-vectors-pending-${source.id}`}+ role="status">+ {t(VECTORS_PENDING_MESSAGE_KEY).replace(+ '{count}',+ status.chunks_pending.toLocaleString()+ )}+ </p>+ )}{ingestedOnly && (<divclassName="mt-2 flex flex-col gap-1 rounded-md border border-amber-200 bg-amber-50 px-2.5 py-1.5 pl-7 text-xs text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200"diff --git a/app/src/components/intelligence/MemorySourcesRegistry.tsx b/app/src/components/intelligence/MemorySourcesRegistry.tsxindex d1bef91041..5505a03d5b 100644--- a/app/src/components/intelligence/MemorySourcesRegistry.tsx+++ b/app/src/components/intelligence/MemorySourcesRegistry.tsx@@ -29,7 +29,9 @@ import type {} from '../../types/intelligence';import {type BackfillConnectorTreesResponse,+ type BackfillStatus,memoryTreeBackfillConnectorTrees,+ memoryTreeBackfillStatus,memoryTreeFlushSource,memoryTreePipelineStatus,type MemoryTreePipelineStatus,@@ -79,6 +81,10 @@ export function MemorySourcesRegistry({// ingested but failed embeddings/extraction/tree-build shows a warning rather// than a clean synced badge. `null` until the first poll resolves.const [pipeline, setPipeline] = useState<MemoryTreePipelineStatus | null>(null);+ // Global embed-backfill snapshot (openhuman#6025): whether a re-embed chain+ // still has rows to process. Rows use it to tell a backlog that is being+ // drained (neutral note) from one nothing is working on (amber warning).+ const [backfill, setBackfill] = useState<BackfillStatus | null>(null);const [loading, setLoading] = useState(true);const [dialogOpen, setDialogOpen] = useState(false);// The live sync state — which rows are syncing, their bar, their last@@ -166,7 +172,7 @@ export function MemorySourcesRegistry({const refresh = useCallback(async () => {try {- const [list, stats, health] = await Promise.all([+ const [list, stats, health, backfillStatus] = await Promise.all([listMemorySources().catch(err => {console.warn('[ui-flow][memory-sources] list failed', err);return [] as MemorySourceEntry[];@@ -182,10 +188,17 @@ export function MemorySourcesRegistry({console.warn('[ui-flow][memory-sources] pipeline_status failed', err);return null;}),+ // openhuman#6025: embed work in flight. Best-effort like the pipeline+ // snapshot — `null` makes rows fall back to their own freshness.+ memoryTreeBackfillStatus().catch(err => {+ console.warn('[ui-flow][memory-sources] backfill_status failed', err);+ return null;+ }),]);setSources(list);setStatuses(stats);setPipeline(health);+ setBackfill(backfillStatus);// The core's own account of what is in flight (`sync_stage`,// openhuman#6019): seeds the bar for a run this page never saw start —// a cold mount, an app reload mid-sync — and takes down a bar whose@@ -537,6 +550,7 @@ export function MemorySourcesRegistry({source={source}status={statusById.get(source.id) ?? null}pipeline={pipeline}+ backfill={backfill}isAuthenticated={isAuthenticated}isSyncing={syncingIds.has(source.id) || syncProgress.has(source.id)}isBuilding={buildingId === source.id}diff --git a/app/src/components/intelligence/__tests__/MemorySourcesRegistry.sync.test.tsx b/app/src/components/intelligence/__tests__/MemorySourcesRegistry.sync.test.tsxindex 12dab59797..b97fcac381 100644--- a/app/src/components/intelligence/__tests__/MemorySourcesRegistry.sync.test.tsx+++ b/app/src/components/intelligence/__tests__/MemorySourcesRegistry.sync.test.tsx@@ -61,6 +61,7 @@ vi.mock('../../analytics', () => ({vi.mock('../../../utils/tauriCommands/memoryTree', () => ({memoryTreeBackfillConnectorTrees: vi.fn(),+ memoryTreeBackfillStatus: vi.fn().mockResolvedValue({ in_progress: false, pending_jobs: 0 }),memoryTreeFlushSource: vi.fn().mockResolvedValue({ seals_fired: 0 }),memoryTreePipelineStatus: vi.fn()diff --git a/app/src/components/intelligence/__tests__/MemorySourcesRegistry.test.tsx b/app/src/components/intelligence/__tests__/MemorySourcesRegistry.test.tsxindex 58f19a028f..3437c5a8f4 100644--- a/app/src/components/intelligence/__tests__/MemorySourcesRegistry.test.tsx+++ b/app/src/components/intelligence/__tests__/MemorySourcesRegistry.test.tsx@@ -17,6 +17,7 @@ import {openhumanUpdateMemorySyncSettings,} from '../../../utils/tauriCommands/config';import {+ memoryTreeBackfillStatus,memoryTreePipelineStatus,type MemoryTreePipelineStatus,} from '../../../utils/tauriCommands/memoryTree';@@ -39,9 +40,11 @@ vi.mock('../../../services/memorySourcesService', async () => {});// Mock tauriCommands/memoryTree. The registry now also polls-// memoryTreePipelineStatus for downstream health (GH-4690); default it to a-// healthy running snapshot so no source row shows a spurious warning.+// memoryTreePipelineStatus for downstream health (GH-4690) and+// memoryTreeBackfillStatus for embed work in flight (openhuman#6025); default+// both to a healthy, idle snapshot so no source row shows a spurious warning.vi.mock('../../../utils/tauriCommands/memoryTree', () => ({+ memoryTreeBackfillStatus: vi.fn().mockResolvedValue({ in_progress: false, pending_jobs: 0 }),memoryTreeFlushSource: vi.fn().mockResolvedValue({ seals_fired: 0 }),memoryTreePipelineStatus: vi.fn()@@ -70,6 +73,7 @@ const mockedApplyAllIn = vi.mocked(service.applyAllIn);const mockedGetSync = vi.mocked(openhumanGetMemorySyncSettings);const mockedUpdateSync = vi.mocked(openhumanUpdateMemorySyncSettings);const mockedPipeline = vi.mocked(memoryTreePipelineStatus);+const mockedBackfill = vi.mocked(memoryTreeBackfillStatus);/** A healthy `memory_tree_pipeline_status` snapshot (no degradation). */function healthyPipeline(@@ -131,6 +135,7 @@ describe('MemorySourcesRegistry', () => {// Default: schedule RPCs succeed with the unset/default 24h view.mockedGetSync.mockResolvedValue(syncSettings());mockedUpdateSync.mockResolvedValue(syncSettings());+ mockedBackfill.mockResolvedValue({ in_progress: false, pending_jobs: 0 });});// -------------------------------------------------------------------------@@ -149,6 +154,53 @@ describe('MemorySourcesRegistry', () => {await screen.findByText(/no memory sources/i);});+ // -------------------------------------------------------------------------+ // Embed backlog: pending vs stuck (openhuman#6025)+ // -------------------------------------------------------------------------+ it('hands the backfill snapshot to rows so a draining backlog reads as pending, not failed', async () => {+ // Nothing about this source alone says "still moving" (idle freshness);+ // only the registry's backfill poll does. If the poll were not wired+ // through to the row, this would render the amber warning.+ mockedStatus.mockResolvedValue([+ {+ source_id: 'src_1',+ chunks_synced: 10,+ chunks_pending: 4,+ last_chunk_at_ms: 0,+ freshness: 'idle',+ },+ ]);+ mockedBackfill.mockResolvedValue({ in_progress: true, pending_jobs: 1 });+ mockedList.mockResolvedValue([makeSource()]);+ renderWithProviders(<MemorySourcesRegistry pollIntervalMs={0} />);++ const note = await screen.findByTestId('memory-source-vectors-pending-src_1');+ expect(note).toHaveTextContent('4 chunks waiting for vectors');+ expect(screen.queryByTestId('memory-source-pipeline-warning-src_1')).not.toBeInTheDocument();+ expect(mockedBackfill).toHaveBeenCalled();+ });++ it('falls back to the amber warning when the backfill poll fails and nothing is fresh', async () => {+ // Best-effort: a failed backfill RPC must neither hide the source list+ // nor invent a "draining" state. With the source idle, the truthful+ // verdict is the warning.+ mockedStatus.mockResolvedValue([+ {+ source_id: 'src_1',+ chunks_synced: 10,+ chunks_pending: 4,+ last_chunk_at_ms: 0,+ freshness: 'idle',+ },+ ]);+ mockedBackfill.mockRejectedValue(new Error('backfill_status unavailable'));+ mockedList.mockResolvedValue([makeSource()]);+ renderWithProviders(<MemorySourcesRegistry pollIntervalMs={0} />);++ await screen.findByTestId('memory-source-pipeline-warning-src_1');+ expect(screen.queryByTestId('memory-source-vectors-pending-src_1')).not.toBeInTheDocument();+ });+// -------------------------------------------------------------------------// Toggle (existing behaviour)// -------------------------------------------------------------------------@@ -622,8 +674,10 @@ describe('MemorySourcesRegistry', () => {source_id: 'src_1',chunks_synced: 1,chunks_pending: 1,- last_chunk_at_ms: Date.now(),- freshness: 'recent',+ // Long idle: nothing is draining this backlog (openhuman#6025 —+ // a recent chunk or a running backfill would read as "pending").+ last_chunk_at_ms: Date.now() - 60 * 60_000,+ freshness: 'idle',},]);// Even with a "healthy" global snapshot, the per-source pending chunks@@ -637,7 +691,7 @@ describe('MemorySourcesRegistry', () => {/Stored without vectors/i);// Clean freshness badge must be gone.- expect(screen.queryByText('Recent')).not.toBeInTheDocument();+ expect(screen.queryByText('Idle')).not.toBeInTheDocument();// A link to the full memory-health panel is offered.expect(screen.getByTestId('memory-source-view-health-src_1')).toBeInTheDocument();});diff --git a/app/src/components/intelligence/sourcePipelineStatus.test.ts b/app/src/components/intelligence/sourcePipelineStatus.test.tsindex ce16c0ca47..ca026f090e 100644--- a/app/src/components/intelligence/sourcePipelineStatus.test.ts+++ b/app/src/components/intelligence/sourcePipelineStatus.test.ts@@ -5,7 +5,10 @@import { describe, expect, it } from 'vitest';import type { SourceStatus } from '../../services/memorySourcesService';-import type { MemoryTreePipelineStatus } from '../../utils/tauriCommands/memoryTree';+import type {+ BackfillStatus,+ MemoryTreePipelineStatus,+} from '../../utils/tauriCommands/memoryTree';import {deriveSourcePipelineHealth,pipelineIssueMessageKey,@@ -37,6 +40,11 @@ function makePipeline(overrides: Partial<MemoryTreePipelineStatus> = {}): Memory};}+/** The global embed-backfill snapshot (`memory_tree_memory_backfill_status`). */+function makeBackfill(overrides: Partial<BackfillStatus> = {}): BackfillStatus {+ return { in_progress: false, pending_jobs: 0, ...overrides };+}+describe('deriveSourcePipelineHealth', () => {it('returns none when nothing has been ingested yet', () => {const h = deriveSourcePipelineHealth(makeStatus({ chunks_synced: 0 }), makePipeline());@@ -68,8 +76,12 @@ describe('deriveSourcePipelineHealth', () => {// -- Layer 1: embeddings ---------------------------------------------------it('flags stored_without_vectors from per-source pending chunks alone', () => {- // The exact issue repro: "1 chunk / 1 pending" with no pipeline snapshot.- const h = deriveSourcePipelineHealth(makeStatus({ chunks_synced: 1, chunks_pending: 1 }), null);+ // The exact issue repro: "1 chunk / 1 pending" with no pipeline snapshot,+ // and nothing draining it: no backfill snapshot, newest chunk long idle.+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_synced: 1, chunks_pending: 1, freshness: 'idle' }),+ null+ );expect(h.state).toBe('ingested_only');expect(h.issues).toContain('stored_without_vectors');});@@ -171,6 +183,124 @@ describe('deriveSourcePipelineHealth', () => {});});+// -- Layer 1, the soft half: a backlog that is being drained (openhuman#6025)+describe('deriveSourcePipelineHealth — vectors pending vs stored without vectors', () => {+ it('reads pending chunks as vectors_pending while a re-embed chain has rows to process', () => {+ // The incident's numbers: 676 synced, 322 waiting, the backfill row queued+ // behind extraction. Nothing failed; the row must not say it did.+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_synced: 676, chunks_pending: 322, freshness: 'idle' }),+ makePipeline(),+ makeBackfill({ in_progress: true, pending_jobs: 1 })+ );+ expect(h.state).toBe('vectors_pending');+ expect(h.vectorsPending).toBe(true);+ expect(h.issues).toEqual([]);+ expect(h.authRelated).toBe(false);+ });++ it('reads pending chunks as vectors_pending while the newest chunk is active, with no backfill snapshot', () => {+ // The backfill RPC failed (or predates this build): the source's own+ // freshness carries the "still moving" judgement on its own.+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_synced: 10, chunks_pending: 4, freshness: 'active' }),+ null+ );+ expect(h.state).toBe('vectors_pending');+ });++ it('reads pending chunks as vectors_pending while the newest chunk is recent (under five minutes)', () => {+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_synced: 10, chunks_pending: 4, freshness: 'recent' }),+ null,+ makeBackfill({ in_progress: false })+ );+ expect(h.state).toBe('vectors_pending');+ });++ it('flags stored_without_vectors once the backlog is idle with no chain queued', () => {+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_synced: 10, chunks_pending: 4, freshness: 'idle' }),+ makePipeline(),+ makeBackfill({ in_progress: false })+ );+ expect(h.state).toBe('ingested_only');+ expect(h.issues).toEqual(['stored_without_vectors']);+ expect(h.vectorsPending).toBe(false);+ });++ it('lets the global recall latch win over a draining backfill', () => {+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_pending: 4, freshness: 'active' }),+ makePipeline({ status: 'degraded', degraded: { semantic_recall: true, structure: false } }),+ makeBackfill({ in_progress: true })+ );+ expect(h.state).toBe('ingested_only');+ expect(h.issues).toContain('stored_without_vectors');+ expect(h.vectorsPending).toBe(false);+ });++ it.each([+ 'budget_exhausted',+ 'auth_missing',+ 'auth_invalid',+ 'embeddings_unconfigured',+ 'embedding_dim_mismatch',+ 'local_model_unavailable',+ ] as const)(+ 'lets an embeddings-family blocking cause (%s) win over a draining backfill',+ code => {+ // The provider cannot write vectors, so the backlog is not going to drain+ // whatever the chain flag says; that is the hard state, sign-in CTA and all.+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_pending: 4, freshness: 'active' }),+ makePipeline({+ status: 'error',+ first_blocking_cause: {+ code,+ class: 'unrecoverable',+ remediation_key: `memory.health.remediation.${code}`,+ },+ }),+ makeBackfill({ in_progress: true })+ );+ expect(h.issues).toContain('stored_without_vectors');+ expect(h.vectorsPending).toBe(false);+ expect(h.authRelated).toBe(code === 'auth_missing');+ }+ );++ it('keeps a non-embeddings blocking cause from turning a draining backlog amber', () => {+ // Extraction timing out says nothing about the embedder; the vectors are+ // still coming. Both truths are carried: the extraction warning AND the+ // neutral pending note.+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_pending: 4, freshness: 'active' }),+ makePipeline({+ status: 'degraded',+ first_blocking_cause: {+ code: 'extraction_timeout',+ class: 'transient',+ remediation_key: 'memory.health.remediation.extraction_timeout',+ },+ })+ );+ expect(h.state).toBe('ingested_only');+ expect(h.issues).toEqual(['extraction_failed']);+ expect(h.vectorsPending).toBe(true);+ });++ it('stays retrieval_ready when a backfill runs but this source has nothing pending', () => {+ const h = deriveSourcePipelineHealth(+ makeStatus({ chunks_pending: 0 }),+ makePipeline(),+ makeBackfill({ in_progress: true, pending_jobs: 1 })+ );+ expect(h.state).toBe('retrieval_ready');+ expect(h.vectorsPending).toBe(false);+ });+});+describe('pipelineIssueMessageKey', () => {it('maps every issue kind to a stable i18n key', () => {const kinds: SourcePipelineIssueKind[] = [diff --git a/app/src/components/intelligence/sourcePipelineStatus.ts b/app/src/components/intelligence/sourcePipelineStatus.tsindex 87c2643cd4..1cc02e4c8b 100644--- a/app/src/components/intelligence/sourcePipelineStatus.ts+++ b/app/src/components/intelligence/sourcePipelineStatus.ts@@ -8,23 +8,35 @@* showed a clean freshness badge in all those cases and the user only learned* the truth in Brain > Memory > Sync or the raw logs.*- * This module folds two signals the core already exposes into one per-row+ * This module folds three signals the core already exposes into one per-row* verdict so the row can honestly say "Ingested only" instead of "synced":** 1. **Per-source, precise** — `SourceStatus.chunks_pending` is the SQL count- * of this source's chunks whose `embedding IS NULL` (see- * `memory_sources/status.rs`). `> 0` in a settled state means those chunks- * were stored WITHOUT vectors → semantic search can't reach them.+ * of this source's chunks with no vector at the active embedding signature+ * (see `memory_sources/status.rs`). `> 0` means semantic search cannot+ * reach those chunks *yet*.* 2. **Global pipeline health** — `memory_tree_pipeline_status` (the same RPC* that drives the Brain > Memory > Sync "Degraded" panel) carries the* process-wide `degraded` snapshot + `first_blocking_cause`. Embedding /* extraction / tree-degraded causes there are attributed to the whole* pipeline, so we surface them on rows that actually contributed chunks.+ * 3. **Embed work in flight** — `memory_tree_memory_backfill_status` says+ * whether a re-embed chain still has rows to process. Since tinymemory+ * 1.14 chunks get their vectors from that chain, not inline at ingest, so+ * every sizeable sync leaves a backlog for a few minutes+ * (openhuman#6025). A backlog that is being drained is *pending*, not+ * *failed*: the row shows a neutral note and keeps its freshness pill. The+ * amber warning is reserved for a backlog nothing will drain: the global+ * recall latch, an embeddings-family blocking cause, or pending chunks with+ * no chain queued and no chunk written for over five minutes.** The function is pure so it can be unit-tested exhaustively without a DOM.*/import type { SourceStatus } from '../../services/memorySourcesService';-import type { MemoryTreePipelineStatus } from '../../utils/tauriCommands/memoryTree';+import type {+ BackfillStatus,+ MemoryTreePipelineStatus,+} from '../../utils/tauriCommands/memoryTree';/** One failed layer of the post-ingest pipeline, in severity-display order. */export type SourcePipelineIssueKind =@@ -33,12 +45,14 @@ export type SourcePipelineIssueKind =| 'tree_degraded';/** Coarse retrieval-readiness state for a single source row. */-export type SourcePipelineState = 'none' | 'retrieval_ready' | 'ingested_only';+export type SourcePipelineState = 'none' | 'retrieval_ready' | 'vectors_pending' | 'ingested_only';export interface SourcePipelineHealth {/*** `none` — nothing ingested yet (no badge changes; row renders as before).* `retrieval_ready` — chunks synced AND no downstream failure (clean state).+ * `vectors_pending` — chunks synced, some still waiting for an embed+ * backfill that is provably working on them (neutral note, no warning).* `ingested_only` — chunks synced but ≥1 downstream layer failed (warn).*/state: SourcePipelineState;@@ -51,25 +65,50 @@ export interface SourcePipelineHealth {* `stored_without_vectors`.*/authRelated: boolean;+ /**+ * True when this source has chunks waiting for vectors AND the backlog is+ * being drained (the soft state). Carried separately from `state` so the+ * row can still show the neutral note beside another layer's warning.+ */+ vectorsPending: boolean;}+/**+ * Blocking causes that mean the embeddings provider itself cannot write+ * vectors, so a pending backlog is not going to drain on its own. Anything+ * else (`transient`, `extraction_timeout`, …) leaves the backfill able to+ * finish, and the row must not read the backlog as a failure.+ */+const EMBEDDINGS_BLOCKING_CAUSES: ReadonlySet<string> = new Set([+ 'budget_exhausted',+ 'auth_missing',+ 'auth_invalid',+ 'embeddings_unconfigured',+ 'embedding_dim_mismatch',+ 'local_model_unavailable',+]);+/*** Compute the layered pipeline verdict for one source row.** `status` is this source's `memory_sources_status_list` entry; `pipeline` is* the global `memory_tree_pipeline_status` snapshot (may be `null` when that- * RPC hasn't resolved / failed — the per-source signal still stands on its own).+ * RPC hasn't resolved / failed — the per-source signal still stands on its+ * own); `backfill` is the global `memory_tree_memory_backfill_status` snapshot+ * (`null` when unavailable — the row then falls back to the source's own+ * freshness to decide whether a backlog is still moving).*/export function deriveSourcePipelineHealth(status: SourceStatus | null,- pipeline: MemoryTreePipelineStatus | null+ pipeline: MemoryTreePipelineStatus | null,+ backfill: BackfillStatus | null = null): SourcePipelineHealth {const synced = status?.chunks_synced ?? 0;// Nothing ingested yet → don't invent a warning. The row keeps its existing// (empty / mid-sync) rendering.if (synced <= 0) {- return { state: 'none', issues: [], authRelated: false };+ return { state: 'none', issues: [], authRelated: false, vectorsPending: false };}const degraded = pipeline?.degraded;@@ -77,14 +116,29 @@ export function deriveSourcePipelineHealth(const issues: SourcePipelineIssueKind[] = [];- // Layer 1 — embeddings. Precise per-source signal (chunks with NULL- // embedding) OR the global "semantic recall degraded" latch (no usable- // embeddings provider). Either means this source's chunks aren't vector-searchable.- const storedWithoutVectors =- (status?.chunks_pending ?? 0) > 0 || degraded?.semantic_recall === true;+ // Layer 1 — embeddings. `chunks_pending` alone is ambiguous: right after a+ // sync it is the backfill's to-do list, minutes later with nothing queued+ // it is a hole in recall. Three signals settle which (openhuman#6025):+ //+ // - the global "semantic recall degraded" latch (no usable provider): hard;+ // - an embeddings-family blocking cause: the provider cannot write vectors,+ // so the backlog will not drain: hard;+ // - otherwise pending chunks are soft while the engine reports a re-embed+ // chain with rows to process, OR this source's newest chunk landed inside+ // the core's own `recent` window (≤ 5 min: ingest is still writing and+ // the chain is queued behind it). A backlog with neither is stuck: hard.+ const pending = status?.chunks_pending ?? 0;+ const recallLatched = degraded?.semantic_recall === true;+ const embeddingsBlocked = causeCode !== null && EMBEDDINGS_BLOCKING_CAUSES.has(causeCode);+ const draining =+ backfill?.in_progress === true ||+ status?.freshness === 'active' ||+ status?.freshness === 'recent';+ const storedWithoutVectors = recallLatched || (pending > 0 && (embeddingsBlocked || !draining));if (storedWithoutVectors) {issues.push('stored_without_vectors');}+ const vectorsPending = !storedWithoutVectors && pending > 0;// Layer 2 — extraction. `degraded.structure` exists but has no production// producer today (test-only), so the live signal is the typed@@ -108,7 +162,10 @@ export function deriveSourcePipelineHealth(const authRelated = storedWithoutVectors && causeCode === 'auth_missing';- return { state: issues.length > 0 ? 'ingested_only' : 'retrieval_ready', issues, authRelated };+ const state: SourcePipelineState =+ issues.length > 0 ? 'ingested_only' : vectorsPending ? 'vectors_pending' : 'retrieval_ready';++ return { state, issues, authRelated, vectorsPending };}/** i18n key for a given issue's row warning message. */@@ -122,3 +179,6 @@ export function pipelineIssueMessageKey(kind: SourcePipelineIssueKind): string {return 'sync.pipeline.treeDegraded';}}++/** i18n key for the neutral "waiting for vectors" note (`{count}` placeholder). */+export const VECTORS_PENDING_MESSAGE_KEY = 'sync.pipeline.vectorsPending';diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.tsindex fe1c7ff736..ead3312491 100644--- a/app/src/lib/i18n/ar.ts+++ b/app/src/lib/i18n/ar.ts@@ -6479,6 +6479,7 @@ const messages: TranslationMap = {// Data Sync layered pipeline status (GH-4690)'sync.pipeline.ingestedOnly': 'تم الاستيعاب فقط','sync.pipeline.storedWithoutVectors': 'مخزَّن بدون متجهات. البحث الدلالي غير متاح.',+ 'sync.pipeline.vectorsPending': '{count} أجزاء في انتظار المتجهات. سيشملها البحث الدلالي قريبًا.','sync.pipeline.signInToEnable': 'سجّل الدخول للتفعيل','sync.pipeline.extractionFailed': 'فشل استخراج بنية الذاكرة. قد يكون الويكي غير مكتمل.','sync.pipeline.treeDegraded': 'شجرة الذاكرة متدهورة. قد يُرجع الاسترجاع نتائج قديمة.',diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.tsindex 6ae2a65470..a185e7a015 100644--- a/app/src/lib/i18n/bn.ts+++ b/app/src/lib/i18n/bn.ts@@ -6631,6 +6631,8 @@ const messages: TranslationMap = {// Data Sync layered pipeline status (GH-4690)'sync.pipeline.ingestedOnly': 'শুধু গৃহীত','sync.pipeline.storedWithoutVectors': 'ভেক্টর ছাড়াই সংরক্ষিত। শব্দার্থিক অনুসন্ধান অনুপলব্ধ।',+ 'sync.pipeline.vectorsPending':+ '{count}টি চাংক ভেক্টরের জন্য অপেক্ষা করছে। শব্দার্থিক অনুসন্ধান শীঘ্রই সেগুলি অন্তর্ভুক্ত করবে।','sync.pipeline.signInToEnable': 'সক্রিয় করতে সাইন ইন করুন','sync.pipeline.extractionFailed': 'মেমরি কাঠামো নিষ্কাশন ব্যর্থ হয়েছে। উইকি অসম্পূর্ণ হতে পারে।','sync.pipeline.treeDegraded': 'মেমরি ট্রি অবনমিত। পুনরুদ্ধার পুরনো ফলাফল দিতে পারে।',diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.tsindex 8f5fafdc15..bf5f54e259 100644--- a/app/src/lib/i18n/de.ts+++ b/app/src/lib/i18n/de.ts@@ -6818,6 +6818,8 @@ const messages: TranslationMap = {'sync.pipeline.ingestedOnly': 'Nur aufgenommen','sync.pipeline.storedWithoutVectors':'Ohne Vektoren gespeichert. Semantische Suche nicht verfügbar.',+ 'sync.pipeline.vectorsPending':+ '{count} Brocken warten auf Vektoren. Die semantische Suche deckt sie in Kürze ab.','sync.pipeline.signInToEnable': 'Zum Aktivieren anmelden','sync.pipeline.extractionFailed':'Extraktion der Speicherstruktur fehlgeschlagen. Das Wiki ist möglicherweise unvollständig.',diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.tsindex 8e816cab95..ec91a82fb0 100644--- a/app/src/lib/i18n/en.ts+++ b/app/src/lib/i18n/en.ts@@ -2952,6 +2952,8 @@ const en: TranslationMap = {// Data Sync layered pipeline status (GH-4690) — raw sync ≠ retrieval-ready'sync.pipeline.ingestedOnly': 'Ingested only','sync.pipeline.storedWithoutVectors': 'Stored without vectors. Semantic search unavailable.',+ 'sync.pipeline.vectorsPending':+ '{count} chunks waiting for vectors. Semantic search will cover them shortly.','sync.pipeline.signInToEnable': 'Sign in to enable','sync.pipeline.extractionFailed': 'Memory structure extraction failed. Wiki may be incomplete.','sync.pipeline.treeDegraded': 'Memory tree degraded. Retrieval may return stale results.',diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.tsindex 13a9bb57c8..6d952c0622 100644--- a/app/src/lib/i18n/es.ts+++ b/app/src/lib/i18n/es.ts@@ -6777,6 +6777,8 @@ const messages: TranslationMap = {'sync.pipeline.ingestedOnly': 'Solo ingerido','sync.pipeline.storedWithoutVectors':'Almacenado sin vectores. La búsqueda semántica no está disponible.',+ 'sync.pipeline.vectorsPending':+ '{count} fragmentos esperan vectores. La búsqueda semántica los cubrirá en breve.','sync.pipeline.signInToEnable': 'Inicia sesión para activar','sync.pipeline.extractionFailed':'Error al extraer la estructura de memoria. Es posible que el wiki esté incompleto.',diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.tsindex 557ff3bdbe..2ac975d42e 100644--- a/app/src/lib/i18n/fr.ts+++ b/app/src/lib/i18n/fr.ts@@ -6804,6 +6804,8 @@ const messages: TranslationMap = {'sync.pipeline.ingestedOnly': 'Ingéré uniquement','sync.pipeline.storedWithoutVectors':'Enregistré sans vecteurs. Recherche sémantique indisponible.',+ 'sync.pipeline.vectorsPending':+ '{count} segments attendent leurs vecteurs. La recherche sémantique les couvrira sous peu.','sync.pipeline.signInToEnable': 'Connectez-vous pour activer','sync.pipeline.extractionFailed':"Échec de l'extraction de la structure mémoire. Le wiki peut être incomplet.",diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.tsindex f2cb6c40f2..99fb9bcf07 100644--- a/app/src/lib/i18n/hi.ts+++ b/app/src/lib/i18n/hi.ts@@ -6630,6 +6630,8 @@ const messages: TranslationMap = {// Data Sync layered pipeline status (GH-4690)'sync.pipeline.ingestedOnly': 'केवल अंतर्ग्रहीत','sync.pipeline.storedWithoutVectors': 'वेक्टर के बिना संग्रहीत। सिमेंटिक खोज अनुपलब्ध।',+ 'sync.pipeline.vectorsPending':+ '{count} चंक्स वेक्टर की प्रतीक्षा में हैं। सिमेंटिक खोज जल्द ही उन्हें शामिल करेगी।','sync.pipeline.signInToEnable': 'सक्षम करने के लिए साइन इन करें','sync.pipeline.extractionFailed': 'मेमोरी संरचना निष्कर्षण विफल रहा। विकी अपूर्ण हो सकता है।','sync.pipeline.treeDegraded': 'मेमोरी ट्री अवक्रमित। पुनर्प्राप्ति पुराने परिणाम दे सकती है।',diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.tsindex 6a29e24434..54f12edcd5 100644--- a/app/src/lib/i18n/id.ts+++ b/app/src/lib/i18n/id.ts@@ -6666,6 +6666,8 @@ const messages: TranslationMap = {// Data Sync layered pipeline status (GH-4690)'sync.pipeline.ingestedOnly': 'Hanya diserap','sync.pipeline.storedWithoutVectors': 'Disimpan tanpa vektor. Pencarian semantik tidak tersedia.',+ 'sync.pipeline.vectorsPending':+ '{count} chunk menunggu vektor. Pencarian semantik akan segera mencakupnya.','sync.pipeline.signInToEnable': 'Masuk untuk mengaktifkan','sync.pipeline.extractionFailed': 'Ekstraksi struktur memori gagal. Wiki mungkin tidak lengkap.','sync.pipeline.treeDegraded':diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.tsindex 3f9a9e9487..62e49fa9d6 100644--- a/app/src/lib/i18n/it.ts+++ b/app/src/lib/i18n/it.ts@@ -6759,6 +6759,8 @@ const messages: TranslationMap = {'sync.pipeline.ingestedOnly': 'Solo acquisito','sync.pipeline.storedWithoutVectors':'Memorizzato senza vettori. Ricerca semantica non disponibile.',+ 'sync.pipeline.vectorsPending':+ '{count} chunk in attesa dei vettori. La ricerca semantica li coprirà a breve.','sync.pipeline.signInToEnable': 'Accedi per attivare','sync.pipeline.extractionFailed':'Estrazione della struttura della memoria non riuscita. Il wiki potrebbe essere incompleto.',diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.tsindex 2a8e01ce65..2370af617c 100644--- a/app/src/lib/i18n/ko.ts+++ b/app/src/lib/i18n/ko.ts@@ -6556,6 +6556,8 @@ const messages: TranslationMap = {// Data Sync layered pipeline status (GH-4690)'sync.pipeline.ingestedOnly': '수집만 완료','sync.pipeline.storedWithoutVectors': '벡터 없이 저장됨. 의미 검색을 사용할 수 없습니다.',+ 'sync.pipeline.vectorsPending':+ '{count}개 청크가 벡터를 기다리는 중입니다. 곧 시맨틱 검색에 포함됩니다.','sync.pipeline.signInToEnable': '사용하려면 로그인하세요','sync.pipeline.extractionFailed': '메모리 구조 추출에 실패했습니다. 위키가 불완전할 수 있습니다.','sync.pipeline.treeDegraded':diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.tsindex 9dfb955250..12527a1e6d 100644--- a/app/src/lib/i18n/pl.ts+++ b/app/src/lib/i18n/pl.ts@@ -6735,6 +6735,8 @@ const messages: TranslationMap = {'sync.pipeline.ingestedOnly': 'Tylko pobrano','sync.pipeline.storedWithoutVectors':'Zapisano bez wektorów. Wyszukiwanie semantyczne niedostępne.',+ 'sync.pipeline.vectorsPending':+ '{count} fragmentów czeka na wektory. Wyszukiwanie semantyczne wkrótce je obejmie.','sync.pipeline.signInToEnable': 'Zaloguj się, aby włączyć','sync.pipeline.extractionFailed':'Ekstrakcja struktury pamięci nie powiodła się. Wiki może być niekompletne.',diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.tsindex 968177ecbc..7e607625a7 100644--- a/app/src/lib/i18n/pt.ts+++ b/app/src/lib/i18n/pt.ts@@ -6745,6 +6745,8 @@ const messages: TranslationMap = {// Data Sync layered pipeline status (GH-4690)'sync.pipeline.ingestedOnly': 'Apenas ingerido','sync.pipeline.storedWithoutVectors': 'Armazenado sem vetores. Pesquisa semântica indisponível.',+ 'sync.pipeline.vectorsPending':+ '{count} blocos aguardam vetores. A pesquisa semântica irá abrangê-los em breve.','sync.pipeline.signInToEnable': 'Inicie sessão para ativar','sync.pipeline.extractionFailed':'Falha na extração da estrutura de memória. O wiki pode estar incompleto.',diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.tsindex a93515fe9b..ec0e67769d 100644--- a/app/src/lib/i18n/ru.ts+++ b/app/src/lib/i18n/ru.ts@@ -6706,6 +6706,8 @@ const messages: TranslationMap = {// Data Sync layered pipeline status (GH-4690)'sync.pipeline.ingestedOnly': 'Только загружено','sync.pipeline.storedWithoutVectors': 'Сохранено без векторов. Семантический поиск недоступен.',+ 'sync.pipeline.vectorsPending':+ '{count} блоков ожидают векторы. Семантический поиск скоро охватит их.','sync.pipeline.signInToEnable': 'Войдите, чтобы включить','sync.pipeline.extractionFailed':'Не удалось извлечь структуру памяти. Вики может быть неполной.',diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.tsindex ed2129d007..7800fffd30 100644--- a/app/src/lib/i18n/zh-CN.ts+++ b/app/src/lib/i18n/zh-CN.ts@@ -6265,6 +6265,7 @@ const messages: TranslationMap = {// Data Sync layered pipeline status (GH-4690)'sync.pipeline.ingestedOnly': '仅已导入','sync.pipeline.storedWithoutVectors': '已存储但无向量。语义搜索不可用。',+ 'sync.pipeline.vectorsPending': '{count} 个片段正在等待向量。语义搜索很快会覆盖它们。','sync.pipeline.signInToEnable': '登录以启用','sync.pipeline.extractionFailed': '记忆结构提取失败。维基可能不完整。','sync.pipeline.treeDegraded': '记忆树已降级。检索可能返回过时的结果。',diff --git a/app/test/playwright/specs/brain-embedding-truthfulness.spec.ts b/app/test/playwright/specs/brain-embedding-truthfulness.spec.tsindex 73f0a7934b..487b107017 100644--- a/app/test/playwright/specs/brain-embedding-truthfulness.spec.ts+++ b/app/test/playwright/specs/brain-embedding-truthfulness.spec.ts@@ -45,6 +45,41 @@ interface SourceStatus {chunks_pending: number;}+/** The slice of `memory_tree_pipeline_status` that decides hard vs soft. */+interface PipelineStatus {+ degraded?: { semantic_recall?: boolean } | null;+ first_blocking_cause?: { code?: string } | null;+}++/** Mirrors `EMBEDDINGS_BLOCKING_CAUSES` in `sourcePipelineStatus.ts`. */+const EMBEDDINGS_BLOCKING_CAUSES = new Set([+ 'budget_exhausted',+ 'auth_missing',+ 'auth_invalid',+ 'embeddings_unconfigured',+ 'embedding_dim_mismatch',+ 'local_model_unavailable',+]);++/**+ * Whether the core says embeddings cannot be written at all (no usable+ * provider, no session, budget gone), as opposed to merely not written YET.+ *+ * Since openhuman#6025 the row distinguishes the two: a backlog the engine is+ * still draining renders as a neutral "waiting for vectors" note, and the+ * amber "Stored without vectors" warning is reserved for the hard case. A lane+ * with no embeddings provider staged is the hard case; this reads the core's+ * own verdict rather than guessing from the lane's configuration.+ */+async function embeddingsHardDown(): Promise<boolean> {+ const status = await callCoreRpc<PipelineStatus>('openhuman.memory_tree_pipeline_status', {});+ const cause = status.first_blocking_cause?.code;+ return (+ status.degraded?.semantic_recall === true ||+ (cause !== undefined && EMBEDDINGS_BLOCKING_CAUSES.has(cause))+ );+}+async function seedDeveloperMode(page: Page): Promise<void> {await page.addInitScript(() => {try {@@ -187,6 +222,25 @@ function requireDegraded(status: SourceStatus | undefined): void {test.skip(!degraded, 'this core embedded every chunk, so there is no degraded state to surface');}+/**+ * Like {@link requireDegraded}, for the tests that need the amber warning+ * itself (its reload survival, its "View memory health" route). Pending+ * chunks alone no longer guarantee it (openhuman#6025): the core must also+ * report that embeddings are down, or the row is truthfully saying "waiting".+ */+async function requireHardDegraded(status: SourceStatus | undefined): Promise<void> {+ requireDegraded(status);+ const hard = await embeddingsHardDown();+ if (!hard && process.env.CI) {+ throw new Error(+ 'the backlog is merely draining (an embeddings provider is configured): this ' ++ 'lane cannot exercise the stored-without-vectors render. Stage the memory ' ++ 'module without an embeddings provider, or move this spec to a lane that can.'+ );+ }+ test.skip(!hard, 'this core is still embedding the backlog, so there is no failure to surface');+}+test.describe('Brain — the UI tells the truth about embedding state', () => {test('a source whose chunks were never embedded is visibly flagged, not shown as healthy', async ({page,@@ -210,18 +264,31 @@ test.describe('Brain — the UI tells the truth about embedding state', () => {.toBeGreaterThan(0);requireDegraded(status);+ const hard = await embeddingsHardDown();await openSources(page, 'pw-brain-unembedded');const row = page.getByTestId('memory-source-row-folder').filter({ hasText: label });await expect(row).toBeVisible({ timeout: 30_000 });- // The whole point: rendered text a user can read, on the real page.- await expect(row.getByTestId(`memory-source-pipeline-warning-${id}`)).toBeVisible({- timeout: 30_000,- });- await expect(row).toContainText('Stored without vectors. Semantic search unavailable.');- await expect(row).toContainText('Ingested only');+ if (hard) {+ // The whole point: rendered text a user can read, on the real page.+ await expect(row.getByTestId(`memory-source-pipeline-warning-${id}`)).toBeVisible({+ timeout: 30_000,+ });+ await expect(row).toContainText('Stored without vectors. Semantic search unavailable.');+ await expect(row).toContainText('Ingested only');+ } else {+ // An embeddings provider exists and the engine is draining the backlog:+ // the truthful state is "waiting", and the row must say so rather than+ // show a clean freshness pill and nothing else (openhuman#6025). It must+ // equally not cry failure over work that is in flight.+ await expect(row.getByTestId(`memory-source-vectors-pending-${id}`)).toBeVisible({+ timeout: 30_000,+ });+ await expect(row).toContainText('waiting for vectors');+ await expect(row).not.toContainText('Stored without vectors');+ }});test('the warning survives a reload rather than being a first-paint artefact', async ({@@ -242,7 +309,7 @@ test.describe('Brain — the UI tells the truth about embedding state', () => {{ timeout: 60_000 }).toBeGreaterThan(0);- requireDegraded(status);+ await requireHardDegraded(status);await openSources(page, 'pw-brain-reload');const warning = page.getByTestId(`memory-source-pipeline-warning-${id}`);@@ -273,7 +340,7 @@ test.describe('Brain — the UI tells the truth about embedding state', () => {{ timeout: 60_000 }).toBeGreaterThan(0);- requireDegraded(status);+ await requireHardDegraded(status);await openSources(page, 'pw-brain-health');await expect(page.getByTestId(`memory-source-pipeline-warning-${id}`)).toBeVisible({diff --git a/src/openhuman/integrations/composio/ops/providers_ops.rs b/src/openhuman/integrations/composio/ops/providers_ops.rsindex 54379ccf0f..45f864fdb9 100644--- a/src/openhuman/integrations/composio/ops/providers_ops.rs+++ b/src/openhuman/integrations/composio/ops/providers_ops.rs@@ -36,11 +36,12 @@ const SOURCE_KIND: &str = "composio";/// Per-pass item budget handed to the connector's `Sync` member.///-/// One pass is one budgeted slice of the account; the pass loop in-/// `composio_sync_for_source` multiplies this by its `MAX_PASSES` bound into a-/// worst case of 25k items per click, instead of "whatever the module decides-/// a call means".-pub const SYNC_PASS_MAX_ITEMS: usize = 500;+/// One pass is one budgeted slice of the account; the pass loop multiplies it+/// by `MAX_PASSES` into a worst case of 10k items per click. 200, not 500: a+/// pass reaches the memory module as ONE `AcceptSourceItems` call that embeds+/// each document in turn (~1.7 s each), and 500 ran ~14 min into the host's+/// 15-minute deadline, logging a false `initial sync failed` (openhuman#6025).+pub const SYNC_PASS_MAX_ITEMS: usize = 200;/// The next pass's item budget, or `None` when the configured per-run cap is/// spent and the run should end.@@ -267,7 +268,7 @@ pub async fn composio_sync_for_source(/// [`composio_sync_for_source`] with the source's configured per-run ingest/// cap. `None` preserves unlimited: the loop still slices the account into-/// 500-item passes, but stops only when the connector reports the end.+/// 200-item passes, but stops only when the connector reports the end.pub async fn composio_sync_budgeted(config: &Config,connection_id: &str,@@ -328,7 +329,7 @@ pub async fn composio_sync_budgeted(// `completed` with pages unfetched cleared the row while records remained// (review finding on this PR) — so loop passes until the connector reports// the end, bounded so an upstream that never completes cannot pin this- // task forever. The bound is generous: 50 pages ≈ 5,000 records per click.+ // task forever. The bound is generous: 50 passes ≈ 10,000 records per click.const MAX_PASSES: usize = 50;// Published before the spawn: the row's "running" exists before the RPCdiff --git a/src/openhuman/integrations/composio/ops_tests_part_03_tests.rs b/src/openhuman/integrations/composio/ops_tests_part_03_tests.rsindex 80236334f9..6f73793b84 100644--- a/src/openhuman/integrations/composio/ops_tests_part_03_tests.rs+++ b/src/openhuman/integrations/composio/ops_tests_part_03_tests.rs@@ -692,13 +692,15 @@ fn next_pass_budget_slices_and_exhausts_the_configured_cap() {// Unlimited: every pass gets the ceiling.assert_eq!(next_pass_budget(None, 0), Some(SYNC_PASS_MAX_ITEMS));assert_eq!(next_pass_budget(None, 1_000_000), Some(SYNC_PASS_MAX_ITEMS));- // A cap below the ceiling is one exact slice, then exhaustion.- assert_eq!(next_pass_budget(Some(200), 0), Some(200));- assert_eq!(next_pass_budget(Some(200), 200), None);- // A cap above the ceiling slices page by page and ends on the remainder.- assert_eq!(next_pass_budget(Some(1_200), 0), Some(SYNC_PASS_MAX_ITEMS));- assert_eq!(next_pass_budget(Some(1_200), 1_000), Some(200));- assert_eq!(next_pass_budget(Some(1_200), 1_200), None);+ // A cap below the ceiling (200 since openhuman#6025) is one exact slice,+ // then exhaustion.+ assert_eq!(next_pass_budget(Some(50), 0), Some(50));+ assert_eq!(next_pass_budget(Some(50), 50), None);+ // A cap above the ceiling slices pass by pass and ends on the remainder —+ // a remainder smaller than the ceiling, so the two cannot be confused.+ assert_eq!(next_pass_budget(Some(1_100), 0), Some(SYNC_PASS_MAX_ITEMS));+ assert_eq!(next_pass_budget(Some(1_100), 1_000), Some(100));+ assert_eq!(next_pass_budget(Some(1_100), 1_100), None);// Over-written past the cap (dedupe drift) still ends, never underflows.assert_eq!(next_pass_budget(Some(100), 150), None);}