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: gracefully handle empty AI enhancement results instead of throwing

Adam Eivyf523d4c75367
diff --git a/.changelog/v0.11.x.md b/.changelog/v0.11.x.md
index 652c8c02c0..d6e082ff86 100644
--- a/.changelog/v0.11.x.md
+++ b/.changelog/v0.11.x.md
@@ -93,6 +93,11 @@ This release focuses on security improvements, bug fixes for the AI runner syste
- **Immediate Task Blocking**: Both `terminateAgent()` and `killAgent()` in direct mode now immediately update the task to `blocked` with `user-terminated` category, matching the runner mode behavior. Previously, task blocking was deferred to the close handler, creating a window where server restarts could cause requeue
- **Orphan Handler Guard**: `handleOrphanedTask()` now skips tasks already marked as `user-terminated`, preventing any residual requeue path
+### Task Enhancement Empty Result No Longer Throws Error
+- **Graceful fallback**: When an AI provider returns an empty response during task prompt enhancement, the server now returns the original description instead of throwing a 500 error
+- **Reduced log noise**: Empty enhancement results log a warning instead of surfacing as route errors
+- **Client unchanged**: The client already handled enhancement failures gracefully; this fix prevents unnecessary error noise server-side
+
### Quick Enrich Skip Returns Same Question
- **Skip now advances to a different question**: Clicking "Skip" on Quick Enrich prompts (both in the overview banner and the full EnrichTab) previously returned the exact same question, because question selection was deterministic based on `questionsAnswered` count which skip didn't increment
- **Client tracks skipped indices**: Both NextActionBanner and EnrichTab now maintain a `skippedIndices` list for the current session, passing it to the server so it can serve the next non-skipped question
diff --git a/server/services/taskEnhancer.js b/server/services/taskEnhancer.js
index 0966761821..6e1cf90657 100644
--- a/server/services/taskEnhancer.js
+++ b/server/services/taskEnhancer.js
@@ -160,10 +160,16 @@ export async function enhanceTaskPrompt(description, context = '') {
enhancedDescription = enhancedDescription.trim();
- // Ensure we have a valid enhanced description
+ // Fall back to original description if enhancement returned empty
if (!enhancedDescription) {
- console.warn(`⚠️ Task enhancement returned empty result from ${provider.name}/${model}`);
- throw new Error('AI enhancement returned empty result');
+ console.warn(`⚠️ Task enhancement returned empty result from ${provider.name}/${model}, using original`);
+ return {
+ enhancedDescription: description,
+ originalDescription: description,
+ model,
+ provider: provider.id,
+ fallback: true
+ };
}
console.log(`✅ Enhanced task prompt (${enhancedDescription.length} chars) using ${provider.name}/${model}`);