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

address review: fix backup branch passthrough, escape before truncate in telegram, fix digest/compare route ordering, rename isXcodeApp to isSwiftApp

Adam Eivya3250bffd1a5
diff --git a/client/src/components/apps/SlashDoPanel.jsx b/client/src/components/apps/SlashDoPanel.jsx
index 95f5dc41d1..bb19214f47 100644
--- a/client/src/components/apps/SlashDoPanel.jsx
+++ b/client/src/components/apps/SlashDoPanel.jsx
@@ -16,11 +16,11 @@ const SLASHDO_COMMANDS = [
export default function SlashDoPanel({ appId, appType }) {
const [loading, setLoading] = useState(null);
const navigate = useNavigate();
- const isXcodeApp = NON_PM2_TYPES.has(appType);
+ const isSwiftApp = NON_PM2_TYPES.has(appType);
const commands = SLASHDO_COMMANDS.filter(cmd => {
- if (cmd.swiftOnly && !isXcodeApp) return false;
- if (cmd.hideForSwift && isXcodeApp) return false;
+ if (cmd.swiftOnly && !isSwiftApp) return false;
+ if (cmd.hideForSwift && isSwiftApp) return false;
return true;
});
diff --git a/server/routes/cosLearningRoutes.js b/server/routes/cosLearningRoutes.js
index ea34983d08..d12c85df5c 100644
--- a/server/routes/cosLearningRoutes.js
+++ b/server/routes/cosLearningRoutes.js
@@ -187,6 +187,21 @@ router.get('/digest/text', asyncHandler(async (req, res) => {
res.type('text/plain').send(text);
}));
+// GET /api/cos/digest/compare - Compare two weeks (must be before :weekId)
+router.get('/digest/compare', asyncHandler(async (req, res) => {
+ const { week1, week2 } = req.query;
+
+ if (!week1 || !week2) {
+ throw new ServerError('Both week1 and week2 query parameters are required', { status: 400, code: 'VALIDATION_ERROR' });
+ }
+
+ const comparison = await weeklyDigest.compareWeeks(week1, week2);
+ if (!comparison) {
+ throw new ServerError('One or both weeks not found', { status: 404, code: 'NOT_FOUND' });
+ }
+ res.json(comparison);
+}));
+
// GET /api/cos/digest/:weekId - Get digest for specific week
router.get('/digest/:weekId', asyncHandler(async (req, res) => {
const { weekId } = req.params;
@@ -210,19 +225,4 @@ router.post('/digest/generate', asyncHandler(async (req, res) => {
res.json(digest);
}));
-// GET /api/cos/digest/compare - Compare two weeks
-router.get('/digest/compare', asyncHandler(async (req, res) => {
- const { week1, week2 } = req.query;
-
- if (!week1 || !week2) {
- throw new ServerError('Both week1 and week2 query parameters are required', { status: 400, code: 'VALIDATION_ERROR' });
- }
-
- const comparison = await weeklyDigest.compareWeeks(week1, week2);
- if (!comparison) {
- throw new ServerError('One or both weeks not found', { status: 404, code: 'NOT_FOUND' });
- }
- res.json(comparison);
-}));
-
export default router;
diff --git a/server/routes/cosLearningRoutes.test.js b/server/routes/cosLearningRoutes.test.js
index f834907558..45ca38d8c7 100644
--- a/server/routes/cosLearningRoutes.test.js
+++ b/server/routes/cosLearningRoutes.test.js
@@ -368,7 +368,23 @@ describe('CoS Learning Routes', () => {
});
});
- // Note: GET /api/cos/digest/compare is unreachable because /digest/:weekId
- // is defined before it in the route file. "compare" matches :weekId and fails
- // the YYYY-WXX validation, returning 400. This is a known route ordering issue.
+ describe('GET /api/cos/digest/compare', () => {
+ it('should return 400 when week params are missing', async () => {
+ const response = await request(app).get('/api/cos/digest/compare');
+ expect(response.status).toBe(400);
+ });
+
+ it('should return comparison for two weeks', async () => {
+ weeklyDigest.compareWeeks.mockResolvedValue({ week1: '2026-W01', week2: '2026-W02', changes: [] });
+ const response = await request(app).get('/api/cos/digest/compare?week1=2026-W01&week2=2026-W02');
+ expect(response.status).toBe(200);
+ expect(weeklyDigest.compareWeeks).toHaveBeenCalledWith('2026-W01', '2026-W02');
+ });
+
+ it('should return 404 when weeks not found', async () => {
+ weeklyDigest.compareWeeks.mockResolvedValue(null);
+ const response = await request(app).get('/api/cos/digest/compare?week1=2026-W01&week2=2026-W02');
+ expect(response.status).toBe(404);
+ });
+ });
});
diff --git a/server/services/socket.js b/server/services/socket.js
index 3a011aa9ca..add7212325 100644
--- a/server/services/socket.js
+++ b/server/services/socket.js
@@ -131,11 +131,11 @@ export function initSocket(io) {
filesModified: result.filesModified
});
- // Complete
+ // Complete — use backup branch from step 2 since step 3 skips backup
socket.emit('standardize:complete', {
success: true,
result: {
- backupBranch: result.backupBranch,
+ backupBranch: backup.branch || null,
filesModified: result.filesModified,
processes: analysis.proposedChanges.processes
}
diff --git a/server/services/telegram.js b/server/services/telegram.js
index 6dd21994e3..08b59a690b 100644
--- a/server/services/telegram.js
+++ b/server/services/telegram.js
@@ -383,10 +383,11 @@ async function forwardNotification(notification) {
if (isMemoryApproval) {
const memory = await peekMemory(notification.metadata.memoryId).catch(() => null);
const raw = memory?.summary || memory?.content || notification.description || '';
- // Telegram messages are capped at 4096 chars; leave room for title/priority/markup
+ // Telegram messages are capped at 4096 chars; escape first since escaping can expand text
+ const escaped = escapeHtml(raw);
const MAX_CONTENT = 3500;
- const fullContent = raw.length > MAX_CONTENT ? raw.slice(0, MAX_CONTENT) + '...' : raw;
- if (fullContent) lines.push(escapeHtml(fullContent));
+ const fullContent = escaped.length > MAX_CONTENT ? escaped.slice(0, MAX_CONTENT) + '...' : escaped;
+ if (fullContent) lines.push(fullContent);
opts.reply_markup = JSON.stringify({
inline_keyboard: [[
{ text: '✅ Approve', callback_data: `${CALLBACK_APPROVE}:${notification.metadata.memoryId}` },