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

log why a template usage write failed instead of dropping the error

[._.]/ Adam Eivye6ad72c21fe0
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index 6e2719b37c..648a218816 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -373,9 +373,16 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
setWorktreeChangesExpected(false);
}
descriptionRef.current?.focus();
+ // The popularity counter is best-effort: the template has already been
+ // applied to local form state above, so a failed write must not read as a
+ // failed application — but it must not read as a successful one either
+ // (#5494). `silent: true` suppresses the shared helper's error toast so the
+ // failure is reported once, here, with the underlying reason logged for
+ // diagnosis (the helper's toast was the only place it used to surface).
const usageRecorded = await api.applyCosTaskTemplate(template.id, { silent: true })
.then(() => true)
- .catch(() => {
+ .catch((err) => {
+ console.warn(`⚠️ Template usage not recorded for ${template.id}: ${err?.message || err}`);
toast.warning('Template applied locally, but usage could not be recorded');
return false;
});
diff --git a/client/src/components/cos/TaskAddForm.test.jsx b/client/src/components/cos/TaskAddForm.test.jsx
index 0dda1d3d30..8c1d8ea303 100644
--- a/client/src/components/cos/TaskAddForm.test.jsx
+++ b/client/src/components/cos/TaskAddForm.test.jsx
@@ -333,6 +333,11 @@ describe('TaskAddForm quick templates', () => {
await waitFor(() => expect(toast.warning).toHaveBeenCalledWith(
'Template applied locally, but usage could not be recorded'
));
+ // Reported ONCE: `silent: true` keeps the shared API helper quiet, so the
+ // component's warning is the only notice — no paired red error toast, and
+ // no success claim about a write that did not happen.
+ expect(toast.warning).toHaveBeenCalledTimes(1);
+ expect(toast.error).not.toHaveBeenCalled();
expect(toast.success).not.toHaveBeenCalled();
});
});