Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
fix(indexing): redact materialisation log identifiers
CloudTianTian5bfd60bc50d7
diff --git a/src/main/features/file_indexer.ts b/src/main/features/file_indexer.tsindex dc8c31aa..0c3d1d02 100644--- a/src/main/features/file_indexer.ts+++ b/src/main/features/file_indexer.ts@@ -43,6 +43,7 @@ import { finished } from 'node:stream/promises';import { userChatAttachmentsDir, userFileCacheDir, projectChatAttachmentsDir } from '../paths';import { listProjectIds } from '../util/project-layout';import { createLogger } from '../logger';+import { logPathRef, maskId } from '../util/log-redact';import { macosTccSensitivePath } from '../util/macos-tcc';import { pdfBufferToPages, EXTRACT_CACHE_VERSION } from '../util/extract-pdf';import { docxBufferToMarkdown } from '../util/extract-docx';@@ -545,12 +546,15 @@ async function materialise(// image: no cache payload at all.writeMeta(dir, base);- log.info(- `materialise user=${userId} kind=${kind} chars=${base.totalChars ?? 0}`- + (kind === 'pdf' ? ` pages=${base.pageMap?.length ?? 0}` : '')- + (base.extractionEmpty ? ' extraction=empty_pages' : '')- + ` ms=${Date.now() - t0} path=${absPath}`,- );+ log.info('materialise', {+ user_id: maskId(userId),+ kind,+ chars: base.totalChars ?? 0,+ ...(kind === 'pdf' ? { pages: base.pageMap?.length ?? 0 } : {}),+ ...(base.extractionEmpty ? { extraction: 'empty_pages' } : {}),+ duration_ms: Date.now() - t0,+ path: logPathRef(absPath),+ });return base;}diff --git a/test/main/features/file_indexer.test.ts b/test/main/features/file_indexer.test.tsindex a914418d..781ec450 100644--- a/test/main/features/file_indexer.test.ts+++ b/test/main/features/file_indexer.test.ts@@ -8,6 +8,16 @@ import * as path from 'node:path';import { makeMinimalPdf } from '../../fixtures/make-minimal-pdf';import { makeMinimalDocx } from '../../fixtures/make-minimal-docx';+const loggerMocks = vi.hoisted(() => ({ info: vi.fn() }));+vi.mock('../../../src/main/logger', () => ({+ createLogger: () => ({+ debug: vi.fn(),+ info: loggerMocks.info,+ warn: vi.fn(),+ error: vi.fn(),+ }),+}));+const UID = 'u-fi-001';let tmpDir: string;@@ -65,6 +75,25 @@ async function makePng(): Promise<Buffer> {}describe('file_indexer › statFile', () => {+ it('logs only masked account and path references when materialising', async () => {+ const m = await loadMod();+ loggerMocks.info.mockClear();+ const abs = writeWorkspaceFile('private-customer-filename.md', 'private body');+ await m.statFile(UID, abs);++ expect(loggerMocks.info).toHaveBeenCalledWith('materialise', expect.objectContaining({+ user_id: 'u-***01',+ kind: 'text',+ chars: 12,+ path: expect.objectContaining({ domain: 'absolute', ext: '.md' }),+ }));+ const serialized = JSON.stringify(loggerMocks.info.mock.calls);+ expect(serialized).not.toContain(UID);+ expect(serialized).not.toContain(tmpDir);+ expect(serialized).not.toContain('private-customer-filename.md');+ expect(serialized).not.toContain('private body');+ });+it('returns totalChars for text', async () => {const m = await loadMod();const body = 'line one\nline two\nline three';