feat(devil-closer): זיהוי critique.md של שטן מליץ על Fable (legal-ai #978)
All checks were successful
INV-INT9 issue.status write-ownership / int9-guard (pull_request) Successful in 3s
All checks were successful
INV-INT9 issue.status write-ownership / int9-guard (pull_request) Successful in 3s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PRePqBSqn3kjwjg9puEJZz
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* הלוגיקה כאן טהורה (תלויות מוזרקות) כדי שאפשר לבדוק אותה בלי host.
|
||||
*/
|
||||
|
||||
/** חברה → agent id של שטן-מליץ (Gemini) באותה חברה. */
|
||||
/** חברה → agent id של שטן-מליץ באותה חברה (Fable מאז legal-ai #978; היה Gemini). */
|
||||
export const DEVIL_AGENT_IDS: Record<string, string> = {
|
||||
"42a7acd0-30c5-4cbd-ac97-7424f65df294":
|
||||
"9c86e06a-5a92-4723-af6d-e8cc6ae1d45b", // CMP
|
||||
@@ -17,6 +17,12 @@ export const DEVIL_AGENT_IDS: Record<string, string> = {
|
||||
"46cc1228-a232-410b-a36b-71a6928499a2", // CMPA
|
||||
};
|
||||
|
||||
/** קובץ המזכר: critique.md (Fable, legal-ai #978); critique-gemini.md לתיקים שרצו לפני המעבר. */
|
||||
export const CRITIQUE_FILENAMES = [
|
||||
"critique.md",
|
||||
"critique-gemini.md",
|
||||
] as const;
|
||||
|
||||
export const DEFAULT_CASES_DIR = "/home/chaim/legal-ai/data/cases";
|
||||
/** מזכר קצר מזה = כנראה ריצה ריקה/חלקית, לא סוגרים. */
|
||||
export const MIN_CRITIQUE_BYTES = 2000;
|
||||
@@ -72,7 +78,7 @@ export type CloseOutcome =
|
||||
|
||||
/**
|
||||
* מופעל על `agent.run.finished` (status=succeeded בלבד). סוגר את ה-issue רק אם:
|
||||
* הריצה של שטן-מליץ של אותה חברה, ה-issue שלו פתוח, וקיים `critique-gemini.md` עדכני ולא ריק.
|
||||
* הריצה של שטן-מליץ של אותה חברה, ה-issue שלו פתוח, וקיים מזכר (`critique.md`) עדכני ולא ריק.
|
||||
*/
|
||||
export async function closeDevilIssueIfDone(
|
||||
companyId: string | undefined,
|
||||
@@ -113,7 +119,7 @@ export async function closeDevilIssueIfDone(
|
||||
if (!st || st.size < MIN_CRITIQUE_BYTES || st.mtimeMs < created) {
|
||||
deps.log(
|
||||
"warn",
|
||||
"devil auto-close: no fresh critique-gemini.md; leaving issue open",
|
||||
"devil auto-close: no fresh critique memo; leaving issue open",
|
||||
{
|
||||
issueId: issue.id,
|
||||
caseNumber,
|
||||
|
||||
@@ -13,7 +13,11 @@ import {
|
||||
resolveApiBaseFrom,
|
||||
runJobHandler,
|
||||
} from "./company-scope.js";
|
||||
import { closeDevilIssueIfDone, DEFAULT_CASES_DIR } from "./devil-closer.js";
|
||||
import {
|
||||
CRITIQUE_FILENAMES,
|
||||
closeDevilIssueIfDone,
|
||||
DEFAULT_CASES_DIR,
|
||||
} from "./devil-closer.js";
|
||||
import type { StatusModelEntry } from "./legal-api.js";
|
||||
import { LegalApi } from "./legal-api.js";
|
||||
import {
|
||||
@@ -768,21 +772,24 @@ const plugin = definePlugin({
|
||||
: null;
|
||||
},
|
||||
statCritique: async (caseNumber) => {
|
||||
// critique.md = שטן מליץ על Fable (legal-ai #978); critique-gemini.md = תיקים ישנים.
|
||||
for (const name of CRITIQUE_FILENAMES) {
|
||||
try {
|
||||
const st = await stat(
|
||||
`${casesDir}/${caseNumber}/documents/research/critique-gemini.md`,
|
||||
`${casesDir}/${caseNumber}/documents/research/${name}`,
|
||||
);
|
||||
return { size: st.size, mtimeMs: st.mtimeMs };
|
||||
} catch (err) {
|
||||
if ((err as NodeJS.ErrnoException).code === "ENOENT")
|
||||
return null;
|
||||
if ((err as NodeJS.ErrnoException).code !== "ENOENT")
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
// סטטוס בלבד, בלי comment: comment מעיר את ה-CEO פעם שנייה (user_commented).
|
||||
closeIssue: async (id, companyId) => {
|
||||
// כותב-סטטוס שני וצר בכוונה: רק issue של שטן-מליץ (נבדק בכותרת ובסוכן), רק open→done,
|
||||
// רק אחרי ריצה מוצלחת + critique-gemini.md עדכני (devil-closer.ts). בלי זה הסוכן
|
||||
// רק אחרי ריצה מוצלחת + מזכר (critique.md) עדכני (devil-closer.ts). בלי זה הסוכן
|
||||
// (בלי shell, #872) לא סוגר והתהליך נתקע; אין flip-flop כי done סופי.
|
||||
// noqa: INT9 — סגירת issue של שטן-מליץ אחרי ריצה מוצלחת (legal-ai #892), ראה devil-closer.ts
|
||||
await ctx.issues.update(id, { status: "done" }, companyId);
|
||||
|
||||
Reference in New Issue
Block a user