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 commission history-loss surfacing inside fireCommission's never-throws contract (#7529)

[._.]/ Adam Eivy530f0dc19957
diff --git a/server/services/creativeCommissions/scheduler.js b/server/services/creativeCommissions/scheduler.js
index 95bd41b97a..e9139d6055 100644
--- a/server/services/creativeCommissions/scheduler.js
+++ b/server/services/creativeCommissions/scheduler.js
@@ -299,7 +299,7 @@ export async function runScheduledCommission(commissionId) {
// half states on its own; the notification is what actually reaches a
// user who was not watching the logs at 02:00.
console.error(`❌ Creative commission ${commissionId} pre-fire read failed AND its failure could not be recorded: ${historyWarning.detail}`);
- await surfaceCommissionHistoryLoss({ id: commissionId }, historyWarning);
+ await surfaceCommissionHistoryLoss({ id: commissionId }, historyWarning).catch(() => {});
}
throw err; // propagate to eventScheduler's runEvent, which contains it
}
@@ -384,7 +384,10 @@ async function fireCommission(commission, trigger) {
// in, so without this the unattended case — the one this fix is actually about
// — would be a console line nobody reads. Manual callers get both.
const outcome = async (base, persisted) => {
- if (persisted.historyWarning) await surfaceCommissionHistoryLoss(commission, persisted.historyWarning);
+ // .catch like the surfaceCommissionRun call below: fireCommission promises
+ // its callers an outcome and never a throw, and one of them is a cron tick
+ // outside the request lifecycle where an escaping rejection kills the process.
+ if (persisted.historyWarning) await surfaceCommissionHistoryLoss(commission, persisted.historyWarning).catch(() => {});
return { ...base, ...persisted };
};
const skip = async (reason) =>
diff --git a/server/services/creativeCommissions/surface.js b/server/services/creativeCommissions/surface.js
index a2882ac237..65e2d0d51e 100644
--- a/server/services/creativeCommissions/surface.js
+++ b/server/services/creativeCommissions/surface.js
@@ -76,9 +76,12 @@ export async function surfaceCommissionRun(commission, run) {
* retry it and the run row is gone for good, so the deep link to the Creative
* Director project is the only remaining route to work that is genuinely running.
*
- * Same best-effort contract: never throws into the scheduler's fire handler, and
- * carries only local ids plus the bounded classification — never the prompt,
- * the directive or any feedback.
+ * Same best-effort contract: never throws into the scheduler's fire handler. It
+ * names the commission exactly as surfaceCommissionRun above does — the
+ * notifications store is a machine-local file that never federates, so the name
+ * is what makes the alert identifiable to the one user who sees it. What it
+ * still must NOT carry, on this path or any other, is the directive, the prompt
+ * or any feedback: the metadata is local ids plus the bounded classification.
*
* @param {object} commission sanitized commission record, or `{ id }` when the
* record itself could not be read (a pre-fire storage failure)