Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ui): correct timestamp formatting in message and thread components

Steven Enamakel6ae7dab13220
diff --git a/app/src/components/assistant-ui/message-timing.tsx b/app/src/components/assistant-ui/message-timing.tsx
index 2d4ca22f10..c053442041 100644
--- a/app/src/components/assistant-ui/message-timing.tsx
+++ b/app/src/components/assistant-ui/message-timing.tsx
@@ -7,6 +7,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from '@/components/assistant-ui/ui/tooltip';
+import { useT } from '@/lib/i18n/I18nContext';
import { useMessageTiming } from '@assistant-ui/react';
import type { FC } from 'react';
@@ -40,6 +41,7 @@ export const MessageTiming: FC<{
className?: string;
side?: 'top' | 'right' | 'bottom' | 'left';
}> = ({ className, side = 'right' }) => {
+ const { t } = useT();
const timing = useMessageTiming();
if (timing?.totalStreamTime === undefined) return null;
@@ -51,7 +53,7 @@ export const MessageTiming: FC<{
<button
type="button"
data-slot="message-timing-trigger"
- aria-label="Message timing"
+ aria-label={t('messageTiming.ariaLabel', 'Message timing')}
className={cn(
'text-muted-foreground hover:bg-accent hover:text-accent-foreground flex items-center rounded-md p-1 font-mono text-xs tabular-nums transition-colors',
className
@@ -68,28 +70,35 @@ export const MessageTiming: FC<{
<div className="grid min-w-35 gap-1.5 text-xs">
{timing.firstTokenTime !== undefined && (
<div className="flex items-center justify-between gap-4">
- <span className="text-muted-foreground">First token</span>
+ <span className="text-muted-foreground">
+ {t('messageTiming.firstToken', 'First token')}
+ </span>
<span className="font-mono tabular-nums">
{formatTimingMs(timing.firstTokenTime)}
</span>
</div>
)}
<div className="flex items-center justify-between gap-4">
- <span className="text-muted-foreground">Total</span>
+ <span className="text-muted-foreground">{t('messageTiming.total', 'Total')}</span>
<span className="font-mono tabular-nums">
{formatTimingMs(timing.totalStreamTime)}
</span>
</div>
{timing.tokensPerSecond !== undefined && (
<div className="flex items-center justify-between gap-4">
- <span className="text-muted-foreground">Speed</span>
+ <span className="text-muted-foreground">
+ {t('messageTiming.speed', 'Speed')}
+ </span>
<span className="font-mono tabular-nums">
- {timing.tokensPerSecond.toFixed(1)} tok/s
+ {t('messageTiming.tokensPerSecond', '{value} tok/s').replace(
+ '{value}',
+ timing.tokensPerSecond.toFixed(1)
+ )}
</span>
</div>
)}
<div className="flex items-center justify-between gap-4">
- <span className="text-muted-foreground">Chunks</span>
+ <span className="text-muted-foreground">{t('messageTiming.chunks', 'Chunks')}</span>
<span className="font-mono tabular-nums">{timing.totalChunks}</span>
</div>
</div>
diff --git a/app/src/components/assistant-ui/thread-list.tsx b/app/src/components/assistant-ui/thread-list.tsx
index 55342ab089..c4f9ab1d9b 100644
--- a/app/src/components/assistant-ui/thread-list.tsx
+++ b/app/src/components/assistant-ui/thread-list.tsx
@@ -342,6 +342,7 @@ const ThreadListItem: FC = () => {
};
const ThreadListItemRename: FC<{ onDone: (restoreFocus: boolean) => void }> = ({ onDone }) => {
+ const { t } = useT();
const aui = useAui();
const title = useAuiState(s => s.threadListItem.title) ?? '';
const [value, setValue] = useState(title);
@@ -385,7 +386,7 @@ const ThreadListItemRename: FC<{ onDone: (restoreFocus: boolean) => void }> = ({
ref={inputRef}
autoFocus
data-slot="aui_thread-list-item-rename"
- aria-label="Rename thread"
+ aria-label={t('assistantUi.threadList.renameThread', 'Rename thread')}
value={value}
className="h-7 min-w-0 flex-1 ps-2.5 pe-9 text-sm"
onChange={event => setValue(event.target.value)}
diff --git a/app/src/components/flows/canvas/__tests__/CanvasToolbar.test.tsx b/app/src/components/flows/canvas/__tests__/CanvasToolbar.test.tsx
new file mode 100644
index 0000000000..005ae778bc
--- /dev/null
+++ b/app/src/components/flows/canvas/__tests__/CanvasToolbar.test.tsx
@@ -0,0 +1,85 @@
+/**
+ * CanvasToolbar — the floating top-left history/viewport pill rendered
+ * inside `<ReactFlow>`. `@xyflow/react` is mocked here (rather than mounting
+ * a real `<ReactFlow>` as `FlowCanvas.test.tsx`/`EditableFlowCanvas.test.tsx`
+ * do) so `useReactFlow`'s zoom/fit calls can be asserted directly and `Panel`
+ * doesn't need a real store context — this is a focused unit test of the
+ * toolbar's own wiring, not an integration smoke test.
+ */
+import { fireEvent, render, screen } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+
+import CanvasToolbar from '../CanvasToolbar';
+import { FLOW_FIT_VIEW_OPTIONS } from '../fitView';
+
+const zoomIn = vi.hoisted(() => vi.fn());
+const zoomOut = vi.hoisted(() => vi.fn());
+const fitView = vi.hoisted(() => vi.fn());
+
+vi.mock('@xyflow/react', () => ({
+ Panel: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
+ useReactFlow: () => ({ zoomIn, zoomOut, fitView }),
+}));
+
+describe('CanvasToolbar', () => {
+ it('renders zoom/fit controls but no history or open-panel affordance by default', () => {
+ render(<CanvasToolbar />);
+ expect(screen.getByTestId('flow-canvas-toolbar')).toBeInTheDocument();
+ expect(screen.queryByTestId('flow-editor-undo')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('flow-editor-redo')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('flow-canvas-open-panel')).not.toBeInTheDocument();
+ });
+
+ it('calls zoomIn, zoomOut, and fitView with the shared fit options', () => {
+ render(<CanvasToolbar />);
+
+ fireEvent.click(screen.getByLabelText('flows.canvas.zoomOut'));
+ expect(zoomOut).toHaveBeenCalledTimes(1);
+
+ fireEvent.click(screen.getByLabelText('flows.canvas.zoomIn'));
+ expect(zoomIn).toHaveBeenCalledTimes(1);
+
+ fireEvent.click(screen.getByLabelText('flows.canvas.fitView'));
+ expect(fitView).toHaveBeenCalledWith(FLOW_FIT_VIEW_OPTIONS);
+ });
+
+ it('reflects history.canUndo/canRedo and fires the given callbacks', () => {
+ const onUndo = vi.fn();
+ const onRedo = vi.fn();
+ render(
+ <CanvasToolbar history={{ canUndo: true, canRedo: false, onUndo, onRedo }} />
+ );
+
+ const undo = screen.getByTestId('flow-editor-undo');
+ const redo = screen.getByTestId('flow-editor-redo');
+ expect(undo).not.toBeDisabled();
+ expect(redo).toBeDisabled();
+
+ fireEvent.click(undo);
+ expect(onUndo).toHaveBeenCalledTimes(1);
+
+ // Disabled button doesn't fire its handler.
+ fireEvent.click(redo);
+ expect(onRedo).not.toHaveBeenCalled();
+ });
+
+ it('disables undo when canUndo is false', () => {
+ render(
+ <CanvasToolbar
+ history={{ canUndo: false, canRedo: true, onUndo: vi.fn(), onRedo: vi.fn() }}
+ />
+ );
+ expect(screen.getByTestId('flow-editor-undo')).toBeDisabled();
+ expect(screen.getByTestId('flow-editor-redo')).not.toBeDisabled();
+ });
+
+ it('renders the open-panel button and fires onOpenPanel when the side panel is collapsed', () => {
+ const onOpenPanel = vi.fn();
+ render(<CanvasToolbar onOpenPanel={onOpenPanel} />);
+
+ const openButton = screen.getByTestId('flow-canvas-open-panel');
+ expect(openButton).toBeInTheDocument();
+ fireEvent.click(openButton);
+ expect(onOpenPanel).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/app/src/components/intelligence/SyncAuditPanel.test.tsx b/app/src/components/intelligence/SyncAuditPanel.test.tsx
index c7e00de587..cbbb7e6d0b 100644
--- a/app/src/components/intelligence/SyncAuditPanel.test.tsx
+++ b/app/src/components/intelligence/SyncAuditPanel.test.tsx
@@ -7,7 +7,7 @@
* - loading → loaded transition (renders rows once the audit log resolves)
* - formatting of tokens (k/M), cost ($x.xxxx), and duration (ms / s / m s)
* - the scope label mapping for github / gmail / rebuild scopes
- * - success ✓ vs failure ✗ status glyphs
+ * - success / partial / failed status badges
* - the empty state when no runs are recorded
* - registry labels from the status list, with the scope label as fallback
* - re-reading after a run ends, polling while one runs, and manual Refresh
@@ -178,10 +178,10 @@ describe('<SyncAuditPanel />', () => {
]);
render(<SyncAuditPanel />);
- const partialGlyph = await screen.findByTitle(
+ const partialBadge = await screen.findByTitle(
'250 item(s) fetched but not ingested into the memory tree'
);
- expect(partialGlyph).toHaveTextContent('⚠');
+ expect(partialBadge).toHaveTextContent('Partial');
});
it('falls back to the partial label when the row has no tree_error text', async () => {
@@ -190,16 +190,16 @@ describe('<SyncAuditPanel />', () => {
]);
render(<SyncAuditPanel />);
- const partialGlyph = await screen.findByTitle('Fetched, memory ingest failed');
- expect(partialGlyph).toHaveTextContent('⚠');
+ const partialBadge = await screen.findByTitle('Fetched, memory ingest failed');
+ expect(partialBadge).toHaveTextContent('Partial');
});
- it('renders the success glyph for successful runs', async () => {
+ it('renders the success badge for successful runs', async () => {
mockAuditLog.mockResolvedValue([entry({ success: true })]);
render(<SyncAuditPanel />);
- const okGlyph = await screen.findByTitle('Success');
- expect(okGlyph).toHaveTextContent('✓');
+ const okBadge = await screen.findByTitle('Success');
+ expect(okBadge).toHaveTextContent('Success');
});
it('maps a rebuild scope through its label', async () => {
diff --git a/app/src/components/settings/panels/TokenUsagePanel.tsx b/app/src/components/settings/panels/TokenUsagePanel.tsx
index cb2d0f45dc..a5bd12a6f1 100644
--- a/app/src/components/settings/panels/TokenUsagePanel.tsx
+++ b/app/src/components/settings/panels/TokenUsagePanel.tsx
@@ -232,7 +232,9 @@ const TokenUsagePanel = ({ embedded = false }: TokenUsagePanelProps = {}) => {
<div key={name} className="flex items-center justify-between py-1.5 text-sm">
<span className="font-mono text-content-secondary">{name}</span>
<span className="tabular-nums text-content-muted">
- {formatInt(b.tokensSaved)} tok · {formatUsd(b.costSavedUsd)}
+ {t('settings.tokenUsage.tokensAndCost', '{tokens} tok · {cost}')
+ .replace('{tokens}', formatInt(b.tokensSaved))
+ .replace('{cost}', formatUsd(b.costSavedUsd))}
</span>
</div>
))}
diff --git a/app/src/components/settings/panels/wallet/ManageTokensModal.tsx b/app/src/components/settings/panels/wallet/ManageTokensModal.tsx
index d1664f8891..3089b13525 100644
--- a/app/src/components/settings/panels/wallet/ManageTokensModal.tsx
+++ b/app/src/components/settings/panels/wallet/ManageTokensModal.tsx
@@ -6,6 +6,7 @@ import {
balanceKey,
formatDisplayBalance,
} from '../../../../features/wallet/walletDisplay';
+import { useT } from '../../../../lib/i18n/I18nContext';
import { type EvmNetwork, type WalletChain } from '../../../../services/walletApi';
import { type RootState } from '../../../../store';
import { toggleTokenHidden } from '../../../../store/walletPreferencesSlice';
@@ -24,6 +25,7 @@ interface ManageTokensModalProps {
}
export default function ManageTokensModal({ open, onClose, tokens }: ManageTokensModalProps) {
+ const { t } = useT();
const dispatch = useDispatch();
const hiddenTokenKeys = useSelector(
(state: RootState) => state.walletPreferences?.hiddenTokenKeys || []