Skip to content

feat(email): Wire pre_scan_inbox to Triage Dashboard with explicit Refresh #1009

@itomek

Description

@itomek

Goal

Replace the dashboard's empty placeholder with real triage data fetched from the existing pre_scan_inbox tool. The Refresh button calls the agent, the response populates the Surfaced column. This is the v0 dogfoodable — a user can land on the dashboard, click Refresh, and see their inbox classified within one click.

Why now

Second sub-issue under #1007. Builds directly on the skeleton from #1008. After this lands, the dashboard is useful even though it doesn't yet remember anything between sessions — the "manually-triggered snapshot" mode from the umbrella's build order.

Scope

  • Wire the dashboard's Refresh button to the existing pre_scan_inbox tool path. Reuse whatever client / SSE flow the Agent UI uses today for agent-driven actions.
  • Render the returned email_pre_scan envelope into the dashboard:
    • Surfaced column displays urgent + actionable items, sender + subject + reason, with the existing inline action buttons (Reply / Open / Dismiss).
    • Archived this session column — empty until sub-issue 3 wires the state machine; for now, suggested archives surface as a sub-section inside Surfaced.
  • Loading state: while a refresh is in flight, show a determinate or indeterminate progress indicator (final styling can iterate in sub-issue 8).
  • Error state: if the tool returns ok: false, surface the error inline in the dashboard (don't redirect to chat, don't crash).
  • Reuse the row component from EmailPreScanCard.tsx so styling stays in lockstep.
  • Last-refreshed timestamp in the header.

Acceptance

  • Clicking Refresh fires pre_scan_inbox, loading indicator appears, results populate the Surfaced column on success.
  • On error, the dashboard surfaces the error string visibly without crashing.
  • Sender / subject / reason display matches the existing card's row shape.
  • Reply / Open / Dismiss buttons reuse the same dispatch path as PR #995 (id-only chat-message dispatch via gaia:send-message event).
  • No persistence between page reloads — by design; documented in the empty state.
  • Lint / TypeScript / build clean; backend tests still pass.
  • Dogfoodable: a user with a connected Google account can land on the dashboard and act on at least one suggested archive in under one minute.

Out of scope

  • State machine for items moving between columns (sub-issue 3).
  • Drafted column populated from draft_reply (sub-issue 4).
  • Calendar items (sub-issue 5).
  • Auto-refresh / background poll (sub-issue 9).

Depends on

  • #1008 — Dashboard skeleton must exist first.
  • PR #995 — provides pre_scan_inbox tool + the SSE deterministic-render hook; both reused as-is here.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentdomain:automationScheduler, autonomy, RAG, web search, watchers, researchenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions