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