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

style(layered-intelligence): hoist the empty-document guard above the payload build

[._.]/ Adam Eivy62c040bf28dc
diff --git a/server/services/layeredIntelligence/sources.js b/server/services/layeredIntelligence/sources.js
index 8e4a310e30..e53c9e1bc4 100644
--- a/server/services/layeredIntelligence/sources.js
+++ b/server/services/layeredIntelligence/sources.js
@@ -215,8 +215,8 @@ const COS_METRICS_DELIVERY_KEYS = ['delivery', 'deliveryByScope'];
* @returns {string} the JSON document capped at COS_METRICS_MAX_CHARS, or ''.
*/
export function renderCosMetricsSource({ metricsByType = {}, delivery = null } = {}) {
- const payload = {};
if (!delivery && Object.keys(metricsByType || {}).length === 0) return '';
+ const payload = {};
// Reserved keys are INSERTED first (JSON.stringify follows insertion order, so the
// cap above can't cut them) but ASSIGNED last, so a task type that happens to share
// one of their names can't shadow the delivery block.