fix(frontend): show session display name in terminal toolbar header (#2382)

* fix(frontend): show session display name in terminal toolbar header

The terminal toolbar showed the raw session id. Show the display name
(session.title, same field the sidebar renders) instead, and
'Orchestrator' for orchestrator sessions.

Fixes #2380

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(frontend): cover terminal toolbar session label

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Harshit Singh Bhandari 2026-07-03 22:23:57 +05:30 committed by GitHub
parent f92ff1111a
commit 6f09a1fc78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,38 @@
import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import type { WorkspaceSession } from "../types/workspace";
import { CenterPane } from "./CenterPane";
// The terminal body pulls in xterm/SSE machinery irrelevant to the toolbar under test.
vi.mock("./TerminalPane", () => ({ TerminalPane: () => <div>terminal body</div> }));
const worker = {
id: "sess-1",
workspaceId: "proj-1",
workspaceName: "my-app",
title: "do the thing",
provider: "claude-code",
kind: "worker",
branch: "ao/sess-1",
status: "working",
updatedAt: "2026-06-10T00:00:00Z",
prs: [],
} satisfies WorkspaceSession;
describe("CenterPane toolbar session label", () => {
it("shows the session display name for a worker", () => {
render(<CenterPane session={worker} theme="dark" daemonReady />);
expect(screen.getByText("do the thing")).toBeInTheDocument();
expect(screen.queryByText("sess-1")).not.toBeInTheDocument();
});
it("shows 'Orchestrator' for an orchestrator session", () => {
render(<CenterPane session={{ ...worker, id: "sess-orch", kind: "orchestrator" }} theme="dark" daemonReady />);
expect(screen.getByText("Orchestrator")).toBeInTheDocument();
});
it("shows 'No session' when there is no session", () => {
render(<CenterPane theme="dark" daemonReady />);
expect(screen.getByText("No session")).toBeInTheDocument();
});
});

View File

@ -2,7 +2,7 @@ import { ChevronLeft, Maximize2, Minimize2, Shield } from "lucide-react";
import { useCallback, useEffect, useRef, useState, type WheelEvent } from "react"; import { useCallback, useEffect, useRef, useState, type WheelEvent } from "react";
import type { Theme } from "../stores/ui-store"; import type { Theme } from "../stores/ui-store";
import type { TerminalTarget } from "../types/terminal"; import type { TerminalTarget } from "../types/terminal";
import type { WorkspaceSession } from "../types/workspace"; import { isOrchestratorSession, type WorkspaceSession } from "../types/workspace";
import { TerminalPane } from "./TerminalPane"; import { TerminalPane } from "./TerminalPane";
type CenterPaneProps = { type CenterPaneProps = {
@ -99,7 +99,9 @@ export function CenterPane({ session, theme, daemonReady, terminalTarget, onSele
<div className="terminal-toolbar"> <div className="terminal-toolbar">
<div className="terminal-toolbar__label"> <div className="terminal-toolbar__label">
<span className="terminal-toolbar__eyebrow">TERMINAL</span> <span className="terminal-toolbar__eyebrow">TERMINAL</span>
<span className="terminal-toolbar__session">{session?.id ?? "No session"}</span> <span className="terminal-toolbar__session">
{!session ? "No session" : isOrchestratorSession(session) ? "Orchestrator" : session.title}
</span>
</div> </div>
<div className="terminal-toolbar__controls"> <div className="terminal-toolbar__controls">
<button <button