Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(chat): retain automatic summary titles

Haozhe Wua6b24b8255d9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1340a9c5..07c83221f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Reduce agent request overhead with on-demand tool schemas while keeping the
complete tool catalog and existing execution permissions. Ordinary backtests
- no longer request extra attribution automatically; chat titles reuse the prompt.
+ no longer request extra attribution automatically. Automatic summary titles
+ remain available after the first chat exchange.
- Preserve oversized tool results in readable run artifacts and stop Swarm from
clearing new observations before the model sees them. Context pressure uses
the model window and includes tool schemas.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4532b101b..ef944a0a5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -33,8 +33,8 @@ The discovery policy is packaged in `src/agent/tool_loading.json`.
A direct lookup uses its tool contract. A normal backtest reports results,
validation warnings and limitations; additional attribution or optimization
follows the user's request. Existing numerical grounding and live order gates
-remain in place. Web chat uses the prompt-derived session title without an
-additional automatic model request.
+remain in place. Web chat still generates a model-written summary title after
+the first completed exchange, without overwriting a manual rename.
Large tool results are redacted and saved under the current run's `tool-results/`
when its tools can read the files. The bounded receipt names the original file
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 166cf148f..d21141fad 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -536,8 +536,8 @@ export const api = {
createSession: (title?: string) => request<SessionItem>("/sessions", { method: "POST", body: JSON.stringify({ title: title || "" }) }),
deleteSession: (sid: string) => request<{ status: string }>(`/sessions/${sid}`, { method: "DELETE" }),
renameSession: (sid: string, title: string) => request<{ status: string }>(`/sessions/${sid}`, { method: "PATCH", body: JSON.stringify({ title }) }),
- // Optional paid title generation; ordinary chat uses its prompt-derived title.
- // The backend refuses to overwrite a manual rename.
+ // Codex-style LLM summary title from the first exchange; backend refuses to
+ // overwrite a manual rename, so this is safe to fire-and-forget.
autoTitleSession: (sid: string) => request<{ status: string; title: string }>(`/sessions/${sid}/title/auto`, { method: "POST" }),
// Scheduled research: cadence + timezone are stored as authored (local
// wall-clock cron + IANA key), so list rows render without any UTC math.
diff --git a/frontend/src/pages/Agent.tsx b/frontend/src/pages/Agent.tsx
index f8152baa7..6ab9f10b1 100644
--- a/frontend/src/pages/Agent.tsx
+++ b/frontend/src/pages/Agent.tsx
@@ -1037,9 +1037,13 @@ export function Agent() {
});
}
- // Session creation already derives a title from the user's prompt.
- // Refresh the sidebar without another paid model call after answering.
- window.dispatchEvent(new Event("vibe:sessions-refresh"));
+ // First completed exchange → ask the backend for a Codex-style
+ // summary title, then nudge the sidebar to re-list sessions.
+ if (act().messages.filter((message) => message.type === "user").length === 1) {
+ api.autoTitleSession(sid)
+ .then(() => window.dispatchEvent(new Event("vibe:sessions-refresh")))
+ .catch(() => {});
+ }
// Detect Shadow Account id if render_shadow_report fired successfully this turn
const shadowCall = completedTools.find(
diff --git a/frontend/src/pages/__tests__/AgentActivityTimerPersistence.test.tsx b/frontend/src/pages/__tests__/AgentActivityTimerPersistence.test.tsx
index 78999163d..eb497b140 100644
--- a/frontend/src/pages/__tests__/AgentActivityTimerPersistence.test.tsx
+++ b/frontend/src/pages/__tests__/AgentActivityTimerPersistence.test.tsx
@@ -71,7 +71,7 @@ describe("Agent activity elapsed clock survives navigation", () => {
});
});
- it("finishes the first answer without starting a paid title request", async () => {
+ it("generates a summary title after the first answer and refreshes the sidebar", async () => {
const router = createMemoryRouter(
[{ path: "/", element: <Agent /> }],
{ initialEntries: ["/?session=session-one"] },
@@ -92,8 +92,8 @@ describe("Agent activity elapsed clock survives navigation", () => {
});
});
expect(useAgentStore.getState().messages.some((message) => message.content === "Hello back")).toBe(true);
- expect(refresh).toHaveBeenCalled();
- expect(apiMock.autoTitleSession).not.toHaveBeenCalled();
+ expect(apiMock.autoTitleSession).toHaveBeenCalledWith("session-one");
+ await waitFor(() => expect(refresh).toHaveBeenCalled());
} finally {
window.removeEventListener("vibe:sessions-refresh", refresh);
}