diff --git a/src/renderer/src/components/settings/cloud-api/CloudRoutineRow.tsx b/src/renderer/src/components/settings/cloud-api/CloudRoutineRow.tsx index af301a4084e..aad30e0e498 100644 --- a/src/renderer/src/components/settings/cloud-api/CloudRoutineRow.tsx +++ b/src/renderer/src/components/settings/cloud-api/CloudRoutineRow.tsx @@ -127,17 +127,14 @@ export function RoutineRow({ setNotice(null) const failure = await onRunNow() setRunning(false) - setNotice( - failure - ? { tone: 'error', text: failure } - : { - tone: 'ok', - text: t( - 'auto.components.settings.cloudRoutines.queued', - 'Run queued. It shows up in the history below.' - ) - } - ) + if (failure) { + setNotice({ tone: 'error', text: failure }) + return + } + // The new run's status lives in the pill and the history; open the history so it is in view. + if (!expanded) { + onToggleHistory() + } } return ( @@ -218,7 +215,7 @@ export function RoutineRow({ variant="ghost" size="xs" aria-disabled={running && !active} - aria-busy={running || active} + aria-busy={running} aria-expanded={active ? expanded : undefined} aria-controls={active ? historyId : undefined} onClick={() => void runNow()} @@ -246,14 +243,9 @@ export function RoutineRow({ : undefined } > - {running || active ? ( - - ) : ( - - )} - {active - ? t('auto.components.settings.cloudRoutines.runningNow', 'Running…') - : t('auto.components.settings.cloudRoutines.runNow', 'Run now')} + {/* Spins only while the request is in flight; the run's own status is the pill's job. */} + {running ? : } + {t('auto.components.settings.cloudRoutines.runNow', 'Run now')} diff --git a/src/renderer/src/components/settings/cloud-api/CloudRoutinesView.fixture.tsx b/src/renderer/src/components/settings/cloud-api/CloudRoutinesView.fixture.tsx index 6bb25768433..44422f66bdc 100644 --- a/src/renderer/src/components/settings/cloud-api/CloudRoutinesView.fixture.tsx +++ b/src/renderer/src/components/settings/cloud-api/CloudRoutinesView.fixture.tsx @@ -283,6 +283,41 @@ export const runHistory = defineFixture({ render: () => }) +/** Right after Run now: the pill and history say Queued; the button is back to Run now. */ +export const justQueued = defineFixture({ + width: 820, + render: () => ( + + r.id === 'rt_triage' + ? { ...r, lastRun: { id: 'run_q', status: 'queued', finishedAt: null } } + : r + ) + }} + loadRuns={async () => ({ + ok: true, + data: { + runs: [ + run({ + id: 'run_q', + status: 'queued', + trigger: 'manual', + createdAt: NOW - 3_000, + startedAt: null + }), + ...RUNS.runs.slice(1) + ], + nextBefore: null + } + })} + initial={{ historyFor: 'rt_triage' }} + /> + ) +}) + export const runHistoryEmpty = defineFixture({ width: 820, render: () => ( diff --git a/src/renderer/src/components/settings/cloud-api/cloud-api-format.test.ts b/src/renderer/src/components/settings/cloud-api/cloud-api-format.test.ts index 38137b52967..86ef124bba5 100644 --- a/src/renderer/src/components/settings/cloud-api/cloud-api-format.test.ts +++ b/src/renderer/src/components/settings/cloud-api/cloud-api-format.test.ts @@ -10,6 +10,7 @@ import { describeRoutineTrigger, formatCountdown, formatKeyPrefix, + formatRelativeFromNow, formatRunDuration, presetForScopes, scopesForPreset, @@ -65,6 +66,15 @@ describe('formatting', () => { ).toMatch(/^Weekdays at 9:00.* E[SD]T$/) }) + it('says "just now" for the last minute, not "this minute"', () => { + const now = 1_000_000_000 + expect(formatRelativeFromNow(now - 3_000, now, 'en')).toBe('just now') + expect(formatRelativeFromNow(now - 59_000, now, 'en')).toBe('just now') + expect(formatRelativeFromNow(now - 5 * 60_000, now, 'en')).toBe('5 minutes ago') + // Future times (next scheduled run) keep Intl wording. + expect(formatRelativeFromNow(now + 10 * 60_000, now, 'en')).toBe('in 10 minutes') + }) + it('offers the local zone first', () => { const zones = timeZoneOptions('Asia/Tokyo') expect(zones[0]).toBe('Asia/Tokyo') diff --git a/src/renderer/src/components/settings/cloud-api/cloud-api-format.ts b/src/renderer/src/components/settings/cloud-api/cloud-api-format.ts index daa7e17d258..15b98d6df4c 100644 --- a/src/renderer/src/components/settings/cloud-api/cloud-api-format.ts +++ b/src/renderer/src/components/settings/cloud-api/cloud-api-format.ts @@ -51,6 +51,10 @@ export function formatKeyPrefix(prefix: string): string { } export function formatRelativeFromNow(timestamp: number, now: number, intlLocale?: string): string { + // Under a minute ago reads "just now", like the other cloud screens (not Intl's "this minute"). + if (timestamp <= now && now - timestamp < 60_000) { + return translate('auto.components.cloudWorkspaces.justNow', 'just now') + } return formatUiRelativeTime(timestamp - now, intlLocale) } diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index 1d5f91c8737..b8388163803 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -14601,7 +14601,6 @@ "sectionDescription": "For the Orca Cloud API, the orca CLI and MCP clients. Claude or Codex keys go in Cloud secrets." }, "cloudRoutines": { - "queued": "Run queued. It shows up in the history below.", "pausedSr": "(paused)", "createdByPerson": "by ", "lastRun": "Last run:", @@ -14610,7 +14609,6 @@ "runningShowHistory": "{{routineName}} is running. Show run history", "runNowLabel": "Run {{routineName}} now", "alreadyRunning": "A run is already in progress.", - "runningNow": "Running…", "runNow": "Run now", "more": "More actions for {{routineName}}", "hideHistory": "Hide run history",