Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

chore: enforce single-line interpolated logs and fix parseInt radix (#1843)

[._.]/ Adam Eivy1a74ecc874d8
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 729b0093fe..288bf8900b 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -35,6 +35,8 @@
## Internal
+- **[issue-1843] Logging hygiene: single-line interpolated logs + `parseInt` radix** — enforced the single-line-log convention across a handful of stragglers flagged by the `/do:better` audit. `useErrorNotifications.js` passed `error.context` as a raw object arg to `console.warn/error` (expanding a multi-field console group); it now interpolates the context as a single-line JSON suffix via a shared `formatContext` helper. `routes/database.js` had an embedded `\n` that split a failed-command log into two records — the detail is now whitespace-collapsed onto one line. The per-request route-path `console.log`s in `routes/agentActivity.js`, `routes/platformAccounts.js`, and `routes/agentPersonalities.js` (pure noise — mutations already persist via `logAction`) were removed. And `routes/digital-twin.js`'s `parseInt(req.query.limit)` gained its missing radix `10`. No behavior change beyond log formatting. (#1843)
+
- **[issue-1860] De-flaked the `peerSync` reciprocal-sync tests** — the positive `reciprocates a full-sync peer on peer:online` test waited for an async event handler with a hard `setTimeout(r, 30)` before asserting `enqueueReciprocalSync` was called, so a loaded CI runner whose handler chain exceeded 30ms produced a spurious failure (surfaced during the v2.24.0 release CI-flake gate). It now polls with `vi.waitFor`. The sibling negative test (`does NOT reciprocate a non-full-sync peer`) replaced its fixed-sleep + `not.toHaveBeenCalled()` — which could false-pass if the absent call were merely slow — with a deterministic full-sync "barrier" peer emitted after the subject: once the barrier's reciprocal call lands, the subject's handler has provably reached and skipped its own fullSync check. Test-only. (#1860)
- Updated the bundled slashdo submodule to v3.20.0, pulling the latest `/do:*` slash commands and shared libraries.
diff --git a/client/src/hooks/useErrorNotifications.js b/client/src/hooks/useErrorNotifications.js
index 17ae747a6c..e6beaf1024 100644
--- a/client/src/hooks/useErrorNotifications.js
+++ b/client/src/hooks/useErrorNotifications.js
@@ -2,6 +2,10 @@ import { useEffect, useCallback } from 'react';
import toast from '../components/ui/Toast';
import socket from '../services/socket';
+// Render an error's context object as a single-line suffix (empty when absent)
+// so the console stays on one interpolated line instead of expanding a group.
+const formatContext = (context) => (context ? ` ${JSON.stringify(context)}` : '');
+
/**
* Hook that subscribes to server error events and shows toast notifications
* Also provides a function to request auto-fix for errors
@@ -26,7 +30,7 @@ export function useErrorNotifications() {
// blanket warning-drop below.
if (error.code === 'BACKUP_DB_DUMP_FAILED') {
toast.error(error.message, { duration: 8000, icon: '💾' });
- console.warn(`[${error.code}] ${error.message}`, error.context);
+ console.warn(`[${error.code}] ${error.message}${formatContext(error.context)}`);
return;
}
@@ -36,7 +40,7 @@ export function useErrorNotifications() {
// primary model balked. Handled before the warning-drop below.
if (error.code === 'AI_PROVIDER_CONTENT_REFUSED') {
toast(error.message, { duration: 7000, icon: '🛟' });
- console.warn(`[${error.code}] ${error.message}`, error.context);
+ console.warn(`[${error.code}] ${error.message}${formatContext(error.context)}`);
return;
}
@@ -47,7 +51,7 @@ export function useErrorNotifications() {
if (error.code === 'PLATFORM_UNAVAILABLE') {
toast(error.message, { duration: 5000, icon: '⚠️' });
- console.warn(`[${error.code}] ${error.message}`, error.context);
+ console.warn(`[${error.code}] ${error.message}${formatContext(error.context)}`);
return;
}
@@ -61,7 +65,7 @@ export function useErrorNotifications() {
: error.message;
toast.error(message, toastOptions);
- console.error(`[${error.code}] ${error.message}`, error.context);
+ console.error(`[${error.code}] ${error.message}${formatContext(error.context)}`);
};
const handleCriticalError = (error) => {
diff --git a/server/routes/agentActivity.js b/server/routes/agentActivity.js
index 55ffde5c82..3a54d9de8d 100644
--- a/server/routes/agentActivity.js
+++ b/server/routes/agentActivity.js
@@ -12,7 +12,6 @@ const router = Router();
// GET / - Get recent activity across all agents
router.get('/', asyncHandler(async (req, res) => {
- console.log('📊 GET /api/agents/activity');
const { limit = 50, agentIds, action } = req.query;
const activities = await agentActivity.getRecentActivities({
@@ -26,7 +25,6 @@ router.get('/', asyncHandler(async (req, res) => {
// GET /timeline - Get activity timeline (for infinite scroll)
router.get('/timeline', asyncHandler(async (req, res) => {
- console.log('📊 GET /api/agents/activity/timeline');
const { limit = 50, agentIds, before } = req.query;
const activities = await agentActivity.getActivityTimeline({
@@ -42,7 +40,6 @@ router.get('/timeline', asyncHandler(async (req, res) => {
router.get('/agent/:agentId', asyncHandler(async (req, res) => {
const { agentId } = req.params;
const { date, limit = 100, offset = 0, action } = req.query;
- console.log(`📊 GET /api/agents/activity/agent/${agentId}`);
const activities = await agentActivity.getActivities(agentId, {
date: date ? new Date(date) : new Date(),
@@ -58,7 +55,6 @@ router.get('/agent/:agentId', asyncHandler(async (req, res) => {
router.get('/agent/:agentId/stats', asyncHandler(async (req, res) => {
const { agentId } = req.params;
const { days = 7 } = req.query;
- console.log(`📊 GET /api/agents/activity/agent/${agentId}/stats`);
const stats = await agentActivity.getAgentStats(agentId, parseInt(days, 10));
res.json(stats);
@@ -67,7 +63,6 @@ router.get('/agent/:agentId/stats', asyncHandler(async (req, res) => {
// POST /cleanup - Clean up old activity files
router.post('/cleanup', asyncHandler(async (req, res) => {
const { daysToKeep = 30 } = req.body;
- console.log(`📊 POST /api/agents/activity/cleanup (keep ${daysToKeep} days)`);
const deletedCount = await agentActivity.cleanupOldActivity(daysToKeep);
res.json({ success: true, deletedCount });
diff --git a/server/routes/agentPersonalities.js b/server/routes/agentPersonalities.js
index d34016e2d3..e4d2d6511b 100644
--- a/server/routes/agentPersonalities.js
+++ b/server/routes/agentPersonalities.js
@@ -15,7 +15,6 @@ const router = Router();
// GET / - Get all agent personalities
router.get('/', asyncHandler(async (req, res) => {
- console.log('🤖 GET /api/agents/personalities');
const { userId } = req.query;
const agents = userId
@@ -28,7 +27,6 @@ router.get('/', asyncHandler(async (req, res) => {
// GET /:id - Get agent by ID
router.get('/:id', asyncHandler(async (req, res) => {
const { id } = req.params;
- console.log(`🤖 GET /api/agents/personalities/${id}`);
const agent = await agentPersonalities.getAgentById(id);
if (!agent) {
@@ -40,8 +38,6 @@ router.get('/:id', asyncHandler(async (req, res) => {
// POST / - Create new agent
router.post('/', asyncHandler(async (req, res) => {
- console.log('🤖 POST /api/agents/personalities');
-
const data = validateRequest(agentSchema, req.body);
const agent = await agentPersonalities.createAgent(data);
await logAction('create', 'agent-personality', agent.id, { name: agent.name });
@@ -52,8 +48,6 @@ router.post('/', asyncHandler(async (req, res) => {
// PUT /:id - Update agent
router.put('/:id', asyncHandler(async (req, res) => {
const { id } = req.params;
- console.log(`🤖 PUT /api/agents/personalities/${id}`);
-
const data = validateRequest(agentUpdateSchema, req.body);
const agent = await agentPersonalities.updateAgent(id, data);
if (!agent) {
@@ -67,7 +61,6 @@ router.put('/:id', asyncHandler(async (req, res) => {
// DELETE /:id - Delete agent
router.delete('/:id', asyncHandler(async (req, res) => {
const { id } = req.params;
- console.log(`🤖 DELETE /api/agents/personalities/${id}`);
const deleted = await agentPersonalities.deleteAgent(id);
if (!deleted) {
@@ -80,8 +73,6 @@ router.delete('/:id', asyncHandler(async (req, res) => {
// POST /generate - Generate agent personality using AI
router.post('/generate', asyncHandler(async (req, res) => {
- console.log('🎨 POST /api/agents/personalities/generate');
-
const { seed = {}, providerId, model } = req.body;
const generated = await generateAgentPersonality(seed, providerId, model);
@@ -93,7 +84,6 @@ router.post('/generate', asyncHandler(async (req, res) => {
router.post('/:id/toggle', asyncHandler(async (req, res) => {
const { id } = req.params;
const { enabled } = req.body;
- console.log(`🤖 POST /api/agents/personalities/${id}/toggle enabled=${enabled}`);
const agent = await agentPersonalities.toggleAgent(id, enabled);
if (!agent) {
diff --git a/server/routes/database.js b/server/routes/database.js
index f9f4c4a245..6f4d367578 100644
--- a/server/routes/database.js
+++ b/server/routes/database.js
@@ -33,8 +33,8 @@ function runCmd(cmd, args, timeout = 120_000, env = process.env) {
execFile(cmd, args, { cwd: rootDir, timeout, env }, (err, stdout, stderr) => {
const exitCode = err ? (typeof err.code === 'number' ? err.code : 1) : 0;
if (exitCode !== 0) {
- const detail = stripAnsi(stderr || stdout || err.message || '');
- console.error(`🗄️ ${cmd} ${args.join(' ')} exited ${exitCode}:\n${detail}`);
+ const detail = stripAnsi(stderr || stdout || err.message || '').replace(/\s+/g, ' ').trim();
+ console.error(`🗄️ ${cmd} ${args.join(' ')} exited ${exitCode}: ${detail}`);
}
resolve({
stdout: stripAnsi(stdout || ''),
diff --git a/server/routes/digital-twin.js b/server/routes/digital-twin.js
index b1c6f9515b..806d9ebd75 100644
--- a/server/routes/digital-twin.js
+++ b/server/routes/digital-twin.js
@@ -755,7 +755,7 @@ router.post('/feedback/recalculate', asyncHandler(async (req, res) => {
*/
router.get('/feedback/recent', asyncHandler(async (req, res) => {
const contentType = req.query.contentType || null;
- const limit = Math.min(parseInt(req.query.limit) || 20, 50);
+ const limit = Math.min(parseInt(req.query.limit, 10) || 20, 50);
const entries = await feedbackService.getRecentFeedback(contentType, limit);
res.json(entries);
}));
diff --git a/server/routes/platformAccounts.js b/server/routes/platformAccounts.js
index 7b884e5cf4..aea762499c 100644
--- a/server/routes/platformAccounts.js
+++ b/server/routes/platformAccounts.js
@@ -17,7 +17,6 @@ const router = Router();
// GET / - Get all platform accounts
router.get('/', asyncHandler(async (req, res) => {
- console.log('🔗 GET /api/agents/accounts');
const { agentId, platform } = req.query;
let accounts;
@@ -38,7 +37,6 @@ router.get('/', asyncHandler(async (req, res) => {
// GET /:id - Get account by ID
router.get('/:id', asyncHandler(async (req, res) => {
const { id } = req.params;
- console.log(`🔗 GET /api/agents/accounts/${id}`);
const account = await platformAccounts.getAccountById(id);
if (!account) {
@@ -50,8 +48,6 @@ router.get('/:id', asyncHandler(async (req, res) => {
// POST / - Create/link new platform account
router.post('/', asyncHandler(async (req, res) => {
- console.log('🔗 POST /api/agents/accounts');
-
// Check if this is a registration request (for new Moltbook accounts)
// or a direct account creation (with existing credentials)
if (req.body.credentials) {
@@ -158,7 +154,6 @@ router.post('/', asyncHandler(async (req, res) => {
// DELETE /:id - Remove account
router.delete('/:id', asyncHandler(async (req, res) => {
const { id } = req.params;
- console.log(`🔗 DELETE /api/agents/accounts/${id}`);
const deleted = await platformAccounts.deleteAccount(id);
if (!deleted) {
@@ -172,7 +167,6 @@ router.delete('/:id', asyncHandler(async (req, res) => {
// POST /:id/test - Test account connection
router.post('/:id/test', asyncHandler(async (req, res) => {
const { id } = req.params;
- console.log(`🔗 POST /api/agents/accounts/${id}/test`);
const account = await platformAccounts.getAccountWithCredentials(id);
if (!account) {
@@ -234,7 +228,6 @@ router.post('/:id/test', asyncHandler(async (req, res) => {
// POST /:id/claim - Mark account as claimed (after user visits claim URL)
router.post('/:id/claim', asyncHandler(async (req, res) => {
const { id } = req.params;
- console.log(`🔗 POST /api/agents/accounts/${id}/claim`);
const account = await platformAccounts.getAccountById(id);
if (!account) {