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(reminders): make the email reminder dialog responsive (#7645)

gbirman6fc82db47f95
diff --git a/apps/web/src/features/reminders/components/email-reminder-form.tsx b/apps/web/src/features/reminders/components/email-reminder-form.tsx
index 9b9aa98ddf..0360f4dae6 100644
--- a/apps/web/src/features/reminders/components/email-reminder-form.tsx
+++ b/apps/web/src/features/reminders/components/email-reminder-form.tsx
@@ -27,14 +27,20 @@ export function EmailReminderForm(
onConditionChange: (value: EmailReminderCondition) => void;
times: readonly ReminderTimeOption[];
pending: boolean;
+ ready?: boolean;
error?: string;
+ onRetry?: () => void;
onSave: (at: Date, condition: EmailReminderCondition) => void;
onRemove?: () => void;
}
) {
const id = createUniqueId();
const select = (option: { date: Date }) => {
- if (!props.pending && option.date.getTime() > Date.now())
+ if (
+ props.ready !== false &&
+ !props.pending &&
+ option.date.getTime() > Date.now()
+ )
props.onSave(option.date, props.condition);
};
const list = createCommandListController({
@@ -115,7 +121,7 @@ export function EmailReminderForm(
selectedIndex={list.selectedIndex()}
scrollSelectedIntoView={list.shouldScrollSelectedIntoView()}
itemId={(_, index) => `${id}-${index}`}
- itemDisabled={() => props.pending}
+ itemDisabled={() => props.pending || props.ready === false}
onItemMouseMove={list.setSelectedIndexFromPointer}
onSelect={select}
class="min-h-0 max-h-80 mobile:[&_[role=option]]:h-auto mobile:[&_[role=option]]:min-h-12"
@@ -144,10 +150,15 @@ export function EmailReminderForm(
<span role="status">
{props.pending ? 'Saving…' : '↑ ↓ to choose · Enter to snooze'}
</span>
+ <Show when={props.onRetry}>
+ <Button variant="ghost" onClick={() => props.onRetry?.()}>
+ Retry
+ </Button>
+ </Show>
<Show when={props.onRemove}>
<Button
variant="ghost"
- disabled={props.pending}
+ disabled={props.pending || props.ready === false}
onClick={() => props.onRemove?.()}
>
Remove reminder
diff --git a/apps/web/src/features/reminders/views/email-reminder-composer-loading.test.tsx b/apps/web/src/features/reminders/views/email-reminder-composer-loading.test.tsx
new file mode 100644
index 0000000000..1b8af6b931
--- /dev/null
+++ b/apps/web/src/features/reminders/views/email-reminder-composer-loading.test.tsx
@@ -0,0 +1,124 @@
+import type { EmailFollowup } from '@service-storage/generated/schemas/emailFollowup';
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { createStore } from 'solid-js/store';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { EmailReminderComposer } from './email-reminder-composer';
+
+const mocks = vi.hoisted(() => ({ query: vi.fn(), execute: vi.fn() }));
+vi.mock('@queries/reminders/email-followup', () => ({
+ useEmailFollowupQuery: mocks.query,
+ executeEmailFollowup: mocks.execute,
+}));
+vi.mock('@queries/undo', () => ({
+ useMutationUndoContext: () => ({ pushUndo: vi.fn() }),
+}));
+
+const reminder: EmailFollowup = {
+ threadId: 'thread',
+ linkId: 'inbox',
+ reminderId: 'reminder',
+ revision: 'original',
+ remindAt: '2027-12-01T12:00:00Z',
+ condition: 'regardless',
+ state: 'pending',
+};
+
+beforeEach(() => {
+ vi.resetAllMocks();
+ Element.prototype.scrollIntoView = vi.fn();
+ window.scrollTo = vi.fn();
+});
+afterEach(cleanup);
+
+function setup() {
+ const [query, setQuery] = createStore({
+ isSuccess: false,
+ isError: false,
+ data: undefined as EmailFollowup | null | undefined,
+ refetch: vi.fn(),
+ });
+ mocks.query.mockReturnValue(query);
+ const close = vi.fn();
+ render(() => (
+ <EmailReminderComposer
+ entity={{ id: 'thread', type: 'email', name: 'A conversation' }}
+ open={true}
+ onOpenChange={close}
+ />
+ ));
+ return { query, setQuery, close };
+}
+
+it('opens the time picker immediately and keeps its input and focus when the lookup resolves', async () => {
+ const { setQuery } = setup();
+ const input = screen.getByRole('combobox', { name: 'Remind me when' });
+ expect(screen.queryByText('Loading reminder…')).toBeNull();
+ expect(screen.getByRole('option', { name: /In 30m/ })).toBeTruthy();
+ await waitFor(() => expect(document.activeElement).toBe(input));
+ fireEvent.input(input, { target: { value: 'in 2 hours' } });
+ fireEvent.keyDown(input, { key: 'Enter' });
+ expect(mocks.execute).not.toHaveBeenCalled();
+
+ setQuery({ isSuccess: true, data: reminder });
+ expect(screen.getByRole('combobox')).toBe(input);
+ expect(document.activeElement).toBe(input);
+ expect((input as HTMLInputElement).value).toBe('in 2 hours');
+ expect(screen.getByText(/Scheduled for/)).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'Remove reminder' })).toBeTruthy();
+ mocks.execute.mockResolvedValue({ ...reminder, revision: 'saved' });
+ fireEvent.keyDown(input, { key: 'Enter' });
+ await waitFor(() => expect(mocks.execute).toHaveBeenCalledOnce());
+ expect(mocks.execute).toHaveBeenCalledWith(
+ 'thread',
+ expect.objectContaining({
+ condition: 'regardless',
+ expectedRevision: 'original',
+ }),
+ expect.any(Function)
+ );
+});
+
+it('preserves a condition chosen before the existing reminder arrives', async () => {
+ const { setQuery } = setup();
+ fireEvent.click(screen.getByRole('radio', { name: 'Regardless' }));
+ setQuery({
+ isSuccess: true,
+ data: { ...reminder, condition: 'if_no_reply' },
+ });
+ mocks.execute.mockResolvedValue(reminder);
+ fireEvent.keyDown(screen.getByRole('combobox'), { key: 'Enter' });
+ await waitFor(() => expect(mocks.execute).toHaveBeenCalledOnce());
+ expect(mocks.execute.mock.calls[0][1].condition).toBe('regardless');
+});
+
+it('keeps the same picker on failure and retry, without permitting an unchecked write', async () => {
+ const { query, setQuery } = setup();
+ const input = screen.getByRole('combobox');
+ fireEvent.input(input, { target: { value: 'in 2 hours' } });
+ setQuery({ isError: true });
+ expect(screen.getByRole('alert').textContent).toContain('Couldn’t load');
+ fireEvent.keyDown(input, { key: 'Enter' });
+ expect(mocks.execute).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(query.refetch).toHaveBeenCalledOnce();
+ setQuery({ isError: false, isSuccess: true, data: null });
+ expect(screen.getByRole('combobox')).toBe(input);
+ expect((input as HTMLInputElement).value).toBe('in 2 hours');
+ expect(screen.queryByRole('alert')).toBeNull();
+ mocks.execute.mockResolvedValue(reminder);
+ fireEvent.keyDown(input, { key: 'Enter' });
+ await waitFor(() => expect(mocks.execute).toHaveBeenCalledOnce());
+});
+
+it('allows cancellation while the initial lookup is pending', () => {
+ const { close } = setup();
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
+ expect(close).toHaveBeenCalledWith(false);
+ expect(mocks.execute).not.toHaveBeenCalled();
+});
diff --git a/apps/web/src/features/reminders/views/email-reminder-composer.tsx b/apps/web/src/features/reminders/views/email-reminder-composer.tsx
index 03f91215bb..1fc04428ca 100644
--- a/apps/web/src/features/reminders/views/email-reminder-composer.tsx
+++ b/apps/web/src/features/reminders/views/email-reminder-composer.tsx
@@ -6,8 +6,8 @@ import {
import { useMutationUndoContext } from '@queries/undo';
import type { EmailFollowup } from '@service-storage/generated/schemas/emailFollowup';
import type { EmailFollowupCommand } from '@service-storage/generated/schemas/emailFollowupCommand';
-import { Button, Dialog, type ManagedDialogProps } from '@ui';
-import { createSignal, Show } from 'solid-js';
+import type { ManagedDialogProps } from '@ui';
+import { createSignal } from 'solid-js';
import type { EmailReminderCondition } from '../core/email-reminder';
import { EmailReminderMenu } from './email-reminder-menu';
@@ -30,7 +30,7 @@ export function EmailReminderComposer(
const active = () =>
current()?.state === 'pending' || current()?.state === 'archiving';
const submit = async (command: EmailFollowupCommand) => {
- if (pending()) return;
+ if (pending() || !query.isSuccess) return;
setPending(true);
setError(undefined);
if (operationSnapshot?.operationId !== command.operationId) {
@@ -132,57 +132,41 @@ export function EmailReminderComposer(
void submit(lastCommand);
};
return (
- <Show
- when={query.isSuccess}
- fallback={
- <Dialog open={props.open} onOpenChange={props.onOpenChange}>
- <Dialog.Title>Remind me</Dialog.Title>
- <p role="status">
- {query.isError
- ? 'Couldn’t load this email reminder.'
- : 'Loading reminder…'}
- </p>
- <Show when={query.isError}>
- <Button onClick={() => void query.refetch()}>Retry</Button>
- </Show>
- <Button onClick={() => props.onOpenChange(false)}>Cancel</Button>
- </Dialog>
- }
- >
- <EmailReminderMenu
- open={props.open}
- onOpenChange={(open) => {
- if (!pending()) props.onOpenChange(open);
- }}
- subject={props.entity.name}
- initialTime={active() ? current()?.remindAt : undefined}
- initialCondition={active() ? current()?.condition : undefined}
- pending={pending()}
- error={error()}
- onSave={save}
- onRemove={
- active()
- ? () => {
- const revision = current()?.revision;
- if (!revision) return;
- if (
- !lastCommand ||
- lastCommand.type !== 'remove' ||
- (lastCommand.expectedRevision !== revision &&
- revision !== lastCommand.operationId)
- ) {
- lastCommand = {
- type: 'remove',
- operationId: crypto.randomUUID(),
- expectedRevision: revision,
- undo: false,
- };
- }
- void submit(lastCommand);
+ <EmailReminderMenu
+ open={props.open}
+ onOpenChange={(open) => {
+ if (!pending()) props.onOpenChange(open);
+ }}
+ subject={props.entity.name}
+ initialTime={active() ? current()?.remindAt : undefined}
+ initialCondition={active() ? current()?.condition : undefined}
+ pending={pending()}
+ ready={query.isSuccess}
+ error={query.isError ? 'Couldn’t load this email reminder.' : error()}
+ onRetry={query.isError ? () => void query.refetch() : undefined}
+ onSave={save}
+ onRemove={
+ active()
+ ? () => {
+ const revision = current()?.revision;
+ if (!revision) return;
+ if (
+ !lastCommand ||
+ lastCommand.type !== 'remove' ||
+ (lastCommand.expectedRevision !== revision &&
+ revision !== lastCommand.operationId)
+ ) {
+ lastCommand = {
+ type: 'remove',
+ operationId: crypto.randomUUID(),
+ expectedRevision: revision,
+ undo: false,
+ };
}
- : undefined
- }
- />
- </Show>
+ void submit(lastCommand);
+ }
+ : undefined
+ }
+ />
);
}
diff --git a/apps/web/src/features/reminders/views/email-reminder-menu.tsx b/apps/web/src/features/reminders/views/email-reminder-menu.tsx
index 398bbf4ddd..9d8d62e2f9 100644
--- a/apps/web/src/features/reminders/views/email-reminder-menu.tsx
+++ b/apps/web/src/features/reminders/views/email-reminder-menu.tsx
@@ -12,16 +12,14 @@ type Props = Omit<
export function EmailReminderMenu(props: Props) {
const [query, setQuery] = createSignal('');
- const [condition, setCondition] = createSignal(
- props.initialCondition ?? 'if_no_reply'
- );
+ const [condition, setCondition] = createSignal<EmailReminderCondition>();
const times = createReminderTimeOptions(query);
return (
<EmailReminderForm
{...props}
query={query()}
onQueryChange={setQuery}
- condition={condition()}
+ condition={condition() ?? props.initialCondition ?? 'if_no_reply'}
onConditionChange={setCondition}
times={times()}
/>
diff --git a/apps/web/src/lib/queries/reminders/email-followup-query.test.ts b/apps/web/src/lib/queries/reminders/email-followup-query.test.ts
new file mode 100644
index 0000000000..494c756356
--- /dev/null
+++ b/apps/web/src/lib/queries/reminders/email-followup-query.test.ts
@@ -0,0 +1,143 @@
+import type { EmailFollowup } from '@service-storage/generated/schemas/emailFollowup';
+import { QueryClient, QueryObserver } from '@tanstack/solid-query';
+import { ok } from 'neverthrow';
+import { afterEach, expect, it, vi } from 'vitest';
+import { queryClient } from '../client';
+import { emailFollowupQueryOptions } from './email-followup';
+import { reminderKeys } from './keys';
+
+const read = vi.hoisted(() => vi.fn());
+vi.mock('../client', () => ({ queryClient: new QueryClient() }));
+vi.mock('@service-storage/client', () => ({
+ storageServiceClient: { reminders: { getEmailFollowup: read } },
+}));
+vi.mock('../soup/cache', () => ({ refetchSoupEntity: vi.fn() }));
+vi.mock('../soup/graphql/active-queries', () => ({
+ refreshActiveGraphqlSoupQueries: vi.fn(),
+}));
+vi.mock('../email/graphql/thread', () => ({
+ fetchGraphqlEmailThread: vi.fn(),
+}));
+
+const followup: EmailFollowup = {
+ condition: 'regardless',
+ linkId: 'inbox',
+ remindAt: '2027-12-01T12:00:00Z',
+ reminderId: 'reminder',
+ revision: 'original',
+ state: 'pending',
+ threadId: 'thread',
+};
+const collectionKey = reminderKeys.emailCollection('owner', {}).queryKey;
+const seedCollection = (updatedAt: number) =>
+ queryClient.setQueryData(
+ collectionKey,
+ {
+ pages: [{ items: [{ threadId: 'thread', followup }], nextCursor: null }],
+ pageParams: [undefined],
+ },
+ { updatedAt }
+ );
+
+afterEach(() => {
+ queryClient.clear();
+ vi.resetAllMocks();
+});
+
+it('opens a listed reminder from the collection cache without another network wait', () => {
+ seedCollection(Date.now());
+ const observer = new QueryObserver(
+ queryClient,
+ emailFollowupQueryOptions('thread')
+ );
+ const stop = observer.subscribe(() => {});
+ try {
+ expect(observer.getCurrentResult().data).toEqual(followup);
+ expect(observer.getCurrentResult().isSuccess).toBe(true);
+ expect(read).not.toHaveBeenCalled();
+ } finally {
+ stop();
+ }
+});
+
+it('preserves the age of cached collection data and refreshes stale reminders', async () => {
+ const updatedAt = Date.now() - 60_000;
+ seedCollection(updatedAt);
+ read.mockResolvedValue(ok({ ...followup, revision: 'newer' }));
+ const observer = new QueryObserver(
+ queryClient,
+ emailFollowupQueryOptions('thread')
+ );
+ expect(observer.getCurrentResult().dataUpdatedAt).toBe(updatedAt);
+ const stop = observer.subscribe(() => {});
+ try {
+ expect(observer.getCurrentResult().data).toEqual(followup);
+ await vi.waitFor(() =>
+ expect(observer.getCurrentResult().data?.revision).toBe('newer')
+ );
+ expect(read).toHaveBeenCalledWith('thread');
+ } finally {
+ stop();
+ }
+});
+
+it('does not infer that an email missing from a filtered page has no reminder', () => {
+ seedCollection(Date.now());
+ expect(
+ emailFollowupQueryOptions('another-thread').initialData
+ ).toBeUndefined();
+});
+
+it('does not revive an invalidated collection entry or replace a newer detail entry', async () => {
+ seedCollection(Date.now());
+ await queryClient.invalidateQueries({ queryKey: collectionKey });
+ expect(emailFollowupQueryOptions('thread').initialData).toBeUndefined();
+ seedCollection(Date.now());
+ queryClient.setQueryData(reminderKeys.email('thread').queryKey, {
+ ...followup,
+ state: 'removed',
+ });
+ const observer = new QueryObserver(
+ queryClient,
+ emailFollowupQueryOptions('thread')
+ );
+ expect(observer.getCurrentResult().data?.state).toBe('removed');
+});
+
+it('uses a newer collection revision when a fresh detail entry already exists', () => {
+ const now = Date.now();
+ queryClient.setQueryData(
+ reminderKeys.email('thread').queryKey,
+ { ...followup, revision: 'older-detail' },
+ { updatedAt: now - 1_000 }
+ );
+ seedCollection(now);
+ const observer = new QueryObserver(
+ queryClient,
+ emailFollowupQueryOptions('thread')
+ );
+ const stop = observer.subscribe(() => {});
+ try {
+ expect(observer.getCurrentResult().data?.revision).toBe(followup.revision);
+ expect(observer.getCurrentResult().dataUpdatedAt).toBe(now);
+ expect(read).not.toHaveBeenCalled();
+ } finally {
+ stop();
+ }
+});
+
+it('preserves a newer detail revision when the collection is older', () => {
+ const now = Date.now();
+ seedCollection(now - 1_000);
+ queryClient.setQueryData(
+ reminderKeys.email('thread').queryKey,
+ { ...followup, revision: 'newer-detail' },
+ { updatedAt: now }
+ );
+ const observer = new QueryObserver(
+ queryClient,
+ emailFollowupQueryOptions('thread')
+ );
+ expect(observer.getCurrentResult().data?.revision).toBe('newer-detail');
+ expect(observer.getCurrentResult().dataUpdatedAt).toBe(now);
+});
diff --git a/apps/web/src/lib/queries/reminders/email-followup.test.ts b/apps/web/src/lib/queries/reminders/email-followup.test.ts
index afede4086a..94da8182b2 100644
--- a/apps/web/src/lib/queries/reminders/email-followup.test.ts
+++ b/apps/web/src/lib/queries/reminders/email-followup.test.ts
@@ -91,9 +91,60 @@ describe('email follow-up cache reconciliation', () => {
await expect(executeEmailFollowup('thread', command)).resolves.toEqual(
result
);
+ await vi.waitFor(() => expect(log).toHaveBeenCalled());
} finally {
log.mockRestore();
}
expect(mocks.write).toHaveBeenCalledOnce();
});
});
+
+it.each(['set', 'remove'] as const)(
+ 'confirms %s without waiting for list refreshes',
+ async (type) => {
+ let finishRefresh!: () => void;
+ mocks.invalidate.mockReturnValue(
+ new Promise<void>((resolve) => {
+ finishRefresh = resolve;
+ })
+ );
+ const operation: EmailFollowupCommand =
+ type === 'set'
+ ? command
+ : {
+ type: 'remove',
+ operationId: 'remove',
+ expectedRevision: result.revision,
+ undo: false,
+ };
+ try {
+ await expect(executeEmailFollowup('thread', operation)).resolves.toEqual(
+ result
+ );
+ expect(mocks.setData).toHaveBeenCalledWith(expect.any(Array), result);
+ expect(mocks.invalidate).toHaveBeenCalled();
+ } finally {
+ finishRefresh();
+ }
+ }
+);
+
+it('confirms the write immediately while preserving navigation before list refreshes', async () => {
+ let finishNavigation!: () => void;
+ const after = vi.fn(
+ () =>
+ new Promise<void>((resolve) => {
+ finishNavigation = resolve;
+ })
+ );
+ try {
+ await expect(
+ executeEmailFollowup('thread', command, after)
+ ).resolves.toEqual(result);
+ expect(after).toHaveBeenCalledWith(result);
+ expect(mocks.invalidate).not.toHaveBeenCalled();
+ } finally {
+ finishNavigation();
+ }
+ await vi.waitFor(() => expect(mocks.invalidate).toHaveBeenCalled());
+});
diff --git a/apps/web/src/lib/queries/reminders/email-followup.ts b/apps/web/src/lib/queries/reminders/email-followup.ts
index 1d355b3325..bc256eb88b 100644
--- a/apps/web/src/lib/queries/reminders/email-followup.ts
+++ b/apps/web/src/lib/queries/reminders/email-followup.ts
@@ -6,7 +6,12 @@ import { throwOnErr } from '@core/util/result';
import { storageServiceClient } from '@service-storage/client';
import type { EmailFollowup } from '@service-storage/generated/schemas/emailFollowup';
import type { EmailFollowupCommand } from '@service-storage/generated/schemas/emailFollowupCommand';
-import { useQuery } from '@tanstack/solid-query';
+import type { EmailReminderPage } from '@service-storage/generated/schemas/emailReminderPage';
+import {
+ type InfiniteData,
+ queryOptions,
+ useQuery,
+} from '@tanstack/solid-query';
import type { Accessor } from 'solid-js';
import { queryClient } from '../client';
import { fetchGraphqlEmailThread } from '../email/graphql/thread';
@@ -16,15 +21,46 @@ import { refreshActiveGraphqlSoupQueries } from '../soup/graphql/active-queries'
import { invalidateEmailReminderReads } from './email-collection';
import { reminderKeys } from './keys';
-export function useEmailFollowupQuery(threadId: Accessor<string>) {
- return useQuery(() => ({
- queryKey: reminderKeys.email(threadId()).queryKey,
+/** Reuse a loaded Reminders page without treating filtered-out emails as absent. */
+export function emailFollowupQueryOptions(threadId: string) {
+ const cached = queryClient
+ .getQueriesData<InfiniteData<EmailReminderPage>>({
+ queryKey: reminderKeys.emailCollection._def,
+ })
+ .flatMap(([key, data]) => {
+ const state = queryClient.getQueryState(key);
+ const followup = data?.pages
+ .flatMap((page) => page.items)
+ .find((item) => item.threadId === threadId)?.followup;
+ return followup && state && !state.isInvalidated
+ ? [{ followup, updatedAt: state.dataUpdatedAt }]
+ : [];
+ })
+ .sort((a, b) => b.updatedAt - a.updatedAt)[0];
+ const queryKey = reminderKeys.email(threadId).queryKey;
+ const detailUpdatedAt =
+ queryClient.getQueryState(queryKey)?.dataUpdatedAt ?? 0;
+ if (cached && cached.updatedAt > detailUpdatedAt) {
+ queryClient.setQueryData(queryKey, cached.followup, {
+ updatedAt: cached.updatedAt,
+ });
+ }
+ return queryOptions({
+ queryKey,
queryFn: () =>
throwOnErr(() =>
- storageServiceClient.reminders.getEmailFollowup(threadId())
+ storageServiceClient.reminders.getEmailFollowup(threadId)
),
+ initialData: cached?.followup,
+ initialDataUpdatedAt: cached?.updatedAt,
+ staleTime: 30_000,
refetchInterval: 30_000,
- }));
+ throwOnError: false,
+ });
+}
+
+export function useEmailFollowupQuery(threadId: Accessor<string>) {
+ return useQuery(() => emailFollowupQueryOptions(threadId()));
}
/** One server command owns scheduling and inbox movement. No client archive. */
@@ -38,6 +74,16 @@ export async function executeEmailFollowup(
);
// Presentation/cache failures must not make the successful write retryable.
queryClient.setQueryData(reminderKeys.email(threadId).queryKey, result);
+ void reconcileEmailFollowup(threadId, result, afterPersisted);
+ return result;
+}
+
+/** Navigation runs before list refreshes, but neither holds the dialog open. */
+async function reconcileEmailFollowup(
+ threadId: string,
+ result: EmailFollowup,
+ afterPersisted?: (result: EmailFollowup) => void | Promise<void>
+) {
try {
await afterPersisted?.(result);
} catch (error) {
@@ -58,5 +104,4 @@ export async function executeEmailFollowup(
} catch (error) {
console.error('Email reminder saved but refresh failed', error);
}
- return result;
}
diff --git a/docs/AGENT_GUIDE/reminders.md b/docs/AGENT_GUIDE/reminders.md
index bbfdf8cfed..bdfdfe41af 100644
--- a/docs/AGENT_GUIDE/reminders.md
+++ b/docs/AGENT_GUIDE/reminders.md
@@ -14,12 +14,21 @@ and time choices: **In 30m**, **Later today** (before 5 PM), **Tomorrow**, and
saves immediately. **Cancel** or Escape closes without saving. There is no
separate title, note, or recurrence step.
+The time picker opens immediately, including on the first use. You can type or
+change the condition while its existing reminder is fetched; time choices enable
+once that lookup succeeds. The same input keeps focus and its text when data
+arrives. Reminders already loaded in the Reminders list reuse their cached data.
+A failed lookup shows an inline error and **Retry** inside the picker; **Cancel**
+and Escape remain available.
+
**If no reply** is the default. A new inbound reply cancels that reminder;
outgoing mail, drafts, replayed messages, and historical backfill do not.
**Regardless** survives a reply. Only one active reminder is allowed per user
and conversation. Opening the menu again edits that reminder; **Remove reminder**
returns the conversation to its inbox. Scheduling archives it and advances
-within the invoking email list only after the server confirms success.
+within the invoking email list only after the server confirms success. The menu
+closes on confirmation; navigation and background list refreshes do not delay
+closing the menu or making undo available.
Bare H still types inside reply, compose, search, and other editable fields.
On tasks, H collapses the item or its parent group. On list group headers,
@@ -63,6 +72,13 @@ rows and exposes **Couldn’t load more email. Try again**.
For UI failure checks against hosted data, intercept
`PUT **/dss/reminders/email/{threadId}`. Hold or reject the response and verify:
+- Delay `GET **/dss/reminders/email/{threadId}` with an empty detail cache:
+ the complete picker appears immediately, focuses **Remind me when**, accepts
+ typing, and never shows a separate loading dialog. Resolving the request
+ preserves the input and its focus. Verify both opening and reopening.
+- Reject the GET: the same picker shows **Retry**, preserves typed text, and
+ cannot save until a successful lookup. An existing reminder's condition is
+ applied unless the user has already changed it.
- Saving disables controls and repeated input cannot issue duplicate writes.
- A failure keeps the chosen time and condition, shows an inline retry message,
and does not navigate or send a separate client archive request.