From 92ea27d27ea8a0ab3a18227be3e771043696b529 Mon Sep 17 00:00:00 2001 From: Yashas Date: Wed, 16 Sep 2026 13:56:52 +0530 Subject: [PATCH] fix: her evidence comes from the trace, not from a form field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Case 58325 died submitting findings: the submit_decision call arrived with no `data` at all. The final model reply was exactly 4,096 output tokens — the service's cap — so the JSON was cut off mid-call. Asking Ava to paste 16 full SQL statements into sql_log, on top of a summary, root cause, five recommendations and a scanned-summary, is what pushed one tool call past the limit and lost the whole investigation. The platform already records every statement the agentic tool sends, verbatim, with Databricks' own SUCCEEDED/FAILED and the row count. So SqlEvidence now renders from the trace and treats sql_log as a one-line index per step. Her charter gained hard per-field character limits to match (sm2/custom-apps/denials-investigator/05_ai_employee.sql). Co-Authored-By: Claude Fable 5.1 --- src/components/Findings.tsx | 66 +++++++++++++++++++++++++++---------- src/screens/CaseScreen.tsx | 4 +-- 2 files changed, 51 insertions(+), 19 deletions(-) diff --git a/src/components/Findings.tsx b/src/components/Findings.tsx index 7d79493..b5a89f6 100644 --- a/src/components/Findings.tsx +++ b/src/components/Findings.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { AlertTriangle, CheckCircle2, ChevronDown, FileSearch } from 'lucide-react'; import { Badge, Card, Facts } from './core'; -import type { Row } from '../api/types'; +import type { AvaTraceStep, Row } from '../api/types'; import { firstDeadline, headline, @@ -148,11 +148,22 @@ export function FullStory({ row }: { row: Row }) { ); } -/** Every SQL statement she ran. For the sceptic in the room. Collapsed. */ -export function SqlEvidence({ row }: { row: Row }) { +/** + * Every SQL statement she ran. For the sceptic in the room. Collapsed. + * + * SOURCE OF TRUTH IS THE TRACE, not her sql_log field. The platform records + * every statement the agentic tool sent, verbatim, with Databricks' own + * SUCCEEDED/FAILED and the row count — so that is what is shown. Her sql_log + * is now a one-line-per-step index ("3c: department cut -> Cardiology +13 + * pts") and is used only as the note beside each statement. Asking her to + * paste 16 full queries into a form field was what blew the tool call past + * the output cap and lost a whole investigation. + */ +export function SqlEvidence({ row, steps }: { row: Row; steps: AvaTraceStep[] }) { const [open, setOpen] = useState(false); - const steps = sqlSteps(row.sql_log); - if (steps.length === 0) return null; + const queries = steps.filter((s) => s.type === 'api' && s.detail); + const notes = sqlSteps(row.sql_log); + if (queries.length === 0 && notes.length === 0) return null; return ( setOpen(!open)} icon={} title="Her evidence" - hint={`${steps.length} database queries, exactly as she ran them — anyone can re-run these`} + hint={ + queries.length + ? `${queries.length} database queries, exactly as she ran them — anyone can re-run these` + : `${notes.length} steps, in her own words` + } > -
    - {steps.map((s, i) => ( -
  1. - {s.label && ( -

    {s.label}

    - )} -
    {s.sql}
    - {s.note &&

    {s.note}

    } -
  2. - ))} -
+ {queries.length > 0 ? ( +
    + {queries.map((q, i) => ( +
  1. +

    + Query {i + 1} + {q.query_state === 'FAILED' ? ( + error — corrected next + ) : q.rows_returned != null ? ( + {q.rows_returned} row{q.rows_returned === 1 ? '' : 's'} + ) : null} +

    +
    {q.detail}
    + {notes[i]?.note &&

    {notes[i].note}

    } +
  2. + ))} +
+ ) : ( +
    + {notes.map((s, i) => ( +
  1. + {s.label &&

    {s.label}

    } +

    {s.sql}

    + {s.note &&

    {s.note}

    } +
  2. + ))} +
+ )}
); } diff --git a/src/screens/CaseScreen.tsx b/src/screens/CaseScreen.tsx index ecf5e0b..1007d1a 100644 --- a/src/screens/CaseScreen.tsx +++ b/src/screens/CaseScreen.tsx @@ -167,7 +167,7 @@ export function CaseScreen() { {hasFindings && ( <> - + {!aiOwned && ( - + setShowWork(!showWork)}