Diagnose image worker failures and normalize Facebook uploads

This commit is contained in:
Loma Bot Ops
2026-11-23 22:27:53 +07:00
parent 4429e6541b
commit df20406cf5
3 changed files with 36 additions and 3 deletions
+9 -1
View File
@@ -117,7 +117,15 @@ const server = createServer(async (req, res) => {
} catch (error) {
console.error("[ai-worker] job failed", error);
if (error?.usageLimit) reply(429, { error: "Codex usage limit reached" });
else reply(500, { error: "Automation failed; inspect worker logs and login" });
else {
const message = String(error?.message || "");
const code = /foreground focus|Open normal Chrome/i.test(message) ? "DESKTOP_UNAVAILABLE"
: /login required/i.test(message) ? "LOGIN_REQUIRED"
: /composer unavailable|side panel did not open|extension side panel first/i.test(message) ? "CHAT_UNAVAILABLE"
: /image.*(?:download|export|visible)|download.*finish/i.test(message) ? "IMAGE_EXPORT_FAILED"
: "AUTOMATION_FAILED";
reply(500, { error: "Automation failed; inspect worker logs", code });
}
} finally {
if (dir) await rm(dir, { recursive: true, force: true });
busy = false;