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(chat): preserve short tool durations in milliseconds

rubenluetke10-beep1b4af81b36a1
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
index 94fd58b240..276fca6835 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
@@ -112,4 +112,14 @@ describe("work trace", () => {
expect(traceDuration(119999)).toBe("1m 59s");
expect(traceDuration(-1)).toBe("0.0s");
});
+
+ it.each([1, 49, 99])("preserves a measured %i ms call instead of displaying zero", ms => {
+ expect(traceDuration(ms)).toBe(`${ms}ms`);
+ });
+
+ it.each(["RunCommand", "RunShellCommand", "run_shell"])("shows the short duration beside a readable %s label", name => {
+ render(<WorkTrace {...props} blocks={[tool("shell", { name, input: { command: "read skill instructions" }, durationMs: 49 })]} />);
+ expect(screen.getByRole("button", { name: /Run command.*49ms/ })).toBeTruthy();
+ expect(screen.queryByText("0.0s")).toBeNull();
+ });
});
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
index 4d87cc7189..6be3493008 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
@@ -14,6 +14,8 @@ export type Decide = (id: string, decision: ApprovalDecision) => void | Promise<
type Group = { id: string; blocks: TurnBlock[]; family: string | null };
export function traceDuration(ms: number): string {
+ // Keep short, measured calls visible instead of rounding 49 ms to "0.0s".
+ if (ms > 0 && ms < 100) return `${Math.ceil(ms)}ms`;
const seconds = Math.max(0, ms) / 1000;
if (seconds < 10) return `${seconds.toFixed(1)}s`;
if (seconds < 60) return `${Math.floor(seconds)}s`;
@@ -142,7 +144,7 @@ export const TraceTool = memo(function TraceTool({ block, status, onDecide }: {
const family = operation(block.name);
const description = describeToolStep(block.name, (block.input && typeof block.input === "object" ? block.input : {}) as Record<string, unknown>);
const readable = description.label.charAt(0).toUpperCase() + description.label.slice(1);
- const action = /^(bash|powershell|shell|run_shell|exec_command|run_command)$/i.test(block.name) ? "command"
+ const action = /^(bash|powershell|shell|run_?shell(_?command)?|exec_?command|run_?command)$/i.test(block.name) ? "command"
: /^(edit|edit_file|apply_patch|multi_edit|str_replace)$/i.test(block.name) ? "edit"
: /^(write|write_file|create_file)$/i.test(block.name) ? "write" : family;
const label = action ? t(`work_trace.${action}`) : description.labelKey ? t(description.labelKey) : readable;