console: surface reasoning on the underwriting, KYC and nudge steps

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 <noreply@anthropic.com>
This commit is contained in:
Yashas 2026-09-09 15:30:25 +05:30
parent 47967c6318
commit 956a1703df

View File

@ -32,11 +32,22 @@ const REASONING = [
['attribution_reason', 'Attribution'], ['attribution_reason', 'Attribution'],
['eligibility_reason', 'Eligibility'], ['eligibility_reason', 'Eligibility'],
['ai_recommendation_rationale', 'Cover advice'], ['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'], ['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'], ['contact_notes', 'Call'],
['documents_notes', 'Documents'], ['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'], ['quoted_breakup', 'How the premium was reached'],
['lost_reason', 'Why it was dropped'], ['lost_reason', 'Why it was dropped'],
['resume_note', 'Why now'], ['resume_note', 'Why now'],