Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(safe-logger): require both .name and .message for error-like classification (#3741)

LearningCircuitcdd28e20454b
diff --git a/src/local_deep_research/web/static/js/security/safe-logger.js b/src/local_deep_research/web/static/js/security/safe-logger.js
index ac4ff42f57..58d09e0bd3 100644
--- a/src/local_deep_research/web/static/js/security/safe-logger.js
+++ b/src/local_deep_research/web/static/js/security/safe-logger.js
@@ -149,9 +149,17 @@
};
}
- // Error-like objects (e.g., Response, custom errors) — show error name
- if (value && typeof value === 'object' && typeof value.message === 'string') {
- return { name: value.name || 'Error', message: REDACTED };
+ // Error-like objects (custom errors with the canonical {name, message}
+ // shape). Both fields must be strings — checking only .message catches
+ // ordinary data objects like {hasLogEntry: true, message: 'foo'} and
+ // makes them look like errors in production logs.
+ if (
+ value &&
+ typeof value === 'object' &&
+ typeof value.name === 'string' &&
+ typeof value.message === 'string'
+ ) {
+ return { name: value.name, message: REDACTED };
}
// Arrays - show structure but not contents
diff --git a/tests/js/security/safe-logger.test.js b/tests/js/security/safe-logger.test.js
index b10e5c14dc..79c27c95cf 100644
--- a/tests/js/security/safe-logger.test.js
+++ b/tests/js/security/safe-logger.test.js
@@ -315,5 +315,23 @@ describe('SafeLogger', () => {
expect(arg.message).toBe('[redacted]');
spy.mockRestore();
});
+
+ it('does not misclassify data objects with .message but no .name', () => {
+ // Regression: a summary object like {hasLogEntry, logType, message}
+ // was being treated as an Error in production, producing the
+ // misleading log line "Object { name: 'Error', message: '[redacted]' }".
+ SL.setProductionMode(true);
+ const spy = vi.spyOn(console, 'log').mockImplementation(() => {});
+ SL.log('Calling handlers with data:', {
+ hasLogEntry: true,
+ logType: 'milestone',
+ message: 'Phase complete...',
+ });
+ const arg = spy.mock.calls[0][1];
+ // Should fall through to the generic-object redaction, not the
+ // error-like branch.
+ expect(arg).toBe('[Object]');
+ spy.mockRestore();
+ });
});
});