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

fix: address review — restore URL stubs and unify the attachment total-limit units (#3869)

[._.]/ Adam Eivy6c10da4658a0
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 018a8257fa..e0916759ec 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -45,4 +45,4 @@
- Agents run on an API provider (LM Studio, raw OpenAI/Anthropic — anything with no native filesystem tools) now receive the per-directory `CLAUDE.md` files too, not just the global and repo-root ones. Those agents read nothing off disk on their own, so a convention that lived in `server/CLAUDE.md` or `client/src/CLAUDE.md` reached them as a pointer with no contents — which is how relocating a backup rsync-exclude rule out of the root file silently removed a data-loss guard from that whole class of agent. Nested files are now discovered under the workspace and spliced in after the root one, each labeled with its repo-relative path, bounded to 10 files and 5 levels deep and skipping vendored, generated, and runtime trees.
- The Node version PortOS requires is now written down in exactly one place and checked before anything slow runs. The floor was copied into five sites that could drift apart — both setup scripts, `.nvmrc`, the CI workflows and the README — while the install path the README actually documents (`npm run setup`, `npm start`) checked none of them, so an unsupported Node installed happily for several minutes and then failed inside Vite with an error that never named the cause. `scripts/checkNodeVersion.js` now owns the number (22.12), runs first in the root `setup`, `start` and `dev` scripts so an old Node fails in the first second, and a drift test holds the other sites to it — the shell gates and the README to the floor exactly, `.nvmrc` and CI to at-or-above it, since running CI on 24 while supporting 22.12 is a preference rather than a mistake. All four `package.json` files now declare `engines` as well.
- The Pipeline's Reverse Outline map now keeps the selected scene in the URL (`?scene=<id>`) instead of component state, so the open scene detail survives a reload and can be linked to or shared. A stale id — after regenerating the outline, say — falls back to the "click a marker" placeholder rather than a blank card, and regenerating clears the selection outright.
-- The six "file too large" toasts — album covers, artist portraits, tracks, author headshots, reference audio and OpenClaw attachments — now render their size cap through the shared `formatBytes` helper instead of each dividing by 1024 twice and gluing on "MB". The rendered text gains a space before the unit (`12 MB` rather than `12MB`), which is what the rest of PortOS already shows and what the reference-audio toast already read.
+- The six "file too large" toasts — album covers, artist portraits, tracks, author headshots, reference audio and OpenClaw attachments — now render their size cap through the shared `formatBytes` helper instead of each dividing by 1024 twice and gluing on "MB". The rendered text gains a space before the unit (`12 MB` rather than `12MB`), which is what the rest of PortOS already shows and what the reference-audio toast already read. The OpenClaw combined-attachment message picked up the same treatment for its decoded-size estimate, so the two limits it can report no longer print their units two different ways.
diff --git a/client/src/hooks/useOpenClawAttachments.js b/client/src/hooks/useOpenClawAttachments.js
index 86b2fa5ccf..a92d981b2f 100644
--- a/client/src/hooks/useOpenClawAttachments.js
+++ b/client/src/hooks/useOpenClawAttachments.js
@@ -128,8 +128,10 @@ export function useOpenClawAttachments({ sending, onError = () => {} } = {}) {
const existingBase64Chars = liveAttachments.reduce((sum, a) => sum + (typeof a.data === 'string' ? a.data.length : 0), 0);
if (existingBase64Chars + newBase64Chars > MAX_ATTACHMENTS_TOTAL_BASE64_CHARS) {
next.forEach(a => { if (a.previewUrl) URL.revokeObjectURL(a.previewUrl); });
- const totalMB = Math.round((existingBase64Chars + newBase64Chars) * 0.75 / (1024 * 1024));
- onError(`Combined attachments exceed the 50MB encoded total limit (~${totalMB}MB decoded).`);
+ // The 50 MB ceiling counts base64 CHARS (decimal), so it stays a literal;
+ // the decoded estimate is real bytes and goes through the canonical helper.
+ const decodedBytes = (existingBase64Chars + newBase64Chars) * 0.75;
+ onError(`Combined attachments exceed the 50 MB encoded total limit (~${formatBytes(decodedBytes, 0)} decoded).`);
return;
}
diff --git a/client/src/hooks/useOpenClawAttachments.test.jsx b/client/src/hooks/useOpenClawAttachments.test.jsx
index ec20707b9b..2834336e4d 100644
--- a/client/src/hooks/useOpenClawAttachments.test.jsx
+++ b/client/src/hooks/useOpenClawAttachments.test.jsx
@@ -1,4 +1,4 @@
-import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { renderHook, act } from '@testing-library/react';
import { useOpenClawAttachments } from './useOpenClawAttachments';
@@ -11,12 +11,21 @@ function fakeFile({ name, size, type = 'image/png' }) {
}
describe('useOpenClawAttachments oversize rejection', () => {
+ // jsdom does not implement the object-URL APIs the hook uses for image previews.
+ // Save and restore rather than assigning over them, so the patch does not leak
+ // into other test files sharing this worker.
+ const original = { createObjectURL: URL.createObjectURL, revokeObjectURL: URL.revokeObjectURL };
+
beforeEach(() => {
- // jsdom does not implement the object-URL APIs the hook uses for image previews.
URL.createObjectURL = vi.fn(() => 'blob:preview');
URL.revokeObjectURL = vi.fn();
});
+ afterEach(() => {
+ URL.createObjectURL = original.createObjectURL;
+ URL.revokeObjectURL = original.revokeObjectURL;
+ });
+
it('reports the size cap using the canonical formatBytes output', async () => {
const onError = vi.fn();
const { result } = renderHook(() => useOpenClawAttachments({ sending: false, onError }));