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: pass silent:true on client API calls with custom error toasts (#2520)

Adam Eivy979b2cb35530
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 92139c4c51..5109d52470 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -10,6 +10,7 @@
## Fixed
- **[issue-2519] CoS handlers no longer flash a false-success toast after a failed API call.** Several Chief of Staff actions (`handleForceEvaluate` on the CoS page, the Tasks tab "Run Now" button, and the Config tab's Save + autonomy-level change) `.catch`-swallowed the request rejection and then unconditionally toasted success and mutated optimistic UI — so a network/server error still read as "done." Each now awaits inside try/catch and only toasts success / advances state after the request resolves: a failed Save keeps the editor open, and a failed autonomy-level change reverts the optimistic form params. Errors surface via a single `toast.error` (the calls already pass `{ silent: true }`).
+- **[issue-2520] Pass `{ silent: true }` on client API calls that own a custom error toast.** Several call sites routed a request through the auto-toasting `request()` helper AND showed their own `toast.error` in `.catch`, so a failure surfaced two stacked toasts. The music managers (Artists/Albums/Tracks load + create/update/delete), MusicVideo (list/create/delete/analyze/plan/add-scene/delete-scene/reorder), and DataDog (load/save/delete/test) now pass `{ silent: true }` on those calls; CharacterSheet's local `charGet`/`charPost`/`charPut` helpers are silent-by-default (every caller owns its own catch toast or the `loadError` banner) with an opt-out. Each failing action now shows a single toast.
- **[issue-2510] MidiPianoRoll: clear the stale hover overlay when the transcription data changes.** The piano-roll kept its hovered note/chord identity (objects from the previous parse) when the `data`/`chords` props swapped on a mounted instance, so a re-transcription or Retry while a hover was active and the pointer sat still would keep stroking the old note at coordinates mapped into the new file until the next pointer move or Escape. A `useEffect` now drops the hover identity whenever `data`/`chords` change.
- **[issue-2513] Block loopback/metadata hosts in Layered Intelligence custom `http` sources.** `fetchHttpSource` used a bare `fetch` with only an `http(s)` scheme check, so a hand-edited config could point a custom source at `127.0.0.1`, `169.254.169.254`, or `metadata.google.internal` and exfiltrate up to 8KB into the reasoner prompt. It now routes through the shared SSRF-guarded `fetchPublicText` (default posture): loopback, link-local, and cloud-metadata hosts are blocked and redirects are revalidated, while LAN/Tailscale hosts stay intentionally allowed for this single-user tool.
- **[issue-2516] Database sync: remove shell interpolation from the dump import.** The active→inactive backend sync built a `bash -c "sed … \"${dumpFile}\" | psql … -U ${pgUser} -d ${pgDb}"` string that interpolated the dump path, port, user, and database name into a shell command — any shell metacharacter in those values (env-derived or surfacing from the export pipeline) was injectable into `psql`. The import now streams the dump through `spawn('psql', argv)` with no shell: the dump is read and piped to psql's stdin, and the pg17-only directives (`\restrict`/`\unrestrict`/`SET transaction_timeout`) the old `sed` stage stripped are filtered in-process. No user- or env-derived value ever reaches a shell string.
diff --git a/client/src/components/music/AlbumsManager.jsx b/client/src/components/music/AlbumsManager.jsx
index 3dcc78d480..5c75abc867 100644
--- a/client/src/components/music/AlbumsManager.jsx
+++ b/client/src/components/music/AlbumsManager.jsx
@@ -223,7 +223,7 @@ export default function AlbumsManager() {
if (!title) { toast.error('Album title is required'); return; }
setSaving(true);
if (isCreate) {
- const created = await createAlbum(buildPayload({ includeTrackIds: true })).catch((err) => { toast.error(err.message || 'Failed to create album'); return null; });
+ const created = await createAlbum(buildPayload({ includeTrackIds: true }), { silent: true }).catch((err) => { toast.error(err.message || 'Failed to create album'); return null; });
setSaving(false);
if (!created) return;
setAlbums((prev) => [...prev, created].sort((a, b) => (a.title || '').localeCompare(b.title || '')));
@@ -234,7 +234,7 @@ export default function AlbumsManager() {
const original = selected?.trackIds || [];
const trackIdsChanged = original.length !== form.trackIds.length
|| original.some((id, i) => id !== form.trackIds[i]);
- const updated = await updateAlbum(id, buildPayload({ includeTrackIds: trackIdsChanged })).catch((err) => { toast.error(err.message || 'Failed to save album'); return null; });
+ const updated = await updateAlbum(id, buildPayload({ includeTrackIds: trackIdsChanged }), { silent: true }).catch((err) => { toast.error(err.message || 'Failed to save album'); return null; });
setSaving(false);
if (!updated) return;
setAlbums((prev) => prev.map((a) => (a.id === updated.id ? updated : a)).sort((a, b) => (a.title || '').localeCompare(b.title || '')));
@@ -248,7 +248,7 @@ export default function AlbumsManager() {
setAlbums((prev) => prev.filter((a) => a.id !== selected.id));
setConfirmDelete(false);
navigate('/music/albums');
- await deleteAlbum(selected.id).catch((err) => { toast.error(err.message || 'Delete failed'); setAlbums(prior); });
+ await deleteAlbum(selected.id, { silent: true }).catch((err) => { toast.error(err.message || 'Delete failed'); setAlbums(prior); });
};
const availableTracks = allTracks.filter((t) => !form.trackIds.includes(t.id));
diff --git a/client/src/components/music/ArtistsManager.jsx b/client/src/components/music/ArtistsManager.jsx
index 96b25e1a1e..7ace6f420c 100644
--- a/client/src/components/music/ArtistsManager.jsx
+++ b/client/src/components/music/ArtistsManager.jsx
@@ -162,7 +162,7 @@ export default function ArtistsManager() {
};
useEffect(() => {
- listArtists()
+ listArtists({ silent: true })
.then((list) => setArtists(Array.isArray(list) ? list : []))
.catch((err) => toast.error(err.message || 'Failed to load artists'))
.finally(() => setLoading(false));
@@ -201,7 +201,7 @@ export default function ArtistsManager() {
setSaving(true);
const payload = { ...form, name };
if (isCreate) {
- const created = await createArtist(payload).catch((err) => {
+ const created = await createArtist(payload, { silent: true }).catch((err) => {
toast.error(err.message || 'Failed to create artist');
return null;
});
@@ -211,7 +211,7 @@ export default function ArtistsManager() {
navigate(`/music/artists/${encodeURIComponent(created.id)}`);
toast.success(`Created "${created.name}"`);
} else {
- const updated = await updateArtist(id, payload).catch((err) => {
+ const updated = await updateArtist(id, payload, { silent: true }).catch((err) => {
toast.error(err.message || 'Failed to save artist');
return null;
});
@@ -230,7 +230,7 @@ export default function ArtistsManager() {
setArtists((prev) => prev.filter((a) => a.id !== selected.id));
setConfirmDelete(false);
navigate('/music/artists');
- await deleteArtist(selected.id).catch((err) => {
+ await deleteArtist(selected.id, { silent: true }).catch((err) => {
toast.error(err.message || 'Delete failed');
setArtists(prior);
});
diff --git a/client/src/components/music/TracksManager.jsx b/client/src/components/music/TracksManager.jsx
index 9ab4b69edf..1f6e6cb222 100644
--- a/client/src/components/music/TracksManager.jsx
+++ b/client/src/components/music/TracksManager.jsx
@@ -90,7 +90,7 @@ export default function TracksManager() {
useEffect(() => {
Promise.all([
- listTracks().catch((err) => { toast.error(err.message || 'Failed to load tracks'); return []; }),
+ listTracks({ silent: true }).catch((err) => { toast.error(err.message || 'Failed to load tracks'); return []; }),
listAlbums({ silent: true }).catch(() => []),
listMusicVideoProjects({ silent: true }).catch(() => []),
])
@@ -156,7 +156,7 @@ export default function TracksManager() {
if (!title) { toast.error('Track title is required'); return; }
setSaving(true);
if (isCreate) {
- const created = await createTrack({ ...form, title }).catch((err) => { toast.error(err.message || 'Failed to create track'); return null; });
+ const created = await createTrack({ ...form, title }, { silent: true }).catch((err) => { toast.error(err.message || 'Failed to create track'); return null; });
setSaving(false);
if (!created) return;
upsertLocal(created);
@@ -173,7 +173,7 @@ export default function TracksManager() {
// remains the primary place to (re)order an album's tracks.
const payload = { ...form, title };
if ((selected?.albumId || '') === form.albumId) delete payload.albumId;
- const updated = await updateTrack(id, payload).catch((err) => { toast.error(err.message || 'Failed to save track'); return null; });
+ const updated = await updateTrack(id, payload, { silent: true }).catch((err) => { toast.error(err.message || 'Failed to save track'); return null; });
setSaving(false);
if (!updated) return;
upsertLocal(updated);
@@ -187,7 +187,7 @@ export default function TracksManager() {
setTracks((prev) => prev.filter((t) => t.id !== selected.id));
resetTrackViewState();
navigate('/music/tracks');
- await deleteTrack(selected.id).catch((err) => { toast.error(err.message || 'Delete failed'); setTracks(prior); });
+ await deleteTrack(selected.id, { silent: true }).catch((err) => { toast.error(err.message || 'Delete failed'); setTracks(prior); });
};
// Audio actions operate on the SAVED track (the server attaches the filename
diff --git a/client/src/pages/CharacterSheet.a11y.test.jsx b/client/src/pages/CharacterSheet.a11y.test.jsx
index 4cede47a24..6d813281c7 100644
--- a/client/src/pages/CharacterSheet.a11y.test.jsx
+++ b/client/src/pages/CharacterSheet.a11y.test.jsx
@@ -77,7 +77,7 @@ describe('CharacterSheet name editing accessibility', () => {
fireEvent.keyDown(input, { key: 'Enter' });
- await waitFor(() => expect(put).toHaveBeenCalledWith('/character', { name: 'Strider' }));
+ await waitFor(() => expect(put).toHaveBeenCalledWith('/character', { name: 'Strider' }, { silent: true }));
// Back to the button view with the new name.
await waitFor(() =>
expect(screen.getByRole('button', { name: /edit character name/i }))
diff --git a/client/src/pages/CharacterSheet.jsx b/client/src/pages/CharacterSheet.jsx
index 543ae7bd14..4c44f704f1 100644
--- a/client/src/pages/CharacterSheet.jsx
+++ b/client/src/pages/CharacterSheet.jsx
@@ -10,9 +10,13 @@ import api, { generateAvatar } from '../services/api';
import socket from '../services/socket';
import { clickableProps } from '../lib/a11yKeyboard.js';
-const charGet = () => api.get('/character');
-const charPost = (path, body) => api.post(`/character${path}`, body);
-const charPut = (body) => api.put('/character', body);
+// Silent by default — every caller owns its own error UI (a catch-block toast,
+// or the loadError banner in load()), so the request() helper must not also
+// toast or the user sees a double error (issue #2520). Callers can still opt
+// back into the helper toast by passing { silent: false }.
+const charGet = (options = {}) => api.get('/character', { silent: true, ...options });
+const charPost = (path, body, options = {}) => api.post(`/character${path}`, body, { silent: true, ...options });
+const charPut = (body, options = {}) => api.put('/character', body, { silent: true, ...options });
// D&D 5e XP thresholds (must match server)
const XP_THRESHOLDS = [
diff --git a/client/src/pages/DataDog.jsx b/client/src/pages/DataDog.jsx
index 2de90b1449..c14863a813 100644
--- a/client/src/pages/DataDog.jsx
+++ b/client/src/pages/DataDog.jsx
@@ -39,7 +39,7 @@ export default function DataDog() {
const loadInstances = async () => {
try {
setLoading(true);
- const response = await api.get('/datadog/instances');
+ const response = await api.get('/datadog/instances', { silent: true });
setInstances(response.instances || {});
} catch (error) {
console.error(`❌ Failed to load DataDog instances: ${error.message}`);
@@ -102,7 +102,7 @@ export default function DataDog() {
...(formData.appKey && { appKey: formData.appKey })
};
- const saved = await api.post('/datadog/instances', payload);
+ const saved = await api.post('/datadog/instances', payload, { silent: true });
toast.success(`DataDog instance "${payload.name}" saved successfully`);
setInstances(prev => ({ ...prev, [saved.id]: saved }));
@@ -125,7 +125,7 @@ export default function DataDog() {
setDeleteConfirm(null);
try {
- await api.delete(`/datadog/instances/${instanceId}`);
+ await api.delete(`/datadog/instances/${instanceId}`, { silent: true });
toast.success(`DataDog instance "${instanceId}" deleted`);
setInstances(prev => {
const next = { ...prev };
@@ -147,7 +147,7 @@ export default function DataDog() {
setTestingInstance(instanceId);
setTestResults(prev => ({ ...prev, [instanceId]: null }));
- const response = await api.post(`/datadog/instances/${instanceId}/test`);
+ const response = await api.post(`/datadog/instances/${instanceId}/test`, undefined, { silent: true });
setTestResults(prev => ({ ...prev, [instanceId]: response }));
if (response.success) {
diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsx
index 17a872ea3b..0173212467 100644
--- a/client/src/pages/MusicVideo.jsx
+++ b/client/src/pages/MusicVideo.jsx
@@ -207,7 +207,7 @@ export default function MusicVideo() {
const genVideoScenes = videoLane.genScenes;
useEffect(() => {
- listMusicVideoProjects()
+ listMusicVideoProjects({ silent: true })
.then((data) => { setProjects(data || []); setLoading(false); })
.catch((err) => { toast.error(err?.message || 'Failed to load music video projects'); setLoading(false); });
listTracks({ silent: true }).then((t) => setTracks(t || [])).catch(() => setTracks([]));
@@ -236,7 +236,7 @@ export default function MusicVideo() {
toast.error('Finish or cancel the in-progress YouTube import before creating the project');
return;
}
- createMusicVideoProject({ name: form.name.trim(), mode: form.mode, trackId: form.trackId || null })
+ createMusicVideoProject({ name: form.name.trim(), mode: form.mode, trackId: form.trackId || null }, { silent: true })
.then((proj) => {
setProjects((prev) => [...prev, proj]);
selectProject(proj.id);
@@ -254,7 +254,7 @@ export default function MusicVideo() {
toast.error('Finish or cancel the in-progress YouTube import before deleting this project');
return;
}
- deleteMusicVideoProject(id)
+ deleteMusicVideoProject(id, { silent: true })
.then(() => {
setProjects((prev) => prev.filter((p) => p.id !== id));
if (selectedId === id) navigate('/media/music-video');
@@ -294,7 +294,7 @@ export default function MusicVideo() {
const handleAnalyze = () => {
if (!selected) return;
setAnalyzing(true);
- analyzeMusicVideoProject(selected.id)
+ analyzeMusicVideoProject(selected.id, { silent: true })
.then((proj) => { replaceProject(proj); toast.success(`Analyzed — ${proj.audioAnalysis?.bpm ? `${proj.audioAnalysis.bpm} BPM` : 'no tempo detected'}`); })
.catch((err) => toast.error(err?.message || 'Analysis failed'))
.finally(() => setAnalyzing(false));
@@ -308,7 +308,7 @@ export default function MusicVideo() {
const handlePlan = () => {
if (!selected?.audioAnalysis) return;
setPlanning(true);
- planMusicVideoProject(selected.id, { seedPrompts: true })
+ planMusicVideoProject(selected.id, { seedPrompts: true }, { silent: true })
.then(({ project, scenesAdded, promptsSeeded, promptsSkippedReason }) => {
replaceProject(project);
const suffix = promptsSeeded
@@ -448,7 +448,7 @@ export default function MusicVideo() {
};
const handleAddScene = () => {
- addMusicVideoScene(selected.id, { prompt: '' })
+ addMusicVideoScene(selected.id, { prompt: '' }, { silent: true })
.then((scene) => replaceProject({ ...selected, scenes: [...(selected.scenes || []), scene] }))
.catch((err) => toast.error(err?.message || 'Failed to add scene'));
};
@@ -469,7 +469,7 @@ export default function MusicVideo() {
};
const handleDeleteScene = (sceneId) => {
- deleteMusicVideoScene(selected.id, sceneId)
+ deleteMusicVideoScene(selected.id, sceneId, { silent: true })
.then((proj) => replaceProject(proj))
.catch((err) => toast.error(err?.message || 'Failed to delete scene'));
};
@@ -480,7 +480,7 @@ export default function MusicVideo() {
if (target < 0 || target >= scenes.length) return;
const ids = scenes.map((s) => s.sceneId);
[ids[idx], ids[target]] = [ids[target], ids[idx]];
- reorderMusicVideoScenes(selected.id, ids)
+ reorderMusicVideoScenes(selected.id, ids, { silent: true })
.then((proj) => replaceProject(proj))
.catch((err) => toast.error(err?.message || 'Failed to reorder'));
};
diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsx
index 1181a810af..3567947542 100644
--- a/client/src/pages/MusicVideo.test.jsx
+++ b/client/src/pages/MusicVideo.test.jsx
@@ -244,7 +244,7 @@ describe('MusicVideo autonomous shot planner (#1855)', () => {
expect(planBtn).toHaveProperty('disabled', false);
fireEvent.click(planBtn);
- await waitFor(() => expect(planMusicVideoProject).toHaveBeenCalledWith('mv-3', { seedPrompts: true }));
+ await waitFor(() => expect(planMusicVideoProject).toHaveBeenCalledWith('mv-3', { seedPrompts: true }, { silent: true }));
});
});