Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(terminal): wait on the font weight the pane draws with, so a pane no longer sits out the 1.5 s font timeout

rubenluetke10-beepdb0cce1a1cf7
diff --git a/jarvis/ui/web/frontend/src/lib/terminalFont.test.ts b/jarvis/ui/web/frontend/src/lib/terminalFont.test.ts
index c09f619178..f421eccf46 100644
--- a/jarvis/ui/web/frontend/src/lib/terminalFont.test.ts
+++ b/jarvis/ui/web/frontend/src/lib/terminalFont.test.ts
@@ -426,6 +426,39 @@ describe("whenTerminalFontReady", () => {
}
});
+ it("asks for the weight it waits on, so a Medium body cut does not sit out the timeout", async () => {
+ // Every weight is declared, only the ones asked for by name get loaded —
+ // the way a browser treats @font-face faces nothing has drawn with yet.
+ const requested = new Set<string>();
+ const listeners = new Set<() => void>();
+ const weightOf = (spec: string) => spec.trim().split(/\s+/)[0];
+ const set = {
+ check: vi.fn((spec: string) => requested.has(weightOf(spec))),
+ load: vi.fn((spec: string) => {
+ requested.add(weightOf(spec));
+ return Promise.resolve([]);
+ }),
+ addEventListener: (type: string, fn: () => void) => {
+ if (type === "loadingdone") listeners.add(fn);
+ },
+ removeEventListener: (_type: string, fn: () => void) => {
+ listeners.delete(fn);
+ },
+ [Symbol.iterator]: () => [{ family: '"JetBrains Mono"' }][Symbol.iterator](),
+ } as unknown as FontFaceSet;
+ vi.useFakeTimers();
+ try {
+ let resolved = false;
+ void whenTerminalFontReady(15, { fonts: set }).then(() => {
+ resolved = true;
+ });
+ await vi.advanceTimersByTimeAsync(0);
+ expect(resolved).toBe(true);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
it("gives up after the bounded wait, so an offline pane still opens", async () => {
vi.useFakeTimers();
try {
diff --git a/jarvis/ui/web/frontend/src/lib/terminalFont.ts b/jarvis/ui/web/frontend/src/lib/terminalFont.ts
index 11dc0c7890..f5b1cb5bde 100644
--- a/jarvis/ui/web/frontend/src/lib/terminalFont.ts
+++ b/jarvis/ui/web/frontend/src/lib/terminalFont.ts
@@ -256,7 +256,12 @@ export function whenTerminalFontReady(
const fonts = deps.fonts !== undefined ? deps.fonts : browserFonts();
if (!fonts || terminalFontSettled(fontSize, { fonts })) return Promise.resolve();
const timeoutMs = deps.timeoutMs ?? FONT_WAIT_MS;
- const spec = `400 ${fontSize}px ${DISPLAY_FAMILY}`;
+ // The weight the settled check asks about, never a hard-coded Regular. When
+ // the body weight moved to Medium this still requested 400: the Regular cut
+ // loaded, the Medium one was never asked for, and every pane opened on a
+ // screen that had drawn no terminal yet sat out the whole wait (1.5 s+ on
+ // the office's pane panel, 2026-09-30).
+ const spec = `${TERMINAL_FONT_WEIGHT} ${fontSize}px ${DISPLAY_FAMILY}`;
return new Promise<void>((resolve) => {
let done = false;
let timer: ReturnType<typeof setTimeout> | undefined;