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: robust raw-text telegram truncation, surface memory action errors as toast

Adam Eivye83ce8067f87
diff --git a/client/src/components/cos/tabs/MemoryTab.jsx b/client/src/components/cos/tabs/MemoryTab.jsx
index 6e6ca0f6e4..56442a972a 100644
--- a/client/src/components/cos/tabs/MemoryTab.jsx
+++ b/client/src/components/cos/tabs/MemoryTab.jsx
@@ -81,7 +81,10 @@ export default function MemoryTab({ apps = [] }) {
if (actionRef.current) return;
actionRef.current = true;
setActionInFlight(id);
- const result = await action(id).catch(() => null);
+ const result = await action(id).catch(err => {
+ toast.error(err?.message || `Failed to ${label.toLowerCase()} memory`);
+ return null;
+ });
actionRef.current = false;
setActionInFlight(null);
if (!result) return;
diff --git a/server/services/telegram.js b/server/services/telegram.js
index eb96615593..9d6e202d59 100644
--- a/server/services/telegram.js
+++ b/server/services/telegram.js
@@ -383,16 +383,12 @@ 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; escape then enforce limit
- const escaped = escapeHtml(raw);
- const MAX_ESCAPED = 3500;
- let content = escaped;
- if (content.length > MAX_ESCAPED) {
- // Avoid slicing mid-entity (e.g. &) — find last ; or safe char before limit
- const cut = content.lastIndexOf(';', MAX_ESCAPED);
- content = (cut > MAX_ESCAPED - 10 ? content.slice(0, cut + 1) : content.slice(0, MAX_ESCAPED)) + '...';
- }
- if (content) lines.push(content);
+ // Telegram 4096 char limit; truncate raw text before escaping to guarantee
+ // the escaped result stays under limit (escaping expands at most 5x per char
+ // for &amp; but typical text is <1.2x; 2800 raw → ≤3500 escaped conservatively)
+ const MAX_RAW = 2800;
+ const truncated = raw.length > MAX_RAW ? raw.slice(0, MAX_RAW) + '…' : raw;
+ if (truncated) lines.push(escapeHtml(truncated));
opts.reply_markup = JSON.stringify({
inline_keyboard: [[
{ text: '✅ Approve', callback_data: `${CALLBACK_APPROVE}:${notification.metadata.memoryId}` },