diff --git a/src/worker.ts b/src/worker.ts index b7ce49d..f4806d3 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -1243,27 +1243,17 @@ const plugin = definePlugin({ // double-routed. Runs every 2 minutes (manifest schedule). ctx.jobs.register("route-pending-comments", async (_job) => { await runJobHandler("route-pending-comments", ctx.logger, async () => { - // כשל-מהיר: דחיית-scope (legal-ai issue #637) אינה "שגיאה - // פר-issue" שאפשר להתעלם ממנה — היא אומרת שה-run **כולו** לא - // יכול לעבוד. לזרוק מיד במקום לבלוע ולהמשיך ללולאה על 2 - // חברות × 200 issues שכולן ייכשלו זהה. שגיאה אחרת (ולא scope) - // נשארת warn+continue — זו העמידות האמיתית פר-issue. - let companies: Awaited>; - try { - companies = await ctx.companies.list(); - } catch (err) { - if (isCompanyScopeDenied(err)) { - throw new CompanyScopeUnavailableError( - "route-pending-comments", - "companies.list", - { cause: err }, - ); - } - ctx.logger.warn("route-pending-comments: companies.list failed", { - error: String(err), - }); - return; - } + // רשימת החברות נלקחת ממפת ה-CEO ולא מ-`ctx.companies.list()` (legal-ai + // #1280): הקריאה הזו דורשת scope של instance, וה-host דוחה אותה + // באקראי בג'וב מתוזמן (invalidInvocationScope, ~21% מהריצות מ-10.11). + // הלולאה ממילא מדלגת על חברה בלי CEO ממופה, ולכן הרשימה זהה + // (אותו דפוס כמו `knownCompanyIds` ב-`resolveApiBase`). + // + // כשל-מהיר נשאר ב-`issues.list`: דחיית-scope (legal-ai issue #637) + // אינה "שגיאה פר-issue" שאפשר להתעלם ממנה — היא אומרת שה-run + // **כולו** לא יכול לעבוד. שגיאה אחרת (ולא scope) נשארת + // warn+continue — זו העמידות האמיתית פר-issue. + const companies = Object.keys(CEO_AGENT_IDS).map((id) => ({ id })); for (const company of companies) { const ceoAgentId = CEO_AGENT_IDS[company.id];