Skip to content

Safe provider write-back

Duckbill™ writes mailbox state only after a durable MailCommand / ProviderMutation exists. UI and rules never import @inbox-agent/providers.

Source: MAIL-66, MAIL-95, MAIL-65 and ADR 0025. Migration 0017_provider_mutations.sql.

Lifecycle

submitCommand
  → evaluatePolicy(actor: USER)
  → persist MailCommand + ProviderMutation + audit (PENDING)
  → adapter safe write (Graph markRead / setFlag / archive / move)
  → ACCEPTED (API success, not healthy)
  → incremental sync observes instance
  → SUCCEEDED or RECONCILE_NEEDED

SUCCEEDED is the only healthy status. Optimistic clients may show pending from command_id.

Allowed MVP commands

CommandPolicy actionCapabilityNotes
MarkRead / MarkUnreadmarkReadmarkReadUser-requested only
SetFlagsetFlagsetFlagUser-requested only
ArchivearchivearchiveIf the adapter can archive
MovemovemoveIf the adapter can move
Sendsend—Always POLICY_DENIED
Deletedelete—Always POLICY_DENIED

ENABLE_MICROSOFT_WRITES must be exactly true for Graph writes. ENABLE_SEND and ENABLE_DELETE stay false. Flipping ENABLE_SEND does not authorize send. Mail.Send is not in Graph scopes.

Errors

Convergence

Sync applies observed provider state to MessageInstance even when the change is an echo of our write. Echoes do not enqueue classify or fetch-body work. If later observation mismatches the desired state, the mutation stays RECONCILE_NEEDED and an audit/health alert is recorded.