From 956a1703df5b8a25ecd7cc034b9b84f37b45af66 Mon Sep 17 00:00:00 2001 From: Yashas Date: Wed, 9 Sep 2026 15:30:25 +0530 Subject: [PATCH] console: surface reasoning on the underwriting, KYC and nudge steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The chain of thought reads the employee's "why" out of the workflow data fields, matched by base id. Three real reasoning fields were written by the employees but not in the map, so those steps showed as a bare heading even though the reasoning was captured: - uw_referral_reason — the underwriting screen and prepare steps write their decision reasoning here; the map only knew uw_decision_notes (the clear/decline note), so the substantive UW decision showed no chain. - kyc_ref — a clean KYC leaves the mismatch note empty, so the step had no rung; kyc_ref is the document package the employee matched identity against and now stands in as the finding. - nudge_notes — the payment-follow-up employee's rationale. Traced against instance 57632: underwriting (2.3k-char reasoning), KYC and the nudge all had their reasoning captured but unmapped. This is frontend-only, no backend or workflow change. Known residual: Accept, Payment, Realise and Onboard write only a reference, no "why" field, so their reasoning lives in aiemployee.tbl_ai_decisions / the ai_reasoning column, which the audit endpoint does not return and the org-scoped monitor endpoint a partner_agent cannot call. Forcing a chain onto those mechanical acks needs a workflow field + charter change (future instances only). Co-Authored-By: Claude Opus 4.8 --- src/components/Timeline.jsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index 89a30bd..6b3ef90 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -32,11 +32,22 @@ const REASONING = [ ['attribution_reason', 'Attribution'], ['eligibility_reason', 'Eligibility'], ['ai_recommendation_rationale', 'Cover advice'], - ['kyc_mismatch_notes', 'KYC'], + ['kyc_mismatch_notes', 'KYC mismatch'], + // A clean KYC leaves the mismatch note empty, so the step showed no chain at + // all. kyc_ref is what the KYC employee actually recorded — the document + // package it matched the identity against — so it stands in as the finding. + ['kyc_ref', 'KYC check'], ['referral_analysis', 'Referral analysis'], - ['uw_decision_notes', 'Underwriting'], + // Underwriting writes its reasoning into uw_referral_reason (the screen and + // prepare steps); uw_decision_notes is only the clear/decline note. The map + // knew the second and not the first, so the substantive UW decision — the + // one the reader most wants the reasoning for — showed as a bare heading. + ['uw_referral_reason', 'Underwriting'], + ['uw_decision_notes', 'Underwriting decision'], ['contact_notes', 'Call'], ['documents_notes', 'Documents'], + // The payment-nudge employee records why it chose to follow up now (or hold). + ['nudge_notes', 'Payment follow-up'], ['quoted_breakup', 'How the premium was reached'], ['lost_reason', 'Why it was dropped'], ['resume_note', 'Why now'],