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: keep the taste provider-error 502 off the global error toast channel (#2733)

[._.]/ Adam Eivy560ea291b63d
diff --git a/client/src/components/digital-twin/tabs/TasteTab.jsx b/client/src/components/digital-twin/tabs/TasteTab.jsx
index 6ac5d47444..ef6f3f8a9a 100644
--- a/client/src/components/digital-twin/tabs/TasteTab.jsx
+++ b/client/src/components/digital-twin/tabs/TasteTab.jsx
@@ -67,10 +67,11 @@ export const noQuestionToast = (reason) => NO_QUESTION_TOAST[reason] || NO_QUEST
* Whether "Go deeper" must report a failed request itself.
*
* A provider failure (502 `AI_PROVIDER_ERROR`) is already announced by the `ai:status`
- * error toast with the provider's real reason, so that toast is the single voice for it.
- * Everything else — validation, 500, network drop — has no other reporter (the request
- * is sent `{ silent: true }`), so this component is its single voice. Exactly one layer
- * speaks either way (#2733, #2669).
+ * error toast with the provider's real reason, so that toast is the single voice for it —
+ * the server also marks it warning-severity so the global `error:notified` channel stays
+ * quiet. Everything else — validation, 500, network drop — has no other reporter (the
+ * request is sent `{ silent: true }`), so this component is its single voice. Exactly one
+ * layer speaks either way (#2733, #2669).
*/
export const shouldReportGoDeeperError = (err) => err?.code !== 'AI_PROVIDER_ERROR';
diff --git a/server/services/taste-questionnaire.js b/server/services/taste-questionnaire.js
index a480d6be0f..8939ea89fe 100644
--- a/server/services/taste-questionnaire.js
+++ b/server/services/taste-questionnaire.js
@@ -897,10 +897,12 @@ async function aggregateIdentityContext(sectionId) {
* - `{ question: null, reason: <why> }` — nothing to ask. `reason` names which
* precondition was missing so the caller can explain the right thing instead of
* blaming the user's identity documents for every empty result.
- * - throws `ServerError` (`AI_PROVIDER_ERROR`) — the provider call itself failed.
- * `callProviderAISimple` has already emitted `ai:status` phase `error` carrying
- * the real reason, so that toast is the single voice for this case and the
- * client silences `request()`'s own toast. Do not add a second reporter here.
+ * - throws `ServerError` (`AI_PROVIDER_ERROR`, warning severity) — the provider call
+ * itself failed. `callProviderAISimple` has already emitted `ai:status` phase
+ * `error` carrying the real reason, so that toast is the single voice: the client
+ * silences `request()`'s toast and skips its own for this code, and the warning
+ * severity keeps the global `error:notified` channel quiet. Three layers can report
+ * this — exactly one must. Do not add a fourth.
*/
export async function generatePersonalizedTasteQuestion(sectionId, providerId, model) {
const config = TASTE_SECTIONS[sectionId];
@@ -949,9 +951,16 @@ Generate exactly ONE question. Do not include any preamble, numbering, or explan
// classified as an error by callProviderAISimple, so it arrives here too.
if (result.error) {
console.log(`🎨 Personalized question generation failed for ${sectionId}: ${result.error}`);
+ // `severity: 'warning'` keeps this off the global error channel: every route error
+ // is broadcast as `error:notified` and toasted by useErrorNotifications, which
+ // would be a SECOND red toast on top of the `ai:status` one that already named the
+ // provider's real reason. Warning-severity opts out of that surfacing (precedent:
+ // routes/mediaJobs.js), leaving ai:status the single voice. The response is
+ // unchanged — callers still get a 502 + AI_PROVIDER_ERROR code.
throw new ServerError(`Personalized question generation failed: ${result.error}`, {
status: 502,
- code: 'AI_PROVIDER_ERROR'
+ code: 'AI_PROVIDER_ERROR',
+ severity: 'warning'
});
}
diff --git a/server/services/taste-questionnaire.test.js b/server/services/taste-questionnaire.test.js
index 6dac1e8077..4879ee5cac 100644
--- a/server/services/taste-questionnaire.test.js
+++ b/server/services/taste-questionnaire.test.js
@@ -168,6 +168,11 @@ describe('generatePersonalizedTasteQuestion outcomes', () => {
await expect(taste.generatePersonalizedTasteQuestion('movies')).rejects.toMatchObject({
code: 'AI_PROVIDER_ERROR',
status: 502,
+ // Load-bearing: warning severity keeps this off the global `error:notified`
+ // channel, so useErrorNotifications doesn't red-toast it on top of the
+ // ai:status toast that already named the provider's reason. Dropping it
+ // silently restores the double toast #2669 removed.
+ severity: 'warning',
message: expect.stringContaining('invalid key'),
});
});