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(prompts): redact template paths in loader logs
IgnoreMeBut81777f1b0e47
diff --git a/src/main/prompts/loader.ts b/src/main/prompts/loader.tsindex e5fb5013..d7d0fafa 100644--- a/src/main/prompts/loader.ts+++ b/src/main/prompts/loader.ts@@ -19,6 +19,7 @@import * as fs from 'node:fs';import * as path from 'node:path';import { createLogger } from '../logger';+import { logErrorSummary, logPathRef } from '../util/log-redact';import {safeSubstitute,type TemplateArgs,@@ -49,13 +50,16 @@ export class PromptManager {const p = this._pathFor(template);let stat: fs.Stats;try { stat = fs.statSync(p); }- catch { log.warn(`template missing: ${p}`); return ''; }+ catch { log.warn('prompt template missing', { path: logPathRef(p) }); return ''; }const mtime = stat.mtimeMs;const cached = this._cache.get(template);if (cached && cached.mtime === mtime) return cached.body;let body: string;try { body = fs.readFileSync(p, 'utf8'); }- catch (err) { log.warn(`failed to read ${p}: ${(err as Error).message}`); return ''; }+ catch (err) {+ log.warn('prompt template read failed', { path: logPathRef(p), error: logErrorSummary(err) });+ return '';+ }this._cache.set(template, { mtime, body });return body;}diff --git a/test/main/prompts/loader.test.ts b/test/main/prompts/loader.test.tsindex c5dff1c0..2200f5f3 100644--- a/test/main/prompts/loader.test.ts+++ b/test/main/prompts/loader.test.ts@@ -1,10 +1,16 @@-import { describe, it, expect, beforeEach, afterEach } from 'vitest';+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';import * as fs from 'node:fs';import * as os from 'node:os';import * as path from 'node:path';import { PromptManager, safeSubstitute, prompts } from '../../../src/main/prompts/loader';import { buildRuntimeDatetimeBlock, formatCurrentDate } from '../../../src/main/prompts/runtime_context';+const loggerMocks = vi.hoisted(() => ({ warn: vi.fn() }));++vi.mock('../../../src/main/logger', () => ({+ createLogger: () => ({ debug: vi.fn(), info: vi.fn(), warn: loggerMocks.warn, error: vi.fn() }),+}));+describe('prompts › safeSubstitute', () => {it('substitutes $identifier', () => {expect(safeSubstitute('hi $name', { name: 'Bob' })).toBe('hi Bob');@@ -67,6 +73,7 @@ describe('prompts › PromptManager (custom root)', () => {let mgr: PromptManager;beforeEach(() => {+ loggerMocks.warn.mockClear();tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-prompts-'));mgr = new PromptManager(tmpDir);});@@ -88,6 +95,11 @@ describe('prompts › PromptManager (custom root)', () => {it('load() returns empty string for missing template', () => {expect(mgr.load('missing')).toBe('');+ expect(loggerMocks.warn).toHaveBeenCalledWith(+ 'prompt template missing',+ { path: expect.objectContaining({ path_hash: expect.any(String), domain: 'absolute' }) },+ );+ expect(JSON.stringify(loggerMocks.warn.mock.calls)).not.toContain(tmpDir);});it('caches body — when mtime is held constant, load returns cached body even after content rewrite', () => {