fix(appraiser-facts): route extraction through analyst wakeup (was silent 0)
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m38s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m38s
The "חלץ עובדות שמאיות" UI button hit POST /api/cases/{n}/extract-appraiser-facts
which called appraiser_facts_extractor inline — that shells out to the local
`claude` CLI, which is absent in the Coolify container, so every doc errored,
the per-doc try/except swallowed it, and the response was "completed, 0 facts".
Refactored the endpoint to wake the legal-analyst of the correct company via
Paperclip (same pattern as wake_curator_for_final), and surface
extraction_failed instead of "completed" when every doc errored.
This commit is contained in:
@@ -160,6 +160,23 @@ export type ExtractAppraiserFactsResponse =
|
||||
appraisal_count: number;
|
||||
missing: { document_id: string; title: string; current_side: string }[];
|
||||
message: string;
|
||||
}
|
||||
| {
|
||||
// The chair clicked the button; backend created a child Paperclip
|
||||
// issue assigned to the legal-analyst, which will run the MCP tool
|
||||
// on the host (where the Claude CLI lives) and post results back.
|
||||
status: "queued";
|
||||
sub_issue_id: string;
|
||||
analyst_id: string;
|
||||
main_issue_id: string;
|
||||
}
|
||||
| {
|
||||
// No analyst route was available (no API key / no analyst configured /
|
||||
// no Paperclip issue linked to the case). Non-fatal — the chair can
|
||||
// still trigger extraction manually from Claude Code.
|
||||
status: "skipped";
|
||||
reason: "no_api_key" | "no_analyst" | "no_issue" | string;
|
||||
company_id?: string;
|
||||
};
|
||||
|
||||
async function extractAppraiserFacts(
|
||||
|
||||
Reference in New Issue
Block a user