Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email): hide routine Outlook draft and send status (#8402)

teof5db7dbb9cb6
diff --git a/apps/web/src/features/email-compose/browser-test/outlook-recovery.browser.e2e.ts b/apps/web/src/features/email-compose/browser-test/outlook-recovery.browser.e2e.ts
index 59dce2cd69..1c1815822d 100644
--- a/apps/web/src/features/email-compose/browser-test/outlook-recovery.browser.e2e.ts
+++ b/apps/web/src/features/email-compose/browser-test/outlook-recovery.browser.e2e.ts
@@ -19,9 +19,6 @@ async function uncertainSend(page: Page) {
await expect(page.getByTestId('resolutions')).toHaveText(
'recheck:7:false,retry_send:7:true'
);
- await expect(
- page.getByRole('status').filter({ hasText: 'Confirming delivery' })
- ).toBeVisible();
}
test('uncertain delivery requires explicit duplicate acknowledgement', async ({
diff --git a/apps/web/src/features/email-compose/primitives/email-composer.ts b/apps/web/src/features/email-compose/primitives/email-composer.ts
index 50c354bcae..caa099eb8e 100644
--- a/apps/web/src/features/email-compose/primitives/email-composer.ts
+++ b/apps/web/src/features/email-compose/primitives/email-composer.ts
@@ -26,6 +26,7 @@ import type {
import {
operationBlocksEditing,
operationBlocksSending,
+ operationSending,
} from '../../email-message/core/message-operation';
import type {
EmailAttachmentStorage,
@@ -1242,7 +1243,8 @@ export function createEmailComposer(props: EmailComposerOptions) {
scheduling() ||
attachmentLinks.uploading() ||
schedule.action() === 'unavailable',
- isSending: () => submitting() || scheduling(),
+ isSending: () =>
+ submitting() || scheduling() || operationSending(currentOperation()),
hasDraft: () => currentDraftId() != null,
deliveryState: () =>
terminalState() ??
@@ -1255,7 +1257,8 @@ export function createEmailComposer(props: EmailComposerOptions) {
if (schedule.operation() === 'committing') return 'Scheduling email…';
if (schedule.operation() === 'updating') return 'Updating schedule…';
if (schedule.operation() === 'cancelling') return 'Cancelling schedule…';
- if (submitting()) return 'Sending…';
+ if (submitting() || operationSending(currentOperation()))
+ return 'Sending…';
if (attachmentLinks.uploading()) return 'Uploading files to share…';
if (schedule.action() === 'unavailable')
return `Scheduled for ${schedule.confirmedTime()?.toLocaleString()}. Choose a new time to update it, or cancel the schedule to edit.`;
diff --git a/apps/web/src/features/email-compose/primitives/reply-composer.ts b/apps/web/src/features/email-compose/primitives/reply-composer.ts
index 10cffc89e7..30b9d79999 100644
--- a/apps/web/src/features/email-compose/primitives/reply-composer.ts
+++ b/apps/web/src/features/email-compose/primitives/reply-composer.ts
@@ -28,6 +28,7 @@ import type { MessageOperationSourceFactory } from '../../email-message/context/
import {
operationBlocksEditing,
operationBlocksSending,
+ operationSending,
} from '../../email-message/core/message-operation';
import type {
EmailAttachmentStorage,
@@ -1493,7 +1494,7 @@ export function createReplyComposer(
if (schedule.operation() === 'committing') return 'Scheduling email…';
if (schedule.operation() === 'updating') return 'Updating schedule…';
if (schedule.operation() === 'cancelling') return 'Cancelling schedule…';
- if (submitting()) return 'Sending…';
+ if (submitting() || operationSending(currentOperation())) return 'Sending…';
if (attachmentLinks.uploading()) return 'Uploading files to share…';
if (schedule.action() === 'unavailable')
return `Scheduled for ${schedule.confirmedTime()?.toLocaleString()}. Choose a new time to update it, or cancel the schedule to edit.`;
@@ -1562,7 +1563,8 @@ export function createReplyComposer(
setQuoteCollapsed,
savedDraftId,
handleEditorConnect,
- isSending: () => submitting() || scheduling(),
+ isSending: () =>
+ submitting() || scheduling() || operationSending(currentOperation()),
recipients,
collectDraft,
scheduleDraftSave,
diff --git a/apps/web/src/features/email-message/core/message-operation.ts b/apps/web/src/features/email-message/core/message-operation.ts
index 384b986462..6b96118267 100644
--- a/apps/web/src/features/email-message/core/message-operation.ts
+++ b/apps/web/src/features/email-message/core/message-operation.ts
@@ -76,7 +76,10 @@ export function operationActions(
return [];
}
-export function operationDescription(operation: MessageOperation): string {
+/** Routine progress and confirmed outcomes stay silent, matching Gmail. */
+export function operationDescription(
+ operation: MessageOperation
+): string | undefined {
if (operation.issue === 'MOVE_PENDING')
return 'Finishing the inbox change. You can edit this copy; sending waits until the original draft is resolved.';
if (operation.issue === 'MOVE_CONFLICT')
@@ -95,25 +98,35 @@ export function operationDescription(operation: MessageOperation): string {
return 'Access to this inbox has changed. Reconnect it or ask its owner to restore your access.';
if (operation.issue === 'INVALID_CONTENT')
return 'Your mail provider could not save this draft. Edit the message or attachments to try again.';
- const descriptions: Record<MessageOperation['state'], string> = {
- PENDING: 'Synchronizing draft…',
- SYNCHRONIZED: 'Draft synchronized',
+ const descriptions: Record<MessageOperation['state'], string | undefined> = {
+ PENDING: undefined,
+ SYNCHRONIZED: undefined,
CONFLICT:
'This draft changed in your mailbox. Choose which version to keep. Either choice cancels scheduled delivery.',
UNCERTAIN:
operation.issue === 'SEND_UNKNOWN'
? 'Delivery could not be confirmed. Macro will not resend automatically. Check Sent mail or check again here.'
: 'A draft or attachment write could not be confirmed. Your local copy is preserved; check again before making further changes.',
- SUBMITTING: 'Submitting email…',
- CONFIRMING: 'Confirming delivery…',
- SENT: 'Sent copy confirmed',
- DELETED: 'Draft deleted',
+ SUBMITTING: undefined,
+ CONFIRMING: undefined,
+ SENT: undefined,
+ DELETED: undefined,
CANCELLED: 'This operation was cancelled. Your local copy is preserved.',
FAILED: 'This operation needs attention. Your local copy is preserved.',
};
return descriptions[operation.state];
}
+/** Provider delivery still in flight; composers present it like their own send. */
+export function operationSending(operation?: MessageOperation | null): boolean {
+ return operation?.state === 'SUBMITTING' || operation?.state === 'CONFIRMING';
+}
+
+/** Sent and deleted are final and silent, so nothing needs to observe them. */
+export function operationSettled(operation: MessageOperation): boolean {
+ return operation.state === 'SENT' || operation.state === 'DELETED';
+}
+
/** A move may remain editable while the original copy still prevents delivery. */
export function operationBlocksSending(
operation?: MessageOperation | null
diff --git a/apps/web/src/features/email-message/views/message-operation-recovery.tsx b/apps/web/src/features/email-message/views/message-operation-recovery.tsx
index 0ea240b5c1..a6f949b25f 100644
--- a/apps/web/src/features/email-message/views/message-operation-recovery.tsx
+++ b/apps/web/src/features/email-message/views/message-operation-recovery.tsx
@@ -47,21 +47,30 @@ export function MessageOperationRecovery(props: {
setPending(false);
}
};
+ const reloadReady = (operation: MessageOperation) =>
+ !!props.source.needsReload?.() && operation.state === 'SYNCHRONIZED';
+ const visibleOperation = () => {
+ const operation = props.source.operation();
+ if (!operation) return undefined;
+ const visible =
+ !!operationDescription(operation) ||
+ reloadReady(operation) ||
+ !!decision() ||
+ !!error();
+ return visible ? operation : undefined;
+ };
return (
- <Show when={props.source.operation()}>
+ <Show when={visibleOperation()}>
{(operation) => (
<div
class="border-b border-edge-muted p-3 text-sm"
role="status"
aria-live="polite"
>
- <p>{operationDescription(operation())}</p>
- <Show
- when={
- props.source.needsReload?.() &&
- operation().state === 'SYNCHRONIZED'
- }
- >
+ <Show when={operationDescription(operation())}>
+ {(description) => <p>{description()}</p>}
+ </Show>
+ <Show when={reloadReady(operation())}>
<p>
The mailbox version is ready. Reload the draft to continue
editing.
diff --git a/apps/web/src/features/email-thread/email-thread.tsx b/apps/web/src/features/email-thread/email-thread.tsx
index 66aca418ce..0f4893b840 100644
--- a/apps/web/src/features/email-thread/email-thread.tsx
+++ b/apps/web/src/features/email-thread/email-thread.tsx
@@ -20,6 +20,7 @@ import { convertContactInfoToEmailRecipient } from '../email-compose/core/recipi
import { createEmailAttachmentOpener } from '../email-message/attachment-action-adapter';
import type { CalendarInvitation } from '../email-message/core/calendar-invitation';
import type { EmailMessage } from '../email-message/core/email-message';
+import { operationSettled } from '../email-message/core/message-operation';
import { EmailMessageOperation } from '../email-message/email-message-operation';
import { createEmailRenderingContext } from '../email-message/rendering-adapter';
import { EmailSenderIcon } from '../email-message/sender-icon-adapter';
@@ -98,7 +99,7 @@ export function EmailThread(props: EmailThreadProps) {
/>
),
renderOperation: (message: EmailMessage) =>
- message.operation ? (
+ message.operation && !operationSettled(message.operation) ? (
<EmailMessageOperation message={message} />
) : undefined,
renderTags: () => (
diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.md
index c7994ae631..54ec6faf49 100644
--- a/docs/agent-guide/email.md
+++ b/docs/agent-guide/email.md
@@ -41,9 +41,12 @@ sharing an inbox or thread inside Macro remains available.
For Outlook writes, distinguish acceptance from provider confirmation. Thread
organization notices and inbox settings show pending or failed changes; the
-mark-as-read from opening a thread is announced only if it fails. A saved
-draft can show a conflict or an uncertain delivery: use its recovery actions and
-check the provider copy before choosing an explicit resend. Switching the sender
+mark-as-read from opening a thread is announced only if it fails. Draft sync and
+delivery progress is silent, as on Gmail: a composer or sent message shows a
+notice only for a conflict, uncertain or rejected delivery, revoked access,
+unsavable content, or an inbox move. Use its recovery actions and check the
+provider copy before choosing an explicit resend; a resend in flight shows as
+the send button's pending state. Switching the sender
inbox copies the draft and attachments into the destination; wait for completion
before sending. If the copy is interrupted, use retry or keep the original.
diff --git a/docs/design/outlook-email-support.md b/docs/design/outlook-email-support.md
index 9356240242..9676eef89e 100644
--- a/docs/design/outlook-email-support.md
+++ b/docs/design/outlook-email-support.md
@@ -162,9 +162,8 @@ Outlook. Where Microsoft APIs cannot reproduce a behavior, investigate an
equivalent implementation and bring any material limitation back for a product
decision. Capability errors must be explicit, including missing consent.
-Uncertain sends may show a confirming/unknown outcome while reconciliation runs;
-an unresolved outcome requires deliberate user resend rather than automatic
-duplication. The user can supply test accounts at the live-validation stage.
+Confirmation runs silently, as Gmail sends do; an unresolved outcome shows as
+unknown and requires deliberate user resend rather than automatic duplication. The user can supply test accounts at the live-validation stage.
Contract and implementation work can start beforehand; account-dependent gates
remain unverified until the appropriate personal and organizational accounts exist.