Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
fix(cloro): clear a completed task's pending row even when it has no answer (#971)
Gökhan Geyikc50958385bd6
diff --git a/server/src/server.js b/server/src/server.jsindex 529fa36f4..ef88339c1 100644--- a/server/src/server.js+++ b/server/src/server.js@@ -570,19 +570,38 @@ app.post('/cloro/callback', async (req, res) => {domain: c.domain || '',}));- const aiResponse = parseScraperResponse(response, pending.scraper_id);-- await handleScraperResult({- aiResponse,- scraperId: pending.scraper_id,- promptId: pending.prompt_id,- brandId: pending.brand_id,- region: pending.region,- brandInfo,- competitors,- });+ // A completed task with nothing to store — google-aio for a query Google+ // shows no AI Overview for — is a finished task, not a failed delivery.+ // Leaving its pending row behind held every tracking run open: the worker+ // waited out its stall window and the run's stamp its late deadline, for+ // answers that had arrived seconds after submission.+ let aiResponse;+ try {+ aiResponse = parseScraperResponse(response, pending.scraper_id);+ } catch (err) {+ req.log.info(+ { taskId, scraperId: pending.scraper_id, reason: err.message },+ 'cloro callback: task completed with no answer to store',+ );+ await supabaseAdmin.from('cloro_pending_tasks').delete().eq('task_id', taskId);+ return;+ }- await supabaseAdmin.from('cloro_pending_tasks').delete().eq('task_id', taskId);+ try {+ await handleScraperResult({+ aiResponse,+ scraperId: pending.scraper_id,+ promptId: pending.prompt_id,+ brandId: pending.brand_id,+ region: pending.region,+ brandInfo,+ competitors,+ });+ } finally {+ // Cloro does not deliver again after our 200, so a task that failed to+ // store will never come back; keeping its row only holds the run open.+ await supabaseAdmin.from('cloro_pending_tasks').delete().eq('task_id', taskId);+ }req.log.info({ taskId, scraperId: pending.scraper_id },