Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: show humanized page agent chat timestamps (#19723)

p0ny568b8232b198
diff --git a/frontend/src/components/misc/HumanizeTs.vue b/frontend/src/components/misc/HumanizeTs.vue
index b5193e8f29..caaefcf41e 100644
--- a/frontend/src/components/misc/HumanizeTs.vue
+++ b/frontend/src/components/misc/HumanizeTs.vue
@@ -11,7 +11,8 @@
<script lang="ts" setup>
import { NTooltip } from "naive-ui";
import { computed } from "vue";
-import { formatAbsoluteDateTime, humanizeTs } from "@/utils";
+import { formatAbsoluteDateTime } from "@/utils/datetime";
+import { humanizeTs } from "@/utils/util";
const props = defineProps({
ts: {
diff --git a/frontend/src/plugins/agent/components/AgentWindow.test.ts b/frontend/src/plugins/agent/components/AgentWindow.test.ts
index ea5b3b8026..5093182dad 100644
--- a/frontend/src/plugins/agent/components/AgentWindow.test.ts
+++ b/frontend/src/plugins/agent/components/AgentWindow.test.ts
@@ -1,7 +1,7 @@
import { mount } from "@vue/test-utils";
import { NInput, NPopconfirm } from "naive-ui";
import { createPinia, setActivePinia } from "pinia";
-import { beforeEach, describe, expect, test, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { nextTick } from "vue";
import { createI18n } from "vue-i18n";
import { useAgentStore } from "../store/agent";
@@ -91,6 +91,10 @@ const mountAgentWindow = () => {
};
};
+afterEach(() => {
+ vi.useRealTimers();
+});
+
describe("AgentWindow", () => {
beforeEach(() => {
localStorage.clear();
@@ -127,6 +131,26 @@ describe("AgentWindow", () => {
).toBe(false);
});
+ test("shows a plain default title and humanized updated time for untitled chats", async () => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-03-02T12:00:00Z"));
+
+ const { store, wrapper } = mountAgentWindow();
+ const chatId = store.currentChatId!;
+
+ store.getChat(chatId)!.updatedTs = Date.now() - 60_000;
+ await nextTick();
+
+ const currentRow = wrapper.find(`[data-agent-chat-row='${chatId}']`);
+ expect(currentRow.find("[data-agent-chat-title]").text()).toBe("New chat");
+ expect(currentRow.find("[data-agent-chat-title]").text()).not.toContain(
+ "·"
+ );
+ expect(currentRow.find("[data-agent-chat-updated-ts]").text()).toBe(
+ "1 minute ago"
+ );
+ });
+
test("disables switching chats while a chat is running", async () => {
const { store, wrapper } = mountAgentWindow();
const firstChatId = store.currentChatId!;
diff --git a/frontend/src/plugins/agent/components/AgentWindow.vue b/frontend/src/plugins/agent/components/AgentWindow.vue
index 915b306c0b..f8e57163cb 100644
--- a/frontend/src/plugins/agent/components/AgentWindow.vue
+++ b/frontend/src/plugins/agent/components/AgentWindow.vue
@@ -10,6 +10,7 @@ import {
} from "vue";
import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router";
+import HumanizeTs from "@/components/misc/HumanizeTs.vue";
import type { AgentChat as AgentChatRecord } from "../logic/types";
import { useAgentStore } from "../store/agent";
import AgentChat from "./AgentChat.vue";
@@ -199,11 +200,7 @@ const getCurrentPageSnapshot = () => ({
});
const getEditableChatTitle = (chat: AgentChatRecord) =>
- chat.title
- ? chat.title
- : `${t("agent.chat-default-title")} · ${new Date(
- chat.createdTs
- ).toLocaleString()}`;
+ chat.title || t("agent.chat-default-title");
const getChatLabel = (chat: AgentChatRecord) => {
const baseLabel = getEditableChatTitle(chat);
@@ -630,16 +627,26 @@ onBeforeUnmount(() => {
<button
v-else
type="button"
- class="w-full text-left font-medium disabled:cursor-not-allowed disabled:opacity-60"
+ class="w-full text-left disabled:cursor-not-allowed disabled:opacity-60"
:disabled="!agentStore.canSelectChat(chat.id)"
:aria-current="
chat.id === agentStore.currentChatId ? 'true' : undefined
"
@click="handleChatRowClick(chat.id)"
>
- <div class="truncate">
+ <div class="truncate font-medium" data-agent-chat-title>
{{ getChatLabel(chat) }}
</div>
+ <HumanizeTs
+ :ts="Math.floor(chat.updatedTs / 1000)"
+ class="mt-1 block truncate text-xs"
+ :class="
+ chat.id === agentStore.currentChatId
+ ? 'text-blue-600/80'
+ : 'text-gray-500'
+ "
+ data-agent-chat-updated-ts
+ />
</button>
</div>
</div>
diff --git a/frontend/src/plugins/agent/store/agent.test.ts b/frontend/src/plugins/agent/store/agent.test.ts
index 604c413a38..0c950f1bdb 100644
--- a/frontend/src/plugins/agent/store/agent.test.ts
+++ b/frontend/src/plugins/agent/store/agent.test.ts
@@ -205,7 +205,7 @@ describe("useAgentStore", () => {
});
});
- test("uses the first user message as the default chat title", () => {
+ test("uses the first user message as the generated chat title", () => {
const store = createStore();
const chatId = store.currentChatId!;